Subversion Repositories HelenOS

Rev

Rev 4380 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4380 Rev 4390
Line 49... Line 49...
49
#include "dthread.h"
49
#include "dthread.h"
50
#include "breakpoint.h"
50
#include "breakpoint.h"
51
#include "include/arch.h"
51
#include "include/arch.h"
52
#include "main.h"
52
#include "main.h"
53
 
53
 
54
void thread_debug_start(unsigned thread_hash);
54
void thread_debug_start(thash_t thread_hash);
55
 
55
 
56
#define IN_BUF_SIZE 64
56
#define IN_BUF_SIZE 64
57
static char in_buf[IN_BUF_SIZE];
57
static char in_buf[IN_BUF_SIZE];
58
 
58
 
59
#define MAX_ARGC 10
59
#define MAX_ARGC 10
Line 319... Line 319...
319
    *n = tb_copied / sizeof(thash_t);
319
    *n = tb_copied / sizeof(thash_t);
320
 
320
 
321
    cons_printf("thread hashes:");
321
    cons_printf("thread hashes:");
322
 
322
 
323
    for (i = 0; i < *n; ++i) {
323
    for (i = 0; i < *n; ++i) {
324
        cons_printf("0x%x\n", thash_buf[i]);
324
        cons_printf("0x%lx\n", thash_buf[i]);
325
    }
325
    }
326
 
326
 
327
    cons_printf("Total of %u threads\n", *n);
327
    cons_printf("Total of %u threads\n", *n);
328
 
328
 
329
    *thash_buf_ptr = thash_buf;
329
    *thash_buf_ptr = thash_buf;
330
 
330
 
331
    return 0;
331
    return 0;
332
}
332
}
333
 
333
 
334
static void event_thread_b(unsigned hash)
334
static void event_thread_b(thash_t hash)
335
{
335
{
336
    async_serialize_start();
336
    async_serialize_start();
337
    cons_printf("new thread, hash 0x%x\n", hash);
337
    cons_printf("new thread, hash 0x%lx\n", hash);
338
    async_serialize_end();
338
    async_serialize_end();
339
 
339
 
340
    thread_debug_start(hash);
340
    thread_debug_start(hash);
341
}
341
}
342
 
342
 
Line 368... Line 368...
368
 
368
 
369
static int debug_loop(void *dt_arg)
369
static int debug_loop(void *dt_arg)
370
{
370
{
371
    int rc;
371
    int rc;
372
    udebug_event_t ev_type;
372
    udebug_event_t ev_type;
373
    unsigned val0, val1;
373
    sysarg_t val0, val1;
374
    dthread_t *dt;
374
    dthread_t *dt;
375
 
375
 
376
    dt = (dthread_t *)dt_arg;
376
    dt = (dthread_t *)dt_arg;
377
 
377
 
378
    cons_printf("debug_loop(%d)\n", dt->id);
378
    cons_printf("debug_loop(%d)\n", dt->id);
379
 
379
 
380
    while (!abort_debug) {
380
    while (!abort_debug) {
381
 
-
 
382
        /* Run thread until an event occurs */
381
        /* Run thread until an event occurs */
383
        rc = udebug_go(app_phone, dt->hash, &ev_type, &val0, &val1);
382
        rc = udebug_go(app_phone, dt->hash, &ev_type, &val0, &val1);
-
 
383
        if (rc < 0) {
-
 
384
            cons_printf("Failed resuming thread (%d).\n", rc);
-
 
385
            return rc;
-
 
386
        }
384
 
387
 
385
        if (ev_type == UDEBUG_EVENT_FINISHED) {
388
        if (ev_type == UDEBUG_EVENT_FINISHED) {
386
            cons_printf("thread %u debugging finished\n", dt->id);
389
            cons_printf("thread %u debugging finished\n", dt->id);
387
            break;
390
            break;
388
        }
391
        }
389
        if (rc >= 0) debug_event(dt->hash, ev_type, val0);
392
        debug_event(dt->hash, ev_type, val0);
390
    }
393
    }
391
 
394
 
392
    cons_printf("debug_loop(%d) exiting\n", dt->id);
395
    cons_printf("debug_loop(%d) exiting\n", dt->id);
393
    return 0;
396
    return 0;
394
}
397
}
395
 
398
 
396
void thread_debug_start(unsigned thash)
399
void thread_debug_start(thash_t thash)
397
{
400
{
398
    fid_t fid;
401
    fid_t fid;
399
    dthread_t *dt;
402
    dthread_t *dt;
400
 
403
 
401
    dt = dthread_new(thash);
404
    dt = dthread_new(thash);