Subversion Repositories HelenOS

Rev

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

Rev 2801 Rev 2804
Line 305... Line 305...
305
    return ta;
305
    return ta;
306
}
306
}
307
 
307
 
308
#include <console/klog.h>
308
#include <console/klog.h>
309
 
309
 
310
static void debug_begin(call_t *call, phone_t *phone)
310
static int debug_begin(call_t *call, phone_t *phone)
311
{
311
{
312
    task_t *ta;
312
    task_t *ta;
313
 
313
 
314
    klog_printf("debug_begin()");
314
    klog_printf("debug_begin()");
315
   
315
 
316
    ta = get_lock_callee_task(phone);
316
    ta = get_lock_callee_task(phone);
317
    klog_printf("debugging task %llu\n", ta->taskid);
317
    klog_printf("debugging task %llu", ta->taskid);
318
 
318
 
319
    if (ta->being_debugged != false) {
319
    if (ta->being_debugged != false) {
320
        IPC_SET_RETVAL(call->data, EBUSY);
-
 
321
        ipc_answer(&ta->answerbox, call);
-
 
322
 
-
 
323
        spinlock_unlock(&ta->lock);
320
        spinlock_unlock(&ta->lock);
-
 
321
        klog_printf("debug_begin(): busy error");
324
        return;
322
        return EBUSY;
325
    }
323
    }
326
 
324
 
327
    ta->being_debugged = true;
325
    ta->being_debugged = true;
328
    ta->stop_request = true;
326
    ta->stop_request = true;
329
    ta->debug_begin_call = call;
327
    ta->debug_begin_call = call;
-
 
328
 
-
 
329
    if (ta->not_stoppable_count == 0) {
-
 
330
        ta->debug_begin_call = NULL;
-
 
331
        ta->stop_request = false;
-
 
332
        spinlock_unlock(&ta->lock);
-
 
333
        klog_printf("debug_begin(): immediate backsend");
-
 
334
        return 1; /* actually we need backsend with 0 retval */
-
 
335
    }
-
 
336
 
330
    spinlock_unlock(&ta->lock);
337
    spinlock_unlock(&ta->lock);
331
 
338
 
332
    klog_printf("debug_begin() done");
339
    klog_printf("debug_begin() done (wait for stoppability)");
-
 
340
    return 0;
333
}
341
}
334
 
342
 
335
static void debug_go(call_t *call, phone_t *phone)
343
static void debug_go(call_t *call, phone_t *phone)
336
{
344
{
337
    thread_t *t;
345
    thread_t *t;
Line 339... Line 347...
339
    task_t *ta;
347
    task_t *ta;
340
 
348
 
341
    klog_printf("debug_go()");
349
    klog_printf("debug_go()");
342
    ta = get_lock_callee_task(phone);
350
    ta = get_lock_callee_task(phone);
343
 
351
 
-
 
352
    ta->debug_go_call = call;
-
 
353
 
344
    l = ta->th_head.next;
354
    l = ta->th_head.next;
345
    if (l != &TASK->th_head) {
355
    if (l != &TASK->th_head) {
346
        t = list_get_instance(l, thread_t, th_link);
356
        t = list_get_instance(l, thread_t, th_link);
-
 
357
        klog_printf("debug_go(): waitq_wakeup");
347
        waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
358
        waitq_wakeup(&t->go_wq, WAKEUP_FIRST);
348
    }
359
    }
349
 
360
 
350
    ta->debug_go_call = call;
-
 
351
    spinlock_unlock(&ta->lock);
361
    spinlock_unlock(&ta->lock);
352
}
362
}
353
 
363
 
354
 
364
 
355
/** Called before the request is sent.
365
/** Called before the request is sent.
Line 400... Line 410...
400
            free(call->buffer);
410
            free(call->buffer);
401
            return rc;
411
            return rc;
402
        }
412
        }
403
        break;
413
        break;
404
    case IPC_M_DEBUG_BEGIN:
414
    case IPC_M_DEBUG_BEGIN:
-
 
415
        /* actually need possibility of backsend with 0 result code */
405
        debug_begin(call, phone);
416
        rc = debug_begin(call, phone);
-
 
417
        if (rc != 0) return rc;
406
        break;
418
        break;
407
    case IPC_M_DEBUG_GO:
419
    case IPC_M_DEBUG_GO:
408
        debug_go(call, phone);
420
        debug_go(call, phone);
409
        break;
421
        break;
410
    default:
422
    default: