Introduced the notion of a currently debugged thread in the kernel

debugger and added respective getter/setter methods
debug_{get,set}_debugged_thread(). By default the currently debugged
thread is the thread that dropped into the kernel debugger, but commands
like "in_context" can change it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27164 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-08-22 23:54:49 +00:00
parent 07569b03c9
commit 290e3dd228
2 changed files with 24 additions and 0 deletions

View File

@ -129,6 +129,9 @@ extern bool print_debugger_command_usage(const char* command);
extern void debug_set_demangle_hook(const char *(*hook)(const char *));
extern const char *debug_demangle(const char *);
extern struct thread* debug_set_debugged_thread(struct thread* thread);
extern struct thread* debug_get_debugged_thread();
extern void _user_debug_output(const char *userString);
#ifdef __cplusplus

View File

@ -93,6 +93,8 @@ static int32 sCurrentLine = 0;
static const char *(*sDemangleHook)(const char *) = NULL;
static struct thread* sDebuggedThread;
#define distance(a, b) ((a) < (b) ? (b) - (a) : (a) - (b))
@ -1216,6 +1218,8 @@ kernel_debugger(const char *message)
sDebugOutputFilter = &gDefaultDebugOutputFilter;
sDebuggedThread = NULL;
if (message)
kprintf("PANIC: %s\n", message);
@ -1426,6 +1430,23 @@ debug_demangle(const char *sym)
}
struct thread*
debug_set_debugged_thread(struct thread* thread)
{
struct thread* previous = sDebuggedThread;
sDebuggedThread = thread;
return previous;
}
struct thread*
debug_get_debugged_thread()
{
return sDebuggedThread != NULL
? sDebuggedThread : thread_get_current_thread();
}
// #pragma mark -
// userland syscalls