diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/thread.c | 18 | ||||
-rw-r--r-- | src/thread.h | 1 |
3 files changed, 20 insertions, 0 deletions
@@ -107,6 +107,7 @@ static struct action actions[] = { { "putmem", "<address>", "Write to system memory", &handle_mem }, { "threadstatus", "", "Print the status of a thread", &thread_status_print }, { "sreset", "", "Reset", &thread_sreset }, + { "regs", "", "State", &thread_state }, }; diff --git a/src/thread.c b/src/thread.c index 13fa09d..a6e096b 100644 --- a/src/thread.c +++ b/src/thread.c @@ -127,6 +127,13 @@ static int sreset_thread(struct pdbg_target *thread_target, uint32_t index, uint return ram_sreset_thread(thread_target) ? 0 : 1; } +static int state_thread(struct pdbg_target *thread_target, uint32_t index, uint64_t *unused, uint64_t *unused1) +{ + struct thread_regs regs; + + return ram_state_thread(thread_target, ®s) ? 0 : 1; +} + int thread_start(int optind, int argc, char *argv[]) { return for_each_target("thread", start_thread, NULL, NULL); @@ -167,3 +174,14 @@ int thread_sreset(int optind, int argc, char *argv[]) { return for_each_target("thread", sreset_thread, NULL, NULL); } + +int thread_state(int optind, int argc, char *argv[]) +{ + int err; + + err = for_each_target("thread", state_thread, NULL, NULL); + + for_each_target_release("thread"); + + return err; +} diff --git a/src/thread.h b/src/thread.h index 01a8034..5fc2a80 100644 --- a/src/thread.h +++ b/src/thread.h @@ -22,3 +22,4 @@ int thread_step(int optind, int argc, char *argv[]); int thread_stop(int optind, int argc, char *argv[]); int thread_status_print(int optind, int argc, char *argv[]); int thread_sreset(int optind, int argc, char *argv[]); +int thread_state(int optind, int argc, char *argv[]); |