Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3423 → Rev 3424

/branches/tracing/kernel/generic/src/udebug/udebug_ipc.c
35,7 → 35,7
* @brief Udebug IPC message handling.
*/
#include <console/klog.h>
#include <print.h>
#include <proc/task.h>
#include <proc/thread.h>
#include <arch.h>
53,7 → 53,7
int rc;
void *buffer;
 
klog_printf("debug_regs_write()");
printf("debug_regs_write()\n");
 
uspace_data = (void *)IPC_GET_ARG3(call->data);
to_copy = sizeof(istate_t);
61,13 → 61,13
 
rc = copy_from_uspace(buffer, uspace_data, to_copy);
if (rc != 0) {
klog_printf("debug_regs_write() - copy failed");
printf("debug_regs_write() - copy failed\n");
return rc;
}
 
call->buffer = buffer;
 
klog_printf(" - done");
printf(" - done\n");
return 0;
}
 
78,7 → 78,7
int rc;
void *buffer;
 
klog_printf("udebug_rp_mem_write()");
printf("udebug_rp_mem_write()\n");
 
uspace_data = (void *)IPC_GET_ARG2(call->data);
to_copy = IPC_GET_ARG4(call->data);
87,13 → 87,13
 
rc = copy_from_uspace(buffer, uspace_data, to_copy);
if (rc != 0) {
klog_printf(" - copy failed");
printf(" - copy failed\n");
return rc;
}
 
call->buffer = buffer;
 
klog_printf(" - done");
printf(" - done\n");
return 0;
}
 
161,7 → 161,7
thread_t *t;
int rc;
 
//klog_printf("debug_go()");
//printf("debug_go()\n");
 
t = (thread_t *)IPC_GET_ARG2(call->data);
 
178,7 → 178,7
thread_t *t;
int rc;
 
klog_printf("debug_stop()");
printf("debug_stop()\n");
 
t = (thread_t *)IPC_GET_ARG2(call->data);
 
278,7 → 278,7
void *buffer;
int rc;
 
klog_printf("debug_regs_read()");
printf("debug_regs_read()\n");
 
t = (thread_t *) IPC_GET_ARG2(call->data);
buffer = malloc(sizeof(istate_t), 0);
371,7 → 371,7
unsigned size;
int rc;
 
klog_printf("udebug_receive_mem_write()");
printf("udebug_receive_mem_write()\n");
 
uspace_dst = IPC_GET_ARG3(call->data);
size = IPC_GET_ARG4(call->data);
/branches/tracing/kernel/generic/src/udebug/udebug.c
48,7 → 48,7
*/
#include <synch/waitq.h>
#include <console/klog.h>
#include <print.h>
#include <udebug/udebug.h>
#include <errno.h>
#include <arch.h>
288,7 → 288,7
return;
}
 
//klog_printf("udebug_syscall_event");
//printf("udebug_syscall_event\n");
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
 
296,7 → 296,7
IPC_SET_ARG1(call->data, etype);
IPC_SET_ARG2(call->data, id);
IPC_SET_ARG3(call->data, rc);
//klog_printf("udebug_syscall_event/ipc_answer");
//printf("udebug_syscall_event/ipc_answer\n");
 
THREAD->udebug.syscall_args[0] = a1;
THREAD->udebug.syscall_args[1] = a2;
332,12 → 332,12
mutex_lock(&TASK->udebug.lock);
mutex_lock(&THREAD->udebug.lock);
 
klog_printf("udebug_thread_b_event");
klog_printf("- check state");
printf("udebug_thread_b_event\n");
printf("- check state\n");
 
/* Must only generate events when in debugging session */
if (THREAD->udebug.debug_active != true) {
klog_printf("- debug_active: %s, udebug.stop: %s",
printf("- debug_active: %s, udebug.stop: %s\n",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
THREAD->udebug.stop ? "yes(-)" : "no(+)");
mutex_unlock(&THREAD->udebug.lock);
345,7 → 345,7
return;
}
 
klog_printf("- trigger event");
printf("- trigger event\n");
 
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
366,7 → 366,7
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
 
klog_printf("- sleep");
printf("- sleep\n");
udebug_wait_for_go(&THREAD->udebug.go_wq);
 
udebug_int_unlock();
381,12 → 381,12
mutex_lock(&TASK->udebug.lock);
mutex_lock(&THREAD->udebug.lock);
 
klog_printf("udebug_thread_e_event");
klog_printf("- check state");
printf("udebug_thread_e_event\n");
printf("- check state\n");
 
/* Must only generate events when in debugging session */
if (THREAD->udebug.debug_active != true) {
klog_printf("- debug_active: %s, udebug.stop: %s",
printf("- debug_active: %s, udebug.stop: %s\n",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
THREAD->udebug.stop ? "yes(-)" : "no(+)");
mutex_unlock(&THREAD->udebug.lock);
394,7 → 394,7
return;
}
 
klog_printf("- trigger event");
printf("- trigger event\n");
 
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
441,7 → 441,7
return;
}
 
klog_printf("udebug_breakpoint/trap_event");
printf("udebug_breakpoint/trap_event\n");
call = THREAD->udebug.go_call;
THREAD->udebug.go_call = NULL;
 
457,7 → 457,7
THREAD->udebug.stop = true;
THREAD->udebug.cur_event = etype;
 
klog_printf("- send answer");
printf("- send answer\n");
ipc_answer(&TASK->answerbox, call);
 
mutex_unlock(&THREAD->udebug.lock);
491,14 → 491,14
int flags;
ipl_t ipl;
 
klog_printf("udebug_task_cleanup()");
klog_printf("task %llu", ta->taskid);
printf("udebug_task_cleanup()\n");
printf("task %llu\n", ta->taskid);
 
udebug_int_lock();
 
if (ta->udebug.dt_state != UDEBUG_TS_BEGINNING &&
ta->udebug.dt_state != UDEBUG_TS_ACTIVE) {
klog_printf("udebug_task_cleanup(): task not being debugged");
printf("udebug_task_cleanup(): task not being debugged\n");
return EINVAL;
}
 
531,7 → 531,7
t->udebug.stop = true;
 
/* Answer GO call */
klog_printf("answer GO call with EVENT_FINISHED");
printf("answer GO call with EVENT_FINISHED\n");
IPC_SET_RETVAL(t->udebug.go_call->data, 0);
IPC_SET_ARG1(t->udebug.go_call->data, UDEBUG_EVENT_FINISHED);
 
/branches/tracing/kernel/generic/src/udebug/udebug_ops.c
35,7 → 35,7
* @brief Udebug operations.
*/
#include <console/klog.h>
#include <print.h>
#include <proc/task.h>
#include <proc/thread.h>
#include <arch.h>
162,14 → 162,14
thread_t *t;
link_t *cur;
 
klog_printf("udebug_begin()");
printf("udebug_begin()\n");
 
mutex_lock(&TASK->udebug.lock);
klog_printf("debugging task %llu", TASK->taskid);
printf("debugging task %llu\n", TASK->taskid);
 
if (TASK->udebug.dt_state != UDEBUG_TS_INACTIVE) {
mutex_unlock(&TASK->udebug.lock);
klog_printf("udebug_begin(): busy error");
printf("udebug_begin(): busy error\n");
 
return EBUSY;
}
199,7 → 199,7
 
mutex_unlock(&TASK->udebug.lock);
 
klog_printf("udebug_begin() done (%s)",
printf("udebug_begin() done (%s)\n",
reply ? "reply" : "stoppability wait");
 
return reply;
209,10 → 209,10
{
int rc;
 
klog_printf("udebug_end()");
printf("udebug_end()\n");
 
mutex_lock(&TASK->udebug.lock);
klog_printf("task %llu", TASK->taskid);
printf("task %llu\n", TASK->taskid);
 
rc = udebug_task_cleanup(TASK);
 
223,15 → 223,15
 
int udebug_set_evmask(udebug_evmask_t mask)
{
klog_printf("udebug_set_mask()");
printf("udebug_set_mask()\n");
 
klog_printf("debugging task %llu", TASK->taskid);
printf("debugging task %llu\n", TASK->taskid);
 
mutex_lock(&TASK->udebug.lock);
 
if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
mutex_unlock(&TASK->udebug.lock);
klog_printf("udebug_set_mask(): not active debuging session");
printf("udebug_set_mask(): not active debuging session\n");
 
return EINVAL;
}
248,7 → 248,7
{
int rc;
 
// klog_printf("udebug_go()");
// printf("udebug_go()\n");
 
/* On success, this will lock t->udebug.lock */
rc = _thread_op_begin(t, false);
274,7 → 274,7
{
int rc;
 
klog_printf("udebug_stop()");
printf("udebug_stop()\n");
mutex_lock(&TASK->udebug.lock);
 
/*
298,7 → 298,7
/*
* Answer GO call
*/
klog_printf("udebug_stop - answering go call");
printf("udebug_stop - answering go call\n");
 
/* Make sure nobody takes this call away from us */
call = t->udebug.go_call;
306,7 → 306,7
 
IPC_SET_RETVAL(call->data, 0);
IPC_SET_ARG1(call->data, UDEBUG_EVENT_STOP);
klog_printf("udebug_stop/ipc_answer");
printf("udebug_stop/ipc_answer\n");
 
THREAD->udebug.cur_event = UDEBUG_EVENT_STOP;
 
315,7 → 315,7
ipc_answer(&TASK->answerbox, call);
mutex_unlock(&TASK->udebug.lock);
 
klog_printf("udebog_stop/done");
printf("udebog_stop/done\n");
return 0;
}
 
330,7 → 330,7
int flags;
size_t max_ids;
 
klog_printf("udebug_thread_read()");
printf("udebug_thread_read()\n");
 
/* Allocate a buffer to hold thread IDs */
id_buffer = malloc(buf_size, 0);
385,7 → 385,7
int rc;
unative_t *arg_buffer;
 
// klog_printf("udebug_args_read()");
// printf("udebug_args_read()\n");
 
/* Prepare a buffer to hold the arguments */
arg_buffer = malloc(6 * sizeof(unative_t), 0);
417,7 → 417,7
istate_t *state;
int rc;
 
// klog_printf("udebug_regs_read()");
// printf("udebug_regs_read()\n");
 
/* On success, this will lock t->udebug.lock */
rc = _thread_op_begin(t, false);
428,7 → 428,7
state = t->udebug.uspace_state;
if (state == NULL) {
_thread_op_end(t);
klog_printf("udebug_regs_read() - istate not available");
printf("udebug_regs_read() - istate not available\n");
return EBUSY;
}
 
445,7 → 445,7
int rc;
istate_t *state;
 
klog_printf("udebug_regs_write()");
printf("udebug_regs_write()\n");
 
/* Try to change the thread's uspace_state */
 
452,7 → 452,7
/* On success, this will lock t->udebug.lock */
rc = _thread_op_begin(t, false);
if (rc != EOK) {
klog_printf("error locking thread");
printf("error locking thread\n");
return rc;
}
 
459,7 → 459,7
state = t->udebug.uspace_state;
if (state == NULL) {
_thread_op_end(t);
klog_printf("udebug_regs_write() - istate not available");
printf("udebug_regs_write() - istate not available\n");
return EBUSY;
}
 
486,7 → 486,7
 
data_buffer = malloc(n, 0);
 
// klog_printf("udebug_mem_read: src=%u, size=%u", uspace_addr, n);
// printf("udebug_mem_read: src=%u, size=%u\n", uspace_addr, n);
 
/* NOTE: this is not strictly from a syscall... but that shouldn't
* be a problem */
503,7 → 503,7
{
int rc;
 
klog_printf("udebug_mem_write()");
printf("udebug_mem_write()\n");
 
/* n must be positive */
if (n < 1)
517,7 → 517,7
return EBUSY;
}
klog_printf("dst=%u, size=%u", uspace_addr, n);
printf("dst=%u, size=%u\n", uspace_addr, n);
 
/* NOTE: this is not strictly from a syscall... but that shouldn't
* be a problem */
526,7 → 526,7
 
rc = as_debug_write(uspace_addr, data, n);
klog_printf("rc=%d\n", rc);
printf("rc=%d\n", rc);
 
mutex_unlock(&TASK->udebug.lock);