/branches/tracing/kernel/generic/include/proc/thread.h |
---|
46,6 → 46,7 |
#include <arch/cpu.h> |
#include <mm/tlb.h> |
#include <proc/uarg.h> |
#include <udebug/udebug.h> |
#define THREAD_STACK_SIZE STACK_SIZE |
#define THREAD_NAME_BUFLEN 20 |
210,6 → 211,8 |
call_t *debug_go_call; |
unative_t syscall_args[6]; |
istate_t *uspace_state; |
/** What type of event are we stopped in or 0 if none */ |
udebug_event_t cur_event; |
bool debug_stop; |
bool debug_active; /**< In a debugging session */ |
} thread_t; |
/branches/tracing/kernel/generic/include/udebug/udebug.h |
---|
119,8 → 119,8 |
typedef enum { |
UDEBUG_EVENT_FINISHED, /**< Debuging session has finished */ |
UDEBUG_EVENT_SYSCALL /**< A syscall has been executed */ |
UDEBUG_EVENT_FINISHED = 1, /**< Debuging session has finished */ |
UDEBUG_EVENT_SYSCALL /**< A syscall has been executed */ |
} udebug_event_t; |
#ifdef KERNEL |
/branches/tracing/kernel/generic/src/proc/thread.c |
---|
350,6 → 350,7 |
t->uspace_state = NULL; |
t->debug_stop = true; |
t->debug_active = false; |
t->cur_event = 0; /* none */ |
/* might depend on previous initialization */ |
thread_create_arch(t); |
/branches/tracing/kernel/generic/src/udebug/udebug_ipc.c |
---|
53,9 → 53,6 |
* is connected. It will lock the task, making sure it exists. |
* |
* Interrupts must be already disabled. |
* |
* (TODO: make sure the udebug-cleanup of the task hasn't |
* started yet) |
*/ |
static task_t *get_lock_callee_task(phone_t *phone) |
{ |
259,6 → 256,7 |
if ((flags & THREAD_FLAG_USPACE) != 0) { |
/* Prevent any further debug activity in thread */ |
t->debug_active = false; |
t->cur_event = 0; /* none */ |
/* Still has go? */ |
if (t->debug_stop == false) { |
323,6 → 321,7 |
t->debug_go_call = call; |
t->debug_stop = false; |
t->cur_event = 0; /* none */ |
/* |
* Neither t's lock nor threads_lock may be held during wakeup |
356,7 → 355,12 |
return rc; |
} |
//FIXME: additionally we need to verify that we are inside a syscall |
/* Additionally we need to verify that we are inside a syscall */ |
if (t->cur_event != UDEBUG_EVENT_SYSCALL) { |
_thread_op_end(t); |
interrupts_restore(ipl); |
return EINVAL; |
} |
/* Copy to a local buffer before releasing the lock */ |
memcpy(buffer, t->syscall_args, 6 * sizeof(unative_t)); |
/branches/tracing/kernel/generic/src/udebug/udebug.c |
---|
103,6 → 103,8 |
* point it must be back to the initial true value). |
*/ |
THREAD->debug_stop = true; |
THREAD->cur_event = UDEBUG_EVENT_SYSCALL; |
spinlock_unlock(&THREAD->debug_lock); |
spinlock_lock(&TASK->lock); |