From: Doug Goldstein Date: Sun, 16 Mar 2014 20:02:59 +0000 (-0500) Subject: gdb: support reporting memory map locations X-Git-Tag: v1.2~8^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=ad47d913b54cef188269c4b75fdde51d27d6fe32;p=sx%2Fsimavr.git gdb: support reporting memory map locations GDB wants to have knowledge of the RAM and flash regions of memory on the chips. Since AVR is Harvard architecture, the RAM must begin at a fake offset and per Atmel's docs that is 0x800000. --- diff --git a/simavr/sim/sim_gdb.c b/simavr/sim/sim_gdb.c index a9d4c84..363dbca 100644 --- a/simavr/sim/sim_gdb.c +++ b/simavr/sim/sim_gdb.c @@ -288,7 +288,14 @@ gdb_handle_command( uint8_t command = *cmd++; switch (command) { case 'q': - if (strncmp(cmd, "Attached", 8) == 0) { + if (strncmp(cmd, "Supported", 9) == 0) { + /* If GDB asked what features we support, report back + * the features we support, which is just memory layout + * information for now. + */ + gdb_send_reply(g, "qXfer:memory-map:read+"); + break; + } else if (strncmp(cmd, "Attached", 8) == 0) { /* Respond that we are attached to an existing process.. * ourselves! */ @@ -297,6 +304,19 @@ gdb_handle_command( } else if (strncmp(cmd, "Offsets", 7) == 0) { gdb_send_reply(g, "Text=0;Data=800000;Bss=800000"); break; + } else if (strncmp(cmd, "Xfer:memory-map:read", 20) == 0) { + snprintf(rep, sizeof(rep), + "l\n" + " \n" + " \n" + " 0x80\n" + " \n" + "", + g->avr->ramend + 1, g->avr->flashend + 1); + + gdb_send_reply(g, rep); + break; + } gdb_send_reply(g, ""); break; case '?':