Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2917 → Rev 2918

/branches/tracing/kernel/generic/include/udebug/udebug.h
157,6 → 157,7
UDEBUG_EVENT_SYSCALL_E, /**< After finishing syscall execution */
UDEBUG_EVENT_THREAD_B, /**< The task created a new thread */
UDEBUG_EVENT_THREAD_E, /**< A thread exited */
UDEBUG_EVENT_BREAKPOINT /**< Breakpoint instruction executed */
} udebug_event_t;
 
#define UDEBUG_EVMASK(event) (1 << ((event) - 1))
168,6 → 169,7
UDEBUG_EM_SYSCALL_E = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E),
UDEBUG_EM_THREAD_B = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B),
UDEBUG_EM_THREAD_E = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E),
UDEBUG_EM_BREAKPOINT = UDEBUG_EVMASK(UDEBUG_EVENT_BREAKPOINT),
UDEBUG_EM_ALL =
UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) |
UDEBUG_EVMASK(UDEBUG_EVENT_STOP) |
174,7 → 176,8
UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B) |
UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E) |
UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B) |
UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E)
UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E) |
UDEBUG_EVMASK(UDEBUG_EVENT_BREAKPOINT)
} udebug_evmask_t;
 
#ifdef KERNEL
203,6 → 206,8
void udebug_stoppable_begin(void);
void udebug_stoppable_end(void);
 
void udebug_breakpoint_event(uintptr_t addr);
 
int udebug_task_cleanup(struct task *ta);
 
#endif
/branches/tracing/kernel/generic/src/udebug/udebug.c
329,7 → 329,52
/* This event does not sleep - debugging has finished in this thread */
}
 
void udebug_breakpoint_event(uintptr_t addr)
{
call_t *call;
ipl_t ipl;
udebug_event_t etype;
 
etype = UDEBUG_EVENT_BREAKPOINT;
 
ipl = interrupts_disable();
spinlock_lock(&THREAD->debug_lock);
 
/* Must only generate events when in debugging session and have go */
if (THREAD->debug_active != true ||
THREAD->debug_stop == true ||
(TASK->debug_evmask & UDEBUG_EVMASK(etype)) == 0) {
spinlock_unlock(&THREAD->debug_lock);
interrupts_restore(ipl);
return;
}
 
klog_printf("udebug_breakpoint_event");
call = THREAD->debug_go_call;
IPC_SET_RETVAL(call->data, 0);
IPC_SET_ARG1(call->data, etype);
IPC_SET_ARG2(call->data, addr);
 
/*
* Make sure debug_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->cur_event = etype;
spinlock_unlock(&THREAD->debug_lock);
klog_printf("- send answer");
 
spinlock_lock(&TASK->lock);
ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
spinlock_unlock(&TASK->lock);
interrupts_restore(ipl);
 
udebug_wait_for_go(&THREAD->go_wq);
}
 
 
/**
* Terminate task debugging session.
*