00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00035 #include <udebug.h>
00036 #include <sys/types.h>
00037 #include <async.h>
00038
00039 int udebug_begin(int phoneid)
00040 {
00041 return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN);
00042 }
00043
00044 int udebug_end(int phoneid)
00045 {
00046 return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_END);
00047 }
00048
00049 int udebug_set_evmask(int phoneid, udebug_evmask_t mask)
00050 {
00051 return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_SET_EVMASK,
00052 mask);
00053 }
00054
00055 int udebug_thread_read(int phoneid, void *buffer, size_t n,
00056 size_t *copied, size_t *needed)
00057 {
00058 sysarg_t a_copied, a_needed;
00059 int rc;
00060
00061 rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ,
00062 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
00063
00064 *copied = (size_t)a_copied;
00065 *needed = (size_t)a_needed;
00066
00067 return rc;
00068 }
00069
00070 int udebug_name_read(int phoneid, void *buffer, size_t n,
00071 size_t *copied, size_t *needed)
00072 {
00073 sysarg_t a_copied, a_needed;
00074 int rc;
00075
00076 rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_NAME_READ,
00077 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
00078
00079 *copied = (size_t)a_copied;
00080 *needed = (size_t)a_needed;
00081
00082 return rc;
00083 }
00084
00085 int udebug_areas_read(int phoneid, void *buffer, size_t n,
00086 size_t *copied, size_t *needed)
00087 {
00088 sysarg_t a_copied, a_needed;
00089 int rc;
00090
00091 rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_AREAS_READ,
00092 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);
00093
00094 *copied = (size_t)a_copied;
00095 *needed = (size_t)a_needed;
00096
00097 return rc;
00098 }
00099
00100 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n)
00101 {
00102 return async_req_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ,
00103 (sysarg_t)buffer, addr, n);
00104 }
00105
00106 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer)
00107 {
00108 return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ,
00109 tid, (sysarg_t)buffer);
00110 }
00111
00112 int udebug_regs_read(int phoneid, thash_t tid, void *buffer)
00113 {
00114 return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_REGS_READ,
00115 tid, (sysarg_t)buffer);
00116 }
00117
00118 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
00119 sysarg_t *val0, sysarg_t *val1)
00120 {
00121 sysarg_t a_ev_type;
00122 int rc;
00123
00124 rc = async_req_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO,
00125 tid, &a_ev_type, val0, val1);
00126
00127 *ev_type = a_ev_type;
00128 return rc;
00129 }
00130
00131 int udebug_stop(int phoneid, thash_t tid)
00132 {
00133 return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_STOP,
00134 tid);
00135 }
00136