aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/process_kern.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2005-09-16 22:27:46 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-17 14:49:59 -0400
commit3eddddcf239c89bbd3c50d1440001a3d384ed40a (patch)
tree8f41380260d8de20c14315bc3684c37e26632fe3 /arch/um/kernel/process_kern.c
parentf6e34c6af6f18bd6c66bfb1c6a7c57068412aa73 (diff)
[PATCH] uml: breakpoint an arbitrary thread
This patch implements a stack trace for a thread, not unlike sysrq-t does. The advantage to this is that a break point can be placed on showreqs, so that upon showing the stack, you jump immediately into the debugger. While sysrq-t does the same thing, sysrq-t shows *all* threads stacks. It also doesn't work right now. In the future, I thought it might be acceptable to make this show all pids stacks, but perhaps leaving well enough alone and just using sysrq-t would be okay. For now, upon receiving the stack command, UML switches context to that thread, dumps its registers, and then switches context back to the original thread. Since UML compacts all threads into one of 4 host threads, this sort of mechanism could be expanded in the future to include other debugging helpers that sysrq does not cover. Note by jdike - The main benefit to this is that it brings an arbitrary thread back into context, where it can be examined by gdb. The fact that it dumps it stack is secondary. This provides the capability to examine a sleeping thread, which has existed in tt mode, but not in skas mode until now. Also, the other threads, that sysrq doesn't cover, can be gdb-ed directly anyway. Signed-off-by: Allan Graves<allan.graves@gmail.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel/process_kern.c')
-rw-r--r--arch/um/kernel/process_kern.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index 1143f5e522b2..39cf568ccfaf 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -119,7 +119,14 @@ void *_switch_to(void *prev, void *next, void *last)
119 to->thread.prev_sched = from; 119 to->thread.prev_sched = from;
120 set_current(to); 120 set_current(to);
121 121
122 CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next); 122 do {
123 current->thread.saved_task = NULL ;
124 CHOOSE_MODE_PROC(switch_to_tt, switch_to_skas, prev, next);
125 if(current->thread.saved_task)
126 show_regs(&(current->thread.regs));
127 next= current->thread.saved_task;
128 prev= current;
129 } while(current->thread.saved_task);
123 130
124 return(current->thread.prev_sched); 131 return(current->thread.prev_sched);
125 132