Subversion Repositories HelenOS

Rev

Rev 2902 | Rev 2908 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2902 Rev 2903
Line 226... Line 226...
226
    interrupts_restore(ipl);
226
    interrupts_restore(ipl);
227
 
227
 
228
    waitq_sleep(&THREAD->go_wq);
228
    waitq_sleep(&THREAD->go_wq);
229
}
229
}
230
 
230
 
231
void udebug_new_thread_event(struct thread *t)
231
void udebug_thread_b_event(struct thread *t)
232
{
232
{
233
    call_t *call;
233
    call_t *call;
234
    ipl_t ipl;
234
    ipl_t ipl;
235
 
235
 
236
    ipl = interrupts_disable();
236
    ipl = interrupts_disable();
237
    spinlock_lock(&THREAD->debug_lock);
237
    spinlock_lock(&THREAD->debug_lock);
238
 
238
 
239
    klog_printf("udebug_new_thread_event");
239
    klog_printf("udebug_thread_b_event");
240
    klog_printf("- check state");
240
    klog_printf("- check state");
241
 
241
 
242
    /* Must only generate events when in debugging session */
242
    /* Must only generate events when in debugging session */
243
    if (THREAD->debug_active != true) {
243
    if (THREAD->debug_active != true) {
244
        klog_printf("- debug_active: %s, debug_stop: %s",
244
        klog_printf("- debug_active: %s, debug_stop: %s",
Line 251... Line 251...
251
 
251
 
252
    klog_printf("- trigger event");
252
    klog_printf("- trigger event");
253
 
253
 
254
    call = THREAD->debug_go_call;
254
    call = THREAD->debug_go_call;
255
    IPC_SET_RETVAL(call->data, 0);
255
    IPC_SET_RETVAL(call->data, 0);
256
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_NEW_THREAD);
256
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_B);
257
    IPC_SET_ARG2(call->data, (unative_t)t);
257
    IPC_SET_ARG2(call->data, (unative_t)t);
258
 
258
 
259
    /*
259
    /*
260
     * Make sure debug_stop is true when going to sleep
260
     * Make sure debug_stop is true when going to sleep
261
     * in case we get woken up by DEBUG_END. (At which
261
     * in case we get woken up by DEBUG_END. (At which
262
     * point it must be back to the initial true value).
262
     * point it must be back to the initial true value).
263
     */
263
     */
264
    THREAD->debug_stop = true;
264
    THREAD->debug_stop = true;
265
 
265
 
266
    THREAD->cur_event = UDEBUG_EVENT_NEW_THREAD;
266
    THREAD->cur_event = UDEBUG_EVENT_THREAD_B;
267
    spinlock_unlock(&THREAD->debug_lock);
267
    spinlock_unlock(&THREAD->debug_lock);
268
 
268
 
269
    spinlock_lock(&TASK->lock);
269
    spinlock_lock(&TASK->lock);
270
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
270
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
271
    spinlock_unlock(&TASK->lock);
271
    spinlock_unlock(&TASK->lock);
Line 274... Line 274...
274
    klog_printf("- sleep");
274
    klog_printf("- sleep");
275
 
275
 
276
    waitq_sleep(&THREAD->go_wq);
276
    waitq_sleep(&THREAD->go_wq);
277
}
277
}
278
 
278
 
-
 
279
void udebug_thread_e_event(void)
-
 
280
{
-
 
281
    call_t *call;
-
 
282
    ipl_t ipl;
-
 
283
 
-
 
284
    ipl = interrupts_disable();
-
 
285
    spinlock_lock(&THREAD->debug_lock);
-
 
286
 
-
 
287
    klog_printf("udebug_thread_e_event");
-
 
288
    klog_printf("- check state");
-
 
289
 
-
 
290
    /* Must only generate events when in debugging session */
-
 
291
    if (THREAD->debug_active != true) {
-
 
292
        klog_printf("- debug_active: %s, debug_stop: %s",
-
 
293
            THREAD->debug_active ? "yes(+)" : "no(-)",
-
 
294
            THREAD->debug_stop ? "yes(-)" : "no(+)");
-
 
295
        spinlock_unlock(&THREAD->debug_lock);
-
 
296
        interrupts_restore(ipl);
-
 
297
        return;
-
 
298
    }
-
 
299
 
-
 
300
    klog_printf("- trigger event");
-
 
301
 
-
 
302
    call = THREAD->debug_go_call;
-
 
303
    IPC_SET_RETVAL(call->data, 0);
-
 
304
    IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E);
-
 
305
 
-
 
306
    /*
-
 
307
     * Make sure debug_stop is true when going to sleep
-
 
308
     * in case we get woken up by DEBUG_END. (At which
-
 
309
     * point it must be back to the initial true value).
-
 
310
     */
-
 
311
    THREAD->debug_stop = true;
-
 
312
 
-
 
313
    THREAD->cur_event = UDEBUG_EVENT_THREAD_E;
-
 
314
    spinlock_unlock(&THREAD->debug_lock);
-
 
315
 
-
 
316
    spinlock_lock(&TASK->lock);
-
 
317
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
-
 
318
    spinlock_unlock(&TASK->lock);
-
 
319
 
-
 
320
    interrupts_restore(ipl);
-
 
321
    klog_printf("- sleep");
-
 
322
 
-
 
323
    waitq_sleep(&THREAD->go_wq);
-
 
324
}
-
 
325
 
-
 
326
 
279
/**
327
/**
280
 * Terminate task debugging session.
328
 * Terminate task debugging session.
281
 *
329
 *
282
 * \param ta Must be already locked and interrupts must be disabled.
330
 * \param ta Must be already locked and interrupts must be disabled.
283
 * \return Zero on success or negative error code.
331
 * \return Zero on success or negative error code.