68,12 → 68,12 |
|
static proto_t *proto_console; |
|
static int task_connect(int taskid) |
static int task_connect(task_id_t task_id) |
{ |
int rc; |
|
printf("ipc_connect_task(%d)... ", taskid); |
rc = ipc_connect_kbox(taskid); |
printf("ipc_connect_task(%lld)... ", task_id); |
rc = ipc_connect_kbox(task_id); |
printf("-> %d\n", rc); |
phoneid = rc; |
if (rc < 0) return rc; |
407,26 → 407,21 |
fibril_add_ready(fid); |
} |
|
static void trace_active_task(void) |
static void trace_active_task(task_id_t task_id) |
{ |
int taskid; |
int i; |
int rc; |
int c; |
|
printf("Syscall Tracer\n"); |
printf("Press 'c' to connect\n"); |
while ((i = getchar()) != 'c') |
putchar(i); |
|
taskid = 13; |
rc = task_connect(taskid); |
rc = task_connect(task_id); |
if (rc < 0) { |
printf("Failed to connect to task %d\n", taskid); |
printf("Failed to connect to task %lld\n", task_id); |
return; |
} |
|
printf("Connected to task %d\n", taskid); |
printf("Connected to task %lld\n", task_id); |
|
ipcp_init(); |
ipcp_connection_set(1, 0, proto_console); |
506,9 → 501,9 |
proto_add_oper(p, CONSOLE_FLUSH, o); |
o = oper_new("set_style"); |
proto_add_oper(p, CONSOLE_SET_STYLE, o); |
o = oper_new("cursor_visibility"); |
proto_add_oper(p, CONSOLE_CURSOR_VISIBILITY, o); |
o = oper_new("flush"); |
proto_add_oper(p, CONSOLE_CURSOR_VISIBILITY, o); |
o = oper_new("cursor_visibility"); |
proto_add_oper(p, CONSOLE_FLUSH, o); |
|
proto_console = p; |
515,13 → 510,32 |
proto_register(SERVICE_CONSOLE, p); |
} |
|
int main(void) |
static void print_syntax() |
{ |
main_init(); |
printf("syntax: sctrace <task_id>\n"); |
} |
|
while (1) { |
trace_active_task(); |
int main(int argc, char *argv[]) |
{ |
task_id_t task_id; |
char *err_p; |
|
if (argc != 2) { |
printf("Mising argument\n"); |
print_syntax(); |
return 1; |
} |
|
task_id = strtol(argv[1], &err_p, 10); |
|
if (*err_p) { |
printf("Task ID syntax error\n"); |
print_syntax(); |
return 1; |
} |
|
main_init(); |
trace_active_task(task_id); |
} |
|
/** @} |