From fe3ff0bb26afb2f8c7d96ffa049bfebabca6291d Mon Sep 17 00:00:00 2001 From: msquirogac Date: Sat, 20 Jun 2020 18:39:37 -0400 Subject: [PATCH] new gdb commands kill, detach and monitor monitor parser engine supports reset and halt --- simavr/sim/sim_gdb.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/simavr/sim/sim_gdb.c b/simavr/sim/sim_gdb.c index be0320a..906d1ae 100644 --- a/simavr/sim/sim_gdb.c +++ b/simavr/sim/sim_gdb.c @@ -348,6 +348,32 @@ gdb_handle_command( // By sending back nothing, the debugger knows it has read // all available registers. } + } else if (strncmp(cmd, "Rcmd", 4) == 0) { // monitor command + char * args = strchr(cmd, ','); + if (args != NULL) + { + args++; + while(args != 0x00) { + printf("%s",args); + if (strncmp(args, "7265736574", 10) == 0) { // reset matched + avr->state = cpu_StepDone; + avr_reset(avr); + args += 10; + printf("Reset\n"); // Remove + } else if (strncmp(args, "68616c74", 8) == 0) { // halt matched + avr->state = cpu_Stopped; + args += 8; + printf("Halting\n"); // Remove + } else if (strncmp(args, "20", 2) == 0) { // space matched + args += 2; + printf("Space\n"); // Remove + } + else{ // no match - end + break; + } + } + } + gdb_send_reply(g, "OK"); } gdb_send_reply(g, ""); break; @@ -496,6 +522,12 @@ gdb_handle_command( break; } } break; + case 'K': // kill + case 'D': { // detach + avr->state = cpu_Done; + gdb_send_reply(g, "OK"); + printf("Halted\n"); // Remove + } break; default: gdb_send_reply(g, ""); break; -- 2.39.5