From: msquirogac Date: Sat, 20 Jun 2020 22:39:37 +0000 (-0400) Subject: new gdb commands kill, detach and monitor X-Git-Tag: v1.7~21^2~2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=fe3ff0bb26afb2f8c7d96ffa049bfebabca6291d;p=sx%2Fsimavr.git new gdb commands kill, detach and monitor monitor parser engine supports reset and halt --- 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;