diff options
author | Justus Winter <justus@gnupg.org> | 2016-10-01 13:29:24 +0200 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2016-10-01 15:51:26 +0200 |
commit | 1443986a08b4cd564172875c07551681314014da (patch) | |
tree | 2d2fe3496e7c91a11a31003c76f1e02b985967b1 /kern | |
parent | f025f685e965ac9ee1cd35ff3636c8554d9939d2 (diff) | |
download | gnumach-1443986a08b4cd564172875c07551681314014da.tar.gz gnumach-1443986a08b4cd564172875c07551681314014da.tar.bz2 gnumach-1443986a08b4cd564172875c07551681314014da.zip |
kern: Improve panic messages from the scheduler.
* kern/sched_prim.c (state_panic): Turn into macro, print symbolic
values of thread state.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/sched_prim.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/kern/sched_prim.c b/kern/sched_prim.c index 0cef1601..bb767352 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -357,12 +357,17 @@ void clear_wait( splx(s); } -static inline void __attribute__((noreturn)) -state_panic(const thread_t thread, const char *caller) -{ - panic ("%s: thread %x has unexpected state %x", - caller, thread, thread->state); -} +#define state_panic(thread) \ + panic ("thread %p has unexpected state %x (%s%s%s%s%s%s%s%s)", \ + thread, thread->state, \ + thread->state & TH_WAIT ? "TH_WAIT|" : "", \ + thread->state & TH_SUSP ? "TH_SUSP|" : "", \ + thread->state & TH_RUN ? "TH_RUN|" : "", \ + thread->state & TH_UNINT ? "TH_UNINT|" : "", \ + thread->state & TH_HALTED ? "TH_HALTED|" : "", \ + thread->state & TH_IDLE ? "TH_IDLE|" : "", \ + thread->state & TH_SWAPPED ? "TH_SWAPPED|" : "", \ + thread->state & TH_SW_COMING_IN ? "TH_SW_COMING_IN|" : "") /* * thread_wakeup_prim: @@ -426,7 +431,7 @@ void thread_wakeup_prim( break; default: - state_panic(thread, "thread_wakeup"); + state_panic(thread); break; } thread_unlock(thread); @@ -716,7 +721,7 @@ boolean_t thread_invoke( break; default: - state_panic(old_thread, "thread_invoke"); + state_panic(old_thread); } thread_unlock(old_thread); after_old_thread: @@ -966,7 +971,7 @@ void thread_dispatch( break; default: - state_panic(thread, "thread_dispatch"); + state_panic(thread); } thread_unlock(thread); } |