Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3017 → Rev 3018

/branches/tracing/kernel/generic/include/proc/thread.h
206,18 → 206,7
uint8_t *kstack;
 
/** Debugging stuff */
SPINLOCK_DECLARE(debug_lock);
waitq_t go_wq;
call_t *debug_go_call;
unative_t syscall_args[6];
istate_t *uspace_state;
bool debug_in_before_thread_runs;
 
/** What type of event are we stopped in or 0 if none */
udebug_event_t cur_event;
bool debug_stop;
bool debug_stoppable;
bool debug_active; /**< In a debugging session */
udebug_thread_t udebug;
} thread_t;
 
/** Thread list lock.
/branches/tracing/kernel/generic/include/udebug/udebug.h
201,10 → 201,30
udebug_evmask_t evmask;
} udebug_task_t;
 
/** Debugging part of thread_t structure.
*/
typedef struct {
/** Synchronize debug ops on this thread / access to this structure */
SPINLOCK_DECLARE(lock);
 
waitq_t go_wq;
call_t *go_call;
unative_t syscall_args[6];
istate_t *uspace_state;
bool in_before_thread_runs;
 
/** What type of event are we stopped in or 0 if none */
udebug_event_t cur_event;
bool stop;
bool stoppable;
bool debug_active; /**< In a debugging session */
} udebug_thread_t;
 
struct task;
struct thread;
 
void udebug_task_init(udebug_task_t *ut);
void udebug_thread_initialize(udebug_thread_t *ut);
 
void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc,
/branches/tracing/kernel/generic/src/interrupt/interrupt.c
87,11 → 87,11
{
ASSERT(n < IVT_ITEMS);
 
if (THREAD) THREAD->uspace_state = istate;
if (THREAD) THREAD->udebug.uspace_state = istate;
exc_table[n].f(n + IVT_FIRST, istate);
 
if (THREAD) THREAD->uspace_state = NULL;
if (THREAD) THREAD->udebug.uspace_state = NULL;
 
/* This is a safe place to exit exiting thread */
if (THREAD && THREAD->interrupted && istate_from_uspace(istate))
/branches/tracing/kernel/generic/src/proc/thread.c
176,7 → 176,7
return -1;
}
 
spinlock_initialize(&t->debug_lock, "thread_debug_lock");
spinlock_initialize(&t->udebug.lock, "thread_debug_lock");
 
return 0;
}
347,13 → 347,7
t->threads_tree_node.key = (uintptr_t) t;
/* Init debugging stuff */
waitq_initialize(&t->go_wq);
t->debug_go_call = NULL;
t->uspace_state = NULL;
t->debug_stop = true;
t->debug_stoppable = true;
t->debug_active = false;
t->cur_event = 0; /* none */
udebug_thread_initialize(&t->udebug);
 
/* might depend on previous initialization */
thread_create_arch(t);
/branches/tracing/kernel/generic/src/syscall/syscall.c
99,7 → 99,7
unative_t rc;
istate_t fake_state;
 
THREAD->uspace_state = &fake_state;
THREAD->udebug.uspace_state = &fake_state;
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
 
if (id < SYSCALL_END) {
117,7 → 117,7
 
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
udebug_stoppable_end();
THREAD->uspace_state = NULL;
THREAD->udebug.uspace_state = NULL;
return rc;
}
/branches/tracing/kernel/generic/src/udebug/udebug.c
50,6 → 50,17
ut->evmask = 0;
}
 
void udebug_thread_initialize(udebug_thread_t *ut)
{
waitq_initialize(&ut->go_wq);
ut->go_call = NULL;
ut->uspace_state = NULL;
ut->stop = true;
ut->stoppable = true;
ut->debug_active = false;
ut->cur_event = 0; /* none */
}
 
