307,29 → 307,37 |
|
#include <console/klog.h> |
|
static void debug_begin(call_t *call, phone_t *phone) |
static int debug_begin(call_t *call, phone_t *phone) |
{ |
task_t *ta; |
|
klog_printf("debug_begin()"); |
|
|
ta = get_lock_callee_task(phone); |
klog_printf("debugging task %llu\n", ta->taskid); |
klog_printf("debugging task %llu", ta->taskid); |
|
if (ta->being_debugged != false) { |
IPC_SET_RETVAL(call->data, EBUSY); |
ipc_answer(&ta->answerbox, call); |
|
spinlock_unlock(&ta->lock); |
return; |
klog_printf("debug_begin(): busy error"); |
return EBUSY; |
} |
|
ta->being_debugged = true; |
ta->stop_request = true; |
ta->debug_begin_call = call; |
|
if (ta->not_stoppable_count == 0) { |
ta->debug_begin_call = NULL; |
ta->stop_request = false; |
spinlock_unlock(&ta->lock); |
klog_printf("debug_begin(): immediate backsend"); |
return 1; /* actually we need backsend with 0 retval */ |
} |
|
spinlock_unlock(&ta->lock); |
|
klog_printf("debug_begin() done"); |
klog_printf("debug_begin() done (wait for stoppability)"); |
return 0; |
} |
|
static void debug_go(call_t *call, phone_t *phone) |
341,13 → 349,15 |
klog_printf("debug_go()"); |
ta = get_lock_callee_task(phone); |
|
ta->debug_go_call = call; |
|
l = ta->th_head.next; |
if (l != &TASK->th_head) { |
t = list_get_instance(l, thread_t, th_link); |
klog_printf("debug_go(): waitq_wakeup"); |
waitq_wakeup(&t->go_wq, WAKEUP_FIRST); |
} |
|
ta->debug_go_call = call; |
spinlock_unlock(&ta->lock); |
} |
|
402,7 → 412,9 |
} |
break; |
case IPC_M_DEBUG_BEGIN: |
debug_begin(call, phone); |
/* actually need possibility of backsend with 0 result code */ |
rc = debug_begin(call, phone); |
if (rc != 0) return rc; |
break; |
case IPC_M_DEBUG_GO: |
debug_go(call, phone); |