]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2008-06-21 Michael Snyder <msnyder@specifix.com>
authorMichael Snyder <msnyder@vmware.com>
Sun, 22 Jun 2008 03:16:19 +0000 (03:16 +0000)
committerMichael Snyder <msnyder@vmware.com>
Sun, 22 Jun 2008 03:16:19 +0000 (03:16 +0000)
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.

gdb/gdbserver/ChangeLog
gdb/gdbserver/gdbfreeplay-back.c

index 7464deedac5c40037cb5d965fe74c952a0d0afe7..d148880b4e6aefb734751d5d3f9496a8de1f17af 100644 (file)
@@ -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".
index e44e2a4bab80a0cbe46493be43965360bb851234..b060f82c8d00f47a672af3021bb68408da5feb08 100644 (file)
@@ -637,6 +637,33 @@ add_checksum (char *inbuf)
   return 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
  *
@@ -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",