static void udebug_wait_for_go(waitq_t *wq)
{
int rc;
90,11 → 101,11
db_call = TASK->udebug.begin_call;
ASSERT(db_call);
 
/* Lock order OK, THREAD->debug_lock is after TASK->udebug.lock */
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
THREAD->debug_stoppable = true;
spinlock_unlock(&THREAD->debug_lock);
spinlock_lock(&THREAD->udebug.lock);
THREAD->udebug.stoppable = true;
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
 
TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
110,26 → 121,26
* Active debugging session
*/
 
/* Lock order OK, THREAD->debug_lock is after TASK->udebug.lock */
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
THREAD->debug_stoppable = true;
spinlock_lock(&THREAD->udebug.lock);
THREAD->udebug.stoppable = true;
 
if (THREAD->debug_active && THREAD->debug_stop) {
if (THREAD->udebug.debug_active && THREAD->udebug.stop) {
/*
* Thread was requested to stop - answer go call
*/
 
/* Make sure nobody takes this call away from us */
go_call = THREAD->debug_go_call;
THREAD->debug_go_call = NULL;
go_call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
ASSERT(go_call);
 
IPC_SET_RETVAL(go_call->data, 0);
IPC_SET_ARG1(go_call->data, UDEBUG_EVENT_STOP);
 
THREAD->cur_event = UDEBUG_EVENT_STOP;
spinlock_unlock(&THREAD->debug_lock);
THREAD->udebug.cur_event = UDEBUG_EVENT_STOP;
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
 
ipc_answer(&TASK->answerbox, go_call);
139,7 → 150,7
/*
* No stop request - nothing happens.
*/
spinlock_unlock(&THREAD->debug_lock);
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
mutex_unlock(&TASK->udebug.lock);
}
148,11 → 159,11
* All other cases - nothing special happens.
*/
 
/* Lock order OK, THREAD->debug_lock is after TASK->udebug.lock */
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
THREAD->debug_stoppable = true;
spinlock_unlock(&THREAD->debug_lock);
spinlock_lock(&THREAD->udebug.lock);
THREAD->udebug.stoppable = true;
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
 
mutex_unlock(&TASK->udebug.lock);
166,31 → 177,31
restart:
mutex_lock(&TASK->udebug.lock);
 
/* Lock order OK, THREAD->debug_lock is after TASK->udebug.lock */
/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
spinlock_lock(&THREAD->udebug.lock);
 
if (TASK->udebug.dt_state == UDEBUG_TS_ACTIVE) {
//klog_printf("udebug_stoppable_end");
//klog_printf("debug_stop=%d", THREAD->debug_stop);
//klog_printf("udebug.stop=%d", THREAD->udebug.stop);
}
 
if (THREAD->debug_active &&
THREAD->debug_stop == true) {
if (THREAD->udebug.debug_active &&
THREAD->udebug.stop == true) {
TASK->udebug.begin_call = NULL;
spinlock_unlock(&THREAD->debug_lock);
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
mutex_unlock(&TASK->udebug.lock);
 
udebug_wait_for_go(&THREAD->go_wq);
udebug_wait_for_go(&THREAD->udebug.go_wq);
 
goto restart;
/* must try again - have to lose stoppability atomically */
} else {
++TASK->udebug.not_stoppable_count;
THREAD->debug_stoppable = false;
THREAD->udebug.stoppable = false;
 
spinlock_unlock(&THREAD->debug_lock);
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
mutex_unlock(&TASK->udebug.lock);
}
208,10 → 219,10
ipl_t ipl;
 
/* This will happen if we get preempted inside this function. */
if (THREAD->debug_in_before_thread_runs)
if (THREAD->udebug.in_before_thread_runs)
return;
 
THREAD->debug_in_before_thread_runs = true;
THREAD->udebug.in_before_thread_runs = true;
ipl = interrupts_enable();
 
/* Now we're free to do whatever we need (lock mutexes, sleep, etc.) */
221,7 → 232,7
udebug_stoppable_end();
 
interrupts_restore(ipl);
THREAD->debug_in_before_thread_runs = false;
THREAD->udebug.in_before_thread_runs = false;
}
 
void udebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
237,13 → 248,13
mutex_lock(&TASK->udebug.lock);
 
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
spinlock_lock(&THREAD->udebug.lock);
 
/* Must only generate events when in debugging session and have go */
if (THREAD->debug_active != true ||
THREAD->debug_stop == true ||
if (THREAD->udebug.debug_active != true ||
THREAD->udebug.stop == true ||
(TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) {
spinlock_unlock(&THREAD->debug_lock);
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
mutex_unlock(&TASK->udebug.lock);
return;
250,8 → 261,8
}
 
//klog_printf("udebug_syscall_event");
call = THREAD->debug_go_call;
THREAD->debug_go_call = NULL;
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
 
IPC_SET_RETVAL(call->data, 0);
IPC_SET_ARG1(call->data, etype);
259,22 → 270,22
IPC_SET_ARG3(call->data, rc);
//klog_printf("udebug_syscall_event/ipc_answer");
 
THREAD->syscall_args[0] = a1;
THREAD->syscall_args[1] = a2;
THREAD->syscall_args[2] = a3;
THREAD->syscall_args[3] = a4;
THREAD->syscall_args[4] = a5;
THREAD->syscall_args[5] = a6;
THREAD->udebug.syscall_args[0] = a1;
THREAD->udebug.syscall_args[1] = a2;
THREAD->udebug.syscall_args[2] = a3;
THREAD->udebug.syscall_args[3] = a4;
THREAD->udebug.syscall_args[4] = a5;
THREAD->udebug.syscall_args[5] = a6;
 
/*
* Make sure debug_stop is true when going to sleep
* Make sure udebug.stop is true when going to sleep
* in case we get woken up by DEBUG_END. (At which
* point it must be back to the initial true value).
*/
THREAD->debug_stop = true;
THREAD->udebug.stop = true;
 
THREAD->cur_event = etype;
spinlock_unlock(&THREAD->debug_lock);
THREAD->udebug.cur_event = etype;
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
 
ipc_answer(&TASK->answerbox, call);
281,7 → 292,7
 
mutex_unlock(&TASK->udebug.lock);
 
udebug_wait_for_go(&THREAD->go_wq);
udebug_wait_for_go(&THREAD->udebug.go_wq);
}
 
void udebug_thread_b_event(struct thread *t)
292,17 → 303,17
mutex_lock(&TASK->udebug.lock);
 
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
spinlock_lock(&THREAD->udebug.lock);
 
klog_printf("udebug_thread_b_event");
klog_printf("- check state");
 
/* Must only generate events when in debugging session */
if (THREAD->debug_active != true) {
klog_printf("- debug_active: %s, debug_stop: %s",
THREAD->debug_active ? "yes(+)" : "no(-)",
THREAD->debug_stop ? "yes(-)" : "no(+)");
spinlock_unlock(&THREAD->debug_lock);
if (THREAD->udebug.debug_active != true) {
klog_printf("- debug_active: %s, udebug.stop: %s",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
THREAD->udebug.stop ? "yes(-)" : "no(+)");
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
mutex_unlock(&TASK->udebug.lock);
return;
310,21 → 321,21
 
klog_printf("- trigger event");
 
call = THREAD->debug_go_call;
THREAD->debug_go_call = NULL;
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
IPC_SET_RETVAL(call->data, 0);
IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B);
IPC_SET_ARG2(call->data, (unative_t)t);
 
/*
* Make sure debug_stop is true when going to sleep
* Make sure udebug.stop is true when going to sleep
* in case we get woken up by DEBUG_END. (At which
* point it must be back to the initial true value).
*/
THREAD->debug_stop = true;
THREAD->udebug.stop = true;
 
THREAD->cur_event = UDEBUG_EVENT_THREAD_B;
spinlock_unlock(&THREAD->debug_lock);
THREAD->udebug.cur_event = UDEBUG_EVENT_THREAD_B;
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
 
ipc_answer(&TASK->answerbox, call);
332,7 → 343,7
mutex_unlock(&TASK->udebug.lock);
 
klog_printf("- sleep");
udebug_wait_for_go(&THREAD->go_wq);
udebug_wait_for_go(&THREAD->udebug.go_wq);
}
 
void udebug_thread_e_event(void)
343,17 → 354,17
mutex_lock(&TASK->udebug.lock);
 
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
spinlock_lock(&THREAD->udebug.lock);
 
klog_printf("udebug_thread_e_event");
klog_printf("- check state");
 
/* Must only generate events when in debugging session */
if (THREAD->debug_active != true) {
klog_printf("- debug_active: %s, debug_stop: %s",
THREAD->debug_active ? "yes(+)" : "no(-)",
THREAD->debug_stop ? "yes(-)" : "no(+)");
spinlock_unlock(&THREAD->debug_lock);
if (THREAD->udebug.debug_active != true) {
klog_printf("- debug_active: %s, udebug.stop: %s",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
THREAD->udebug.stop ? "yes(-)" : "no(+)");
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
mutex_unlock(&TASK->udebug.lock);
return;
361,17 → 372,17
 
klog_printf("- trigger event");
 
call = THREAD->debug_go_call;
THREAD->debug_go_call = NULL;
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
IPC_SET_RETVAL(call->data, 0);
IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E);
 
/* Prevent any further debug activity in thread */
THREAD->debug_active = false;
THREAD->cur_event = 0; /* none */
THREAD->debug_stop = true; /* set to initial value */
THREAD->udebug.debug_active = false;
THREAD->udebug.cur_event = 0; /* none */
THREAD->udebug.stop = true; /* set to initial value */
 
spinlock_unlock(&THREAD->debug_lock);
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
 
ipc_answer(&TASK->answerbox, call);
389,13 → 400,13
mutex_lock(&TASK->udebug.lock);
 
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
spinlock_lock(&THREAD->udebug.lock);
 
/* Must only generate events when in debugging session and have go */
if (THREAD->debug_active != true ||
THREAD->debug_stop == true ||
if (THREAD->udebug.debug_active != true ||
THREAD->udebug.stop == true ||
(TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) {
spinlock_unlock(&THREAD->debug_lock);
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
mutex_unlock(&TASK->udebug.lock);
return;
402,8 → 413,8
}
 
klog_printf("udebug_breakpoint/trap_event");
call = THREAD->debug_go_call;
THREAD->debug_go_call = NULL;
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
 
IPC_SET_RETVAL(call->data, 0);
IPC_SET_ARG1(call->data, etype);
410,14 → 421,14
IPC_SET_ARG2(call->data, addr);
 
/*
* Make sure debug_stop is true when going to sleep
* Make sure udebug.stop is true when going to sleep
* in case we get woken up by DEBUG_END. (At which
* point it must be back to the initial true value).
*/
THREAD->debug_stop = true;
THREAD->udebug.stop = true;
 
THREAD->cur_event = etype;
spinlock_unlock(&THREAD->debug_lock);
THREAD->udebug.cur_event = etype;
spinlock_unlock(&THREAD->udebug.lock);
interrupts_restore(ipl);
klog_printf("- send answer");
 
424,7 → 435,7
ipc_answer(&TASK->answerbox, call);
mutex_unlock(&TASK->udebug.lock);
 
udebug_wait_for_go(&THREAD->go_wq);
udebug_wait_for_go(&THREAD->udebug.go_wq);
}
 
void udebug_breakpoint_event(uintptr_t addr)
464,7 → 475,7
t = list_get_instance(cur, thread_t, th_link);
 
ipl = interrupts_disable();
spinlock_lock(&t->debug_lock);
spinlock_lock(&t->udebug.lock);
spinlock_lock(&t->lock);
 
flags = t->flags;
474,24 → 485,24
/* Only process userspace threads */
if ((flags & THREAD_FLAG_USPACE) != 0) {
/* Prevent any further debug activity in thread */
t->debug_active = false;
t->cur_event = 0; /* none */
t->udebug.debug_active = false;
t->udebug.cur_event = 0; /* none */
 
/* Still has go? */
if (t->debug_stop == false) {
if (t->udebug.stop == false) {
/*
* Yes, so clear go. As debug_active == false,
* this doesn't affect anything.
*/
t->debug_stop = true;
t->udebug.stop = true;
 
/* Answer GO call */
klog_printf("answer GO call with EVENT_FINISHED");
IPC_SET_RETVAL(t->debug_go_call->data, 0);
IPC_SET_ARG1(t->debug_go_call->data, UDEBUG_EVENT_FINISHED);
IPC_SET_RETVAL(t->udebug.go_call->data, 0);
IPC_SET_ARG1(t->udebug.go_call->data, UDEBUG_EVENT_FINISHED);
/* FIXME: must not call with interrupts disabled!!*/
ipc_answer(&ta->answerbox, t->debug_go_call);
t->debug_go_call = NULL;
ipc_answer(&ta->answerbox, t->udebug.go_call);
t->udebug.go_call = NULL;
} else {
/*
* Debug_stop is already at initial value.
502,10 → 513,10
* t's lock must not be held when calling
* waitq_wakeup.
*/
waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
waitq_wakeup(&t->udebug.go_wq, WAKEUP_FIRST);
}
}
spinlock_unlock(&t->debug_lock);
spinlock_unlock(&t->udebug.lock);
interrupts_restore(ipl);
}
 
/branches/tracing/kernel/generic/src/udebug/udebug_ops.c
48,13 → 48,13
/**
* Prepare a thread for a debugging operation.
*
* Simply put, return thread t with t->debug_lock held,
* Simply put, return thread t with t->udebug.lock held,
* but only if it verifies all conditions.
*
* Specifically, verifies that thread t exists, is a userspace thread,
* and belongs to the current task (TASK). Verifies, that the thread
* has (or hasn't) go according to having_go (typically false).
* It also locks t->debug_lock, making sure that t->debug_active is true
* It also locks t->udebug.lock, making sure that t->udebug.debug_active is true
* - that the thread is in a valid debugging session.
*
* Returns EOK if all went well, or an error code otherwise.
77,7 → 77,7
return ENOENT;
}
 
spinlock_lock(&t->debug_lock);
spinlock_lock(&t->udebug.lock);
spinlock_lock(&t->lock);
/* Now verify that it's the current task */
94,7 → 94,7
goto error_exit;
}
 
if ((t->debug_active != true) || (!t->debug_stop != having_go)) {
if ((t->udebug.debug_active != true) || (!t->udebug.stop != having_go)) {
/* Not in debugging session or undesired GO state */
rc = EINVAL;
goto error_exit;
103,7 → 103,7
spinlock_unlock(&threads_lock);
spinlock_unlock(&t->lock);
 
/* Only t->debug_lock left */
/* Only t->udebug.lock left */
 
return EOK; /* All went well */
 
111,7 → 111,7
/* Executed when a check on the thread fails */
error_exit:
spinlock_unlock(&t->lock);
spinlock_unlock(&t->debug_lock);
spinlock_unlock(&t->udebug.lock);
spinlock_unlock(&threads_lock);
 
/* No locks left here */
121,7 → 121,7
 
static void _thread_op_end(thread_t *t)
{
spinlock_unlock(&t->debug_lock);
spinlock_unlock(&t->udebug.lock);
}
 
/**
159,16 → 159,16
reply = 0; /* no reply */
}
/* Set debug_active on all of the task's userspace threads */
/* Set udebug.debug_active on all of the task's userspace threads */
 
for (cur = TASK->th_head.next; cur != &TASK->th_head; cur = cur->next) {
t = list_get_instance(cur, thread_t, th_link);
 
ipl = interrupts_disable();
spinlock_lock(&t->debug_lock);
spinlock_lock(&t->udebug.lock);
if ((t->flags & THREAD_FLAG_USPACE) != 0)
t->debug_active = true;
spinlock_unlock(&t->debug_lock);
t->udebug.debug_active = true;
spinlock_unlock(&t->udebug.lock);
interrupts_restore(ipl);
}
 
228,7 → 228,7
 
ipl = interrupts_disable();
 
/* On success, this will lock t->debug_lock */
/* On success, this will lock t->udebug.lock */
rc = _thread_op_begin(t, false);
if (rc != EOK) {
interrupts_restore(ipl);
235,14 → 235,14
return rc;
}
 
t->debug_go_call = call;
t->debug_stop = false;
t->cur_event = 0; /* none */
t->udebug.go_call = call;
t->udebug.stop = false;
t->udebug.cur_event = 0; /* none */
 
/*
* Neither t's lock nor threads_lock may be held during wakeup
*/
waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
waitq_wakeup(&t->udebug.go_wq, WAKEUP_FIRST);
 
_thread_op_end(t);
interrupts_restore(ipl);
261,7 → 261,7
ipl = interrupts_disable();
 
/*
* On success, this will lock t->debug_lock. Note that this makes sure
* On success, this will lock t->udebug.lock. Note that this makes sure
* the thread is not stopped.
*/
rc = _thread_op_begin(t, true);
271,9 → 271,9
}
 
/* Take GO away from the thread */
t->debug_stop = true;
t->udebug.stop = true;
 
if (!t->debug_stoppable) {
if (!t->udebug.stoppable) {
/* Answer will be sent when the thread becomes stoppable */
_thread_op_end(t);
interrupts_restore(ipl);
286,14 → 286,14
klog_printf("udebug_stop - answering go call");
 
/* Make sure nobody takes this call away from us */
call = t->debug_go_call;
t->debug_go_call = NULL;
call = t->udebug.go_call;
t->udebug.go_call = NULL;
 
IPC_SET_RETVAL(call->data, 0);
IPC_SET_ARG1(call->data, UDEBUG_EVENT_STOP);
klog_printf("udebug_stop/ipc_answer");
 
THREAD->cur_event = UDEBUG_EVENT_STOP;
THREAD->udebug.cur_event = UDEBUG_EVENT_STOP;
 
_thread_op_end(t);
interrupts_restore(ipl);
378,7 → 378,7
 
ipl = interrupts_disable();
 
/* On success, this will lock t->debug_lock */
/* On success, this will lock t->udebug.lock */
rc = _thread_op_begin(t, false);
if (rc != EOK) {
interrupts_restore(ipl);
386,8 → 386,8
}
 
/* Additionally we need to verify that we are inside a syscall */
if (t->cur_event != UDEBUG_EVENT_SYSCALL_B &&
t->cur_event != UDEBUG_EVENT_SYSCALL_E) {
if (t->udebug.cur_event != UDEBUG_EVENT_SYSCALL_B &&
t->udebug.cur_event != UDEBUG_EVENT_SYSCALL_E) {
_thread_op_end(t);
interrupts_restore(ipl);
 
395,7 → 395,7
}
 
/* Copy to a local buffer before releasing the lock */
memcpy(arg_buffer, t->syscall_args, 6 * sizeof(unative_t));
memcpy(arg_buffer, t->udebug.syscall_args, 6 * sizeof(unative_t));
 
_thread_op_end(t);
interrupts_restore(ipl);
414,7 → 414,7
 
ipl = interrupts_disable();
 
/* On success, this will lock t->debug_lock */
/* On success, this will lock t->udebug.lock */
rc = _thread_op_begin(t, false);
if (rc != EOK) {
interrupts_restore(ipl);
421,7 → 421,7
return rc;
}
 
state = t->uspace_state;
state = t->udebug.uspace_state;
if (state == NULL) {
_thread_op_end(t);
interrupts_restore(ipl);
450,7 → 450,7
 
ipl = interrupts_disable();
 
/* On success, this will lock t->debug_lock */
/* On success, this will lock t->udebug.lock */
rc = _thread_op_begin(t, false);
if (rc != EOK) {
klog_printf("error locking thread");
458,7 → 458,7
return rc;
}
 
state = t->uspace_state;
state = t->udebug.uspace_state;
if (state == NULL) {
_thread_op_end(t);
interrupts_restore(ipl);
467,7 → 467,7
return EBUSY;
}
 
memcpy(t->uspace_state, buffer, sizeof(istate_t));
memcpy(t->udebug.uspace_state, buffer, sizeof(istate_t));
 
_thread_op_end(t);
interrupts_restore(ipl);