Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2834 → Rev 2835

/branches/tracing/uspace/app/sctrace/debug_api.c
7,6 → 7,7
#include <stdio.h>
#include <syscall.h>
#include <ipc/ipc.h>
#include <async.h>
#include <udebug.h>
 
#include "debug_api.h"
13,26 → 14,31
 
int debug_begin(unsigned phoneid)
{
return ipc_call_sync_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN);
return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN);
}
 
int debug_end(unsigned phoneid)
{
return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_END);
}
 
int debug_thread_read(unsigned phoneid, void *buffer, unsigned n,
unsigned *copied, unsigned *needed)
{
printf("send IPC_M_DEBUG_THREAD_READ message\n");
return ipc_call_sync_3_2(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ,
return async_req_3_2(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ,
(sysarg_t)buffer, n, copied, needed);
}
 
int debug_mem_read(unsigned phoneid, void *buffer, unsigned addr, unsigned n)
{
return ipc_call_sync_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ,
return async_req_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ,
(sysarg_t)buffer, addr, n);
}
 
int debug_args_read(unsigned phoneid, unsigned tid, unsigned *buffer)
{
return ipc_call_sync_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ,
return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ,
tid, (sysarg_t)buffer);
}
 
40,7 → 46,7
unsigned *sc_id, unsigned *sc_rc)
{
/* Run thread until a syscall is executed */
return ipc_call_sync_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO,
return async_req_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO,
tid, (sysarg_t)ev_type, (sysarg_t)sc_id, (sysarg_t)sc_rc);
}
 
/branches/tracing/uspace/app/sctrace/debug_api.h
8,6 → 8,7
#define DEBUG_API_H_
 
int debug_begin(unsigned phoneid);
int debug_end(unsigned phoneid);
int debug_thread_read(unsigned phoneid, void *buffer, unsigned n,
unsigned *copied, unsigned *needed);
int debug_mem_read(unsigned phoneid, void *buffer, unsigned addr, unsigned n);
/branches/tracing/uspace/app/sctrace/sctrace.c
8,7 → 8,8
#include <unistd.h>
#include <syscall.h>
#include <ipc/ipc.h>
#include <udebug.h>
#include <fibril.h>
#include <errno.h>
 
#include "syscalls.h"
#include "errors.h"
18,6 → 19,7
unsigned threadid_buf[TIDBUF_SIZE];
 
int phoneid;
int abort_trace;
 
int task_connect(int taskid)
{
114,6 → 116,22
}
}
 
int keyboard_fibril(void *arg)
{
(void)arg;
 
printf("keyboard fibril started\n");
 
getchar();
printf("keyboard fibril setting abort_trace\n");
abort_trace = 1;
printf("keyboard fibril sending debug_end()\n");
debug_end(phoneid);
printf("keyboard fibril exitting\n");
 
return EOK;
}
 
void trace_loop(void)
{
int rc;
123,8 → 141,18
unsigned sc_id;
int sc_rc;
int rv_type;
fid_t kb_fid;
 
while (1) {
abort_trace = 0;
kb_fid = fibril_create(keyboard_fibril, NULL);
if (kb_fid == 0) {
printf("Failed creating keyboard fibril\n");
return;
}
fibril_add_ready(kb_fid);
 
while (!abort_trace) {
 
/* Run thread until a syscall is executed */
rc = debug_go(phoneid, threadid_buf[0],
&ev_type, &sc_id, &sc_rc);
151,6 → 179,8
break;
}
}
 
printf("trace_loop() exiting\n");
}
 
 
181,7 → 211,14
}
 
trace_loop();
/*
printf("press 'd' to disconnect\n");
while ((i = getchar()) != 'd')
putchar(i);
 
printf("call debug_end()\n");
debug_end(phoneid);
*/
printf("done\n");
return;
}
188,7 → 225,9
 
int main(void)
{
trace_active_task();
while (1) {
trace_active_task();
}
}
 
/** @}