diff options
author | Michael Snyder <msnyder@vmware.com> | 2008-06-22 03:16:19 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@vmware.com> | 2008-06-22 03:16:19 +0000 |
commit | 8ebb33ecdc8b7651c96b42c4821cf4957f1c2606 (patch) | |
tree | dfda6835033944a8b84b8e7bdce88ddcb24db47e | |
parent | a21dae9c0bbd529cff3265dabf7585497092a42a (diff) | |
download | binutils-8ebb33ecdc8b7651c96b42c4821cf4957f1c2606.zip binutils-8ebb33ecdc8b7651c96b42c4821cf4957f1c2606.tar.gz binutils-8ebb33ecdc8b7651c96b42c4821cf4957f1c2606.tar.bz2 |
2008-06-21 Michael Snyder <msnyder@specifix.com>
Add monitor gdbreplay-next command.
* gdbfreeplay-back.c (freeplay_show_next_commands): New function.
Echo the next set of gdb commands, in the manner of gdbreplay.
(handle_special_case): Handle monitor gdbreplay-next command.
(fallbacks): Catch any unhandled qRcmd requests.
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/gdbfreeplay-back.c | 48 |
2 files changed, 52 insertions, 2 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 7464dee..d148880 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,11 @@ 2008-06-21 Michael Snyder <msnyder@specifix.com> + Add monitor gdbreplay-next command. + * gdbfreeplay-back.c (freeplay_show_next_commands): New function. + Echo the next set of gdb commands, in the manner of gdbreplay. + (handle_special_case): Handle monitor gdbreplay-next command. + (fallbacks): Catch any unhandled qRcmd requests. + Add support for 'R' packet (restart). * gdbfreeplay-back.c (handle_special_case). Add support for 'R'. Remove support for "monitor gdbfreeplay-echo". diff --git a/gdb/gdbserver/gdbfreeplay-back.c b/gdb/gdbserver/gdbfreeplay-back.c index e44e2a4..b060f82 100644 --- a/gdb/gdbserver/gdbfreeplay-back.c +++ b/gdb/gdbserver/gdbfreeplay-back.c @@ -638,6 +638,33 @@ add_checksum (char *inbuf) } /* + * freeplay_show_next_commands + * + * Output the gdb commands contained in the current frame. + */ + +static void +freeplay_show_next_commands (FILE *infile) +{ + char *line; + + if (cur_frame >= 0 && cur_frame < last_cached_frame) + { + fseek (infile, stopframe[cur_frame].eventpos, SEEK_SET); + while ((line = fgets (inbuf, sizeof (inbuf), infile)) != NULL) + { + if (cur_frame + 1 < last_cached_frame && + ftell (infile) >= stopframe[cur_frame + 1].eventpos) + /* Done with current frame. */ + break; + + if (line[0] == 'c' && line[1] == ' ') + fputs (line, stdout); + } + } +} + +/* * handle_special_case * * Handle these requests locally, rather than through the replay buffer. @@ -660,8 +687,8 @@ handle_special_case (FILE *infile, int fd, char *request) static char *monitor_verbose_off = "$qRcmd,766572626f7365206f6666#13"; static char *monitor_verbose_on = "$qRcmd,766572626f7365206f6e#d6"; - static char *monitor_echo = "$qRcmd,67646266726565706c61792d6563686f"; - + static char *monitor_gdbreplay_next = + "$qRcmd,6764627265706c61792d6e657874#83"; /* Handle 'k' (kill) request by exiting. */ if (strstr (request, "$k#6b") != NULL) @@ -700,6 +727,15 @@ handle_special_case (FILE *infile, int fd, char *request) return OK; } + /* Handle "monitor gdbreplay-next". */ + if (strstr (request, monitor_gdbreplay_next) != NULL) + { + /* Show the next gdb commands from the gdbreplay log, + just like gdbreplay would. */ + freeplay_show_next_commands (infile); + return OK; + } + /* Handle 'R' (restart) request. This is an extended-remote request that is not really used any more, but we can send it out-of-band (using "maint packet") to effectively @@ -972,6 +1008,14 @@ fallbacks (FILE *infile, int fd, char *request) } } + /* Any unhandled qRcmd, just echo it to stdout. */ + if ((p = strstr (request, "$qRcmd,")) != NULL) + { + if (verbose) + fprintf (stdout, "fallbacks: ignoring %s\n", p); + return EMPTY; + } + /* Default for any other un-handled request -- return empty string. */ if (verbose) fprintf (stdout, "fallbacks: absorbing unknown request '%s'.\n", |