45,6 → 45,7 |
|
#include "cmd.h" |
#include "cons.h" |
#include "dthread.h" |
#include "include/arch.h" |
#include "fib_synch.h" |
#include "main.h" |
61,12 → 62,6 |
#define THBUF_SIZE 64 |
thash_t thread_hash_buf[THBUF_SIZE]; |
|
#define MAX_THREADS 64 |
thash_t thread_hash[MAX_THREADS]; |
int thread_id[MAX_THREADS]; |
unsigned n_threads; |
int cwt; /* index into thread_hash/thread_id */ |
|
int next_thread_id; |
|
int app_phone; |
80,7 → 75,7 |
|
fcv_t go_cv; |
|
void command_split(char *cmd_str) |
static void command_split(char *cmd_str) |
{ |
char *p = cmd_str; |
|
101,7 → 96,7 |
} |
} |
|
void command_run(void) |
static void command_run(void) |
{ |
int i; |
int cmp_len; |
145,7 → 140,7 |
(*cmd_table[idx_found].proc)(cmd_argc, cmd_argv); |
} |
|
void thread_stop(void) |
static void thread_stop(void) |
{ |
cons_printf("[t] stopped\n"); |
fcv_wait(&go_cv); |
161,7 → 156,7 |
thread_stop(); |
} |
|
int task_connect(int taskid) |
static int task_connect(int taskid) |
{ |
int rc; |
unsigned evmask; |
186,7 → 181,7 |
return 0; |
} |
|
int get_thread_list(void) |
static int get_thread_list(void) |
{ |
int rc; |
int tb_copied; |
254,46 → 249,41 |
} |
} |
|
void debug_loop(void *thread_buf_idx_arg) |
void debug_loop(void *dt_arg) |
{ |
int rc; |
udebug_event_t ev_type; |
unsigned thread_buf_idx; |
thash_t thash; |
int tid; |
unsigned val0, val1; |
dthread_t *dt; |
|
thread_buf_idx = (unsigned)thread_buf_idx_arg; |
dt = (dthread_t *)dt_arg; |
|
thash = thread_hash[thread_buf_idx]; |
tid = thread_id[thread_buf_idx]; |
cons_printf("debug_loop(%d)\n", dt->id); |
|
cons_printf("debug_loop(%d)\n", tid); |
|
while (!abort_debug) { |
|
/* Run thread until an event occurs */ |
rc = udebug_go(app_phone, thash, |
&ev_type, &val0, &val1); |
rc = udebug_go(app_phone, dt->hash, &ev_type, &val0, &val1); |
|
if (ev_type == UDEBUG_EVENT_FINISHED) { |
cons_printf("thread %u debugging finished\n", tid); |
cons_printf("thread %u debugging finished\n", dt->id); |
break; |
} |
if (rc >= 0) debug_event(thash, ev_type, val0); |
} |
|
cons_printf("debug_loop(%d) exiting\n", thread_id); |
cons_printf("debug_loop(%d) exiting\n", dt->id); |
} |
|
void thread_debug_start(unsigned thash) |
{ |
fid_t fid; |
dthread_t *dt; |
|
thread_hash[n_threads] = thash; |
thread_id[n_threads] = next_thread_id++; |
dt = dthread_new(thash); |
|
fid = fibril_create(debug_loop, (void *)n_threads++); |
fid = fibril_create(debug_loop, (void *)dt); |
if (fid == 0) { |
cons_printf("Warning: Failed creating fibril\n"); |
} |
355,6 → 345,9 |
next_thread_id = 1; |
paused = 0; |
|
list_initialize(&dthreads); |
cwt = NULL; |
|
fcv_init(&go_cv); |
} |
|