Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2832 | svoboda | 1 | /** @addtogroup sctrace |
2 | * @{ |
||
3 | */ |
||
4 | /** @file |
||
5 | */ |
||
6 | |||
7 | #include <stdio.h> |
||
8 | #include <syscall.h> |
||
9 | #include <ipc/ipc.h> |
||
10 | #include <udebug.h> |
||
11 | |||
12 | #include "debug_api.h" |
||
13 | |||
14 | int debug_begin(unsigned phoneid) |
||
15 | { |
||
16 | return ipc_call_sync_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN); |
||
17 | } |
||
18 | |||
19 | int debug_thread_read(unsigned phoneid, void *buffer, unsigned n, |
||
20 | unsigned *copied, unsigned *needed) |
||
21 | { |
||
22 | printf("send IPC_M_DEBUG_THREAD_READ message\n"); |
||
23 | return ipc_call_sync_3_2(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ, |
||
24 | (sysarg_t)buffer, n, copied, needed); |
||
25 | } |
||
26 | |||
27 | int debug_mem_read(unsigned phoneid, void *buffer, unsigned addr, unsigned n) |
||
28 | { |
||
29 | return ipc_call_sync_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ, |
||
30 | (sysarg_t)buffer, addr, n); |
||
31 | } |
||
32 | |||
33 | int debug_args_read(unsigned phoneid, unsigned tid, unsigned *buffer) |
||
34 | { |
||
35 | unsigned copied; |
||
36 | int rc; |
||
37 | |||
38 | rc = ipc_call_sync_4_1(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ, |
||
39 | tid, (sysarg_t)buffer, 6 * sizeof(unsigned), &copied); |
||
40 | |||
41 | if (copied != 6 * sizeof(unsigned)) { |
||
42 | printf("Warning: read %d bytes from syscall args instead of 24!\n", |
||
43 | copied); |
||
44 | } |
||
45 | |||
46 | return rc; |
||
47 | } |
||
48 | |||
49 | int debug_go(unsigned phoneid, unsigned tid, unsigned *ev_type, |
||
50 | unsigned *sc_id, unsigned *sc_rc) |
||
51 | { |
||
52 | /* Run thread until a syscall is executed */ |
||
53 | return ipc_call_sync_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO, |
||
54 | tid, (sysarg_t)ev_type, (sysarg_t)sc_id, (sysarg_t)sc_rc); |
||
55 | } |
||
56 | |||
57 | /** @} |
||
58 | */ |