Rev 3457 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3457 | Rev 3468 | ||
|---|---|---|---|
| Line 57... | Line 57... | ||
| 57 | } |
57 | } |
| 58 | 58 | ||
| 59 | return 0; |
59 | return 0; |
| 60 | } |
60 | } |
| 61 | 61 | ||
| - | 62 | /** Process a BEGIN call. |
|
| - | 63 | * |
|
| - | 64 | * Initiates a debugging session for the current task. The reply |
|
| - | 65 | * to this call may or may not be sent before this function returns. |
|
| - | 66 | * |
|
| - | 67 | * @param call The call structure. |
|
| - | 68 | */ |
|
| 62 | static void udebug_receive_begin(call_t *call) |
69 | static void udebug_receive_begin(call_t *call) |
| 63 | { |
70 | { |
| 64 | int rc; |
71 | int rc; |
| 65 | 72 | ||
| 66 | rc = udebug_begin(call); |
73 | rc = udebug_begin(call); |
| Line 68... | Line 75... | ||
| 68 | IPC_SET_RETVAL(call->data, rc); |
75 | IPC_SET_RETVAL(call->data, rc); |
| 69 | ipc_answer(&TASK->kernel_box, call); |
76 | ipc_answer(&TASK->kernel_box, call); |
| 70 | return; |
77 | return; |
| 71 | } |
78 | } |
| 72 | 79 | ||
| - | 80 | /* |
|
| - | 81 | * If the initialization of the debugging session has finished, |
|
| - | 82 | * send a reply. |
|
| - | 83 | */ |
|
| 73 | if (rc != 0) { |
84 | if (rc != 0) { |
| 74 | IPC_SET_RETVAL(call->data, 0); |
85 | IPC_SET_RETVAL(call->data, 0); |
| 75 | ipc_answer(&TASK->kernel_box, call); |
86 | ipc_answer(&TASK->kernel_box, call); |
| 76 | } |
87 | } |
| 77 | } |
88 | } |
| 78 | 89 | ||
| - | 90 | /** Process an END call. |
|
| - | 91 | * |
|
| - | 92 | * Terminates the debugging session for the current task. |
|
| - | 93 | * @param call The call structure. |
|
| - | 94 | */ |
|
| 79 | static void udebug_receive_end(call_t *call) |
95 | static void udebug_receive_end(call_t *call) |
| 80 | { |
96 | { |
| 81 | int rc; |
97 | int rc; |
| 82 | 98 | ||
| 83 | rc = udebug_end(); |
99 | rc = udebug_end(); |
| 84 | 100 | ||
| 85 | IPC_SET_RETVAL(call->data, rc); |
101 | IPC_SET_RETVAL(call->data, rc); |
| 86 | ipc_answer(&TASK->kernel_box, call); |
102 | ipc_answer(&TASK->kernel_box, call); |
| 87 | } |
103 | } |
| 88 | 104 | ||
| - | 105 | /** Process a SET_EVMASK call. |
|
| - | 106 | * |
|
| - | 107 | * Sets an event mask for the current debugging session. |
|
| - | 108 | * @param call The call structure. |
|
| - | 109 | */ |
|
| 89 | static void udebug_receive_set_evmask(call_t *call) |
110 | static void udebug_receive_set_evmask(call_t *call) |
| 90 | { |
111 | { |
| 91 | int rc; |
112 | int rc; |
| 92 | udebug_evmask_t mask; |
113 | udebug_evmask_t mask; |
| 93 | 114 | ||
| Line 97... | Line 118... | ||
| 97 | IPC_SET_RETVAL(call->data, rc); |
118 | IPC_SET_RETVAL(call->data, rc); |
| 98 | ipc_answer(&TASK->kernel_box, call); |
119 | ipc_answer(&TASK->kernel_box, call); |
| 99 | } |
120 | } |
| 100 | 121 | ||
| 101 | 122 | ||
| - | 123 | /** Process a GO call. |
|
| - | 124 | * |
|
| - | 125 | * Resumes execution of the specified thread. |
|
| - | 126 | * @param call The call structure. |
|
| - | 127 | */ |
|
| 102 | static void udebug_receive_go(call_t *call) |
128 | static void udebug_receive_go(call_t *call) |
| 103 | { |
129 | { |
| 104 | thread_t *t; |
130 | thread_t *t; |
| 105 | int rc; |
131 | int rc; |
| 106 | 132 | ||
| Line 112... | Line 138... | ||
| 112 | ipc_answer(&TASK->kernel_box, call); |
138 | ipc_answer(&TASK->kernel_box, call); |
| 113 | return; |
139 | return; |
| 114 | } |
140 | } |
| 115 | } |
141 | } |
| 116 | 142 | ||
| - | 143 | /** Process a STOP call. |
|
| - | 144 | * |
|
| - | 145 | * Suspends execution of the specified thread. |
|
| - | 146 | * @param call The call structure. |
|
| - | 147 | */ |
|
| 117 | static void udebug_receive_stop(call_t *call) |
148 | static void udebug_receive_stop(call_t *call) |
| 118 | { |
149 | { |
| 119 | thread_t *t; |
150 | thread_t *t; |
| 120 | int rc; |
151 | int rc; |
| 121 | 152 | ||
| Line 124... | Line 155... | ||
| 124 | rc = udebug_stop(t, call); |
155 | rc = udebug_stop(t, call); |
| 125 | IPC_SET_RETVAL(call->data, rc); |
156 | IPC_SET_RETVAL(call->data, rc); |
| 126 | ipc_answer(&TASK->kernel_box, call); |
157 | ipc_answer(&TASK->kernel_box, call); |
| 127 | } |
158 | } |
| 128 | 159 | ||
| - | 160 | /** Process a THREAD_READ call. |
|
| - | 161 | * |
|
| - | 162 | * Reads the list of hashes of the (userspace) threads in the current task. |
|
| - | 163 | * @param call The call structure. |
|
| - | 164 | */ |
|
| 129 | static void udebug_receive_thread_read(call_t *call) |
165 | static void udebug_receive_thread_read(call_t *call) |
| 130 | { |
166 | { |
| 131 | unative_t uspace_addr; |
167 | unative_t uspace_addr; |
| 132 | unative_t to_copy; |
168 | unative_t to_copy; |
| 133 | unsigned total_bytes; |
169 | unsigned total_bytes; |
| Line 174... | Line 210... | ||
| 174 | call->buffer = buffer; |
210 | call->buffer = buffer; |
| 175 | 211 | ||
| 176 | ipc_answer(&TASK->kernel_box, call); |
212 | ipc_answer(&TASK->kernel_box, call); |
| 177 | } |
213 | } |
| 178 | 214 | ||
| - | 215 | /** Process an ARGS_READ call. |
|
| - | 216 | * |
|
| - | 217 | * Reads the argument of a current syscall event (SYSCALL_B or SYSCALL_E). |
|
| - | 218 | * @param call The call structure. |
|
| - | 219 | */ |
|
| 179 | static void udebug_receive_args_read(call_t *call) |
220 | static void udebug_receive_args_read(call_t *call) |
| 180 | { |
221 | { |
| 181 | thread_t *t; |
222 | thread_t *t; |
| 182 | unative_t uspace_addr; |
223 | unative_t uspace_addr; |
| 183 | int rc; |
224 | int rc; |
| Line 207... | Line 248... | ||
| 207 | call->buffer = buffer; |
248 | call->buffer = buffer; |
| 208 | 249 | ||
| 209 | ipc_answer(&TASK->kernel_box, call); |
250 | ipc_answer(&TASK->kernel_box, call); |
| 210 | } |
251 | } |
| 211 | 252 | ||
| - | 253 | /** Process an MEM_READ call. |
|
| - | 254 | * |
|
| - | 255 | * Reads memory of the current (debugged) task. |
|
| - | 256 | * @param call The call structure. |
|
| - | 257 | */ |
|
| 212 | static void udebug_receive_mem_read(call_t *call) |
258 | static void udebug_receive_mem_read(call_t *call) |
| 213 | { |
259 | { |
| 214 | unative_t uspace_dst; |
260 | unative_t uspace_dst; |
| 215 | unative_t uspace_src; |
261 | unative_t uspace_src; |
| 216 | unsigned size; |
262 | unsigned size; |
| Line 237... | Line 283... | ||
| 237 | call->buffer = buffer; |
283 | call->buffer = buffer; |
| 238 | 284 | ||
| 239 | ipc_answer(&TASK->kernel_box, call); |
285 | ipc_answer(&TASK->kernel_box, call); |
| 240 | } |
286 | } |
| 241 | 287 | ||
| 242 | /** |
- | |
| 243 | * Handle a debug call received on the kernel answerbox. |
288 | /** Handle a debug call received on the kernel answerbox. |
| 244 | * |
289 | * |
| 245 | * This is called by the kbox servicing thread. |
290 | * This is called by the kbox servicing thread. Verifies that the sender |
| - | 291 | * is indeed the debugger and calls the appropriate processing function. |
|
| 246 | */ |
292 | */ |
| 247 | void udebug_call_receive(call_t *call) |
293 | void udebug_call_receive(call_t *call) |
| 248 | { |
294 | { |
| 249 | int debug_method; |
295 | int debug_method; |
| 250 | 296 | ||