Subversion Repositories HelenOS

Rev

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

Rev 2938 Rev 2939
Line 65... Line 65...
65
int next_thread_id;
65
int next_thread_id;
66
 
66
 
67
int app_phone;
67
int app_phone;
68
volatile bool abort_debug;
68
volatile bool abort_debug;
69
 
69
 
70
thash_t thash;
-
 
71
volatile int paused;
70
volatile int paused;
72
 
71
 
73
breakpoint_t brk_list[MAX_BRKPTS];
72
breakpoint_t brk_list[MAX_BRKPTS];
74
int lifted_brkpt;
73
int lifted_brkpt;
75
 
74
 
Line 140... Line 139...
140
    (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv);
139
    (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv);
141
}
140
}
142
 
141
 
143
static void thread_stop(void)
142
static void thread_stop(void)
144
{
143
{
-
 
144
    dthread_t *dt;
-
 
145
 
-
 
146
    dt = dthread_get();
145
    cons_printf("[t] stopped\n");
147
    cons_printf("[thread %d] stopped\n", dt->id);
146
    fcv_wait(&go_cv);
148
    dthread_stop_me();
147
    cons_printf("[t] go\n");
149
    cons_printf("[thread %d] go\n", dt->id);
148
}
150
}
149
 
151
 
150
/*
152
/*
151
 * Called by a fibril (from arch code) when a breakpoint is hit.
153
 * Called by a fibril (from arch code) when a breakpoint is hit.
152
 */
154
 */
Line 220... Line 222...
220
static void debug_event(thash_t thash, udebug_event_t ev_type, sysarg_t val0)
222
static void debug_event(thash_t thash, udebug_event_t ev_type, sysarg_t val0)
221
{
223
{
222
    switch (ev_type) {
224
    switch (ev_type) {
223
    case UDEBUG_EVENT_STOP:
225
    case UDEBUG_EVENT_STOP:
224
        cons_printf("stop event\n");
226
        cons_printf("stop event\n");
225
        cons_printf("waiting for resume\n");
-
 
226
        while (paused) {
-
 
227
            usleep(1000000);
-
 
228
            fibril_yield();
227
        thread_stop();
229
            cons_printf(".");
-
 
230
        }
-
 
231
        cons_printf("resumed\n");
-
 
232
        break;
228
        break;
233
    case UDEBUG_EVENT_THREAD_B:
229
    case UDEBUG_EVENT_THREAD_B:
234
        event_thread_b(val0);
230
        event_thread_b(val0);
235
        break;
231
        break;
236
    case UDEBUG_EVENT_THREAD_E:
232
    case UDEBUG_EVENT_THREAD_E:
Line 268... Line 264...
268
 
264
 
269
        if (ev_type == UDEBUG_EVENT_FINISHED) {
265
        if (ev_type == UDEBUG_EVENT_FINISHED) {
270
            cons_printf("thread %u debugging finished\n", dt->id);
266
            cons_printf("thread %u debugging finished\n", dt->id);
271
            break;
267
            break;
272
        }
268
        }
273
        if (rc >= 0) debug_event(thash, ev_type, val0);
269
        if (rc >= 0) debug_event(dt->hash, ev_type, val0);
274
    }
270
    }
275
 
271
 
276
    cons_printf("debug_loop(%d) exiting\n", dt->id);
272
    cons_printf("debug_loop(%d) exiting\n", dt->id);
277
}
273
}
278
 
274
 
Line 285... Line 281...
285
 
281
 
286
    fid = fibril_create(debug_loop, (void *)dt);
282
    fid = fibril_create(debug_loop, (void *)dt);
287
    if (fid == 0) {
283
    if (fid == 0) {
288
        cons_printf("Warning: Failed creating fibril\n");
284
        cons_printf("Warning: Failed creating fibril\n");
289
    }
285
    }
-
 
286
    dt->fid = fid;
-
 
287
 
290
    fibril_add_ready(fid);
288
    fibril_add_ready(fid);
291
}
289
}
292
 
290
 
293
void debug_active_task(void)
291
void debug_active_task(void)
294
{
292
{