public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  gdb_7_2-branch:         * src-release (ETC_SUPPORT): add gnu-oids.texi
@ 2010-12-10 17:17 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2010-12-10 17:17 UTC (permalink / raw)
  To: archer-commits

The branch, gdb_7_2-branch has been updated
       via  6ff9de0b1273f2ba406c58540efd498c78504498 (commit)
       via  92b5720d6deb17122bafe807a028e7d5d5bd3109 (commit)
       via  5654aa584ae00d5c0fd33f75b53f8700e1c00f01 (commit)
       via  ba115680e6afc5af56ad4d9d9915c198085d47c5 (commit)
       via  426ee32a3807eb7b6723a18c1e3d0c769574caa7 (commit)
       via  bd339aa400b4dcb4f78e141c7a6611b71883d770 (commit)
       via  e64390606685ca287c9155e3b92ee101b587aa73 (commit)
       via  a0a92770bf19ec64b607fa29bb1e9b0cfe23ab8c (commit)
       via  caf0389ccd801040f5bf2a8fff15f95d38a580d3 (commit)
       via  19cac090b31890cddaecdc0eeaff8345e525c3fd (commit)
      from  8fa856132ab0edd99dc7aed81ffee1be617c0c22 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 6ff9de0b1273f2ba406c58540efd498c78504498
Author: Joel Brobecker <brobecker@gnat.com>
Date:   Fri Dec 10 11:28:29 2010 +0000

            * src-release (ETC_SUPPORT): add gnu-oids.texi

commit 92b5720d6deb17122bafe807a028e7d5d5bd3109
Author: Joel Brobecker <brobecker@gnat.com>
Date:   Fri Dec 10 11:28:29 2010 +0000

            * src-release (ETC_SUPPORT): add gnu-oids.texi

commit 5654aa584ae00d5c0fd33f75b53f8700e1c00f01
Author: Joel Brobecker <brobecker@gnat.com>
Date:   Fri Dec 10 11:28:29 2010 +0000

            * src-release (ETC_SUPPORT): add gnu-oids.texi

commit ba115680e6afc5af56ad4d9d9915c198085d47c5
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Fri Dec 10 00:00:03 2010 +0000

    *** empty log message ***

commit 426ee32a3807eb7b6723a18c1e3d0c769574caa7
Author: Marc Khouzam <marc.khouzam@ericsson.com>
Date:   Thu Dec 9 20:37:22 2010 +0000

    	* mi/mi-parse.c (mi_parse): Wrong error message.

commit bd339aa400b4dcb4f78e141c7a6611b71883d770
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Dec 9 19:22:57 2010 +0000

    gdb
    	* mi/mi-parse.h (mi_parse): Update.
    	* mi/mi-parse.c (mi_parse_cleanup): New function.
    	(mi_parse): Add 'token' argument.  Throw exception on error.
    	* mi/mi-main.c (mi_print_exception): New function.
    	(mi_execute_command): Use mi_print_exception.  Catch exceptions
    	from mi_parse.
    gdb/testsuite
    	* gdb.base/interp.exp: Add regression test.

commit e64390606685ca287c9155e3b92ee101b587aa73
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Thu Dec 9 00:00:33 2010 +0000

    *** empty log message ***

commit a0a92770bf19ec64b607fa29bb1e9b0cfe23ab8c
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Wed Dec 8 00:00:33 2010 +0000

    *** empty log message ***

commit caf0389ccd801040f5bf2a8fff15f95d38a580d3
Author: gdbadmin <gdbadmin@sourceware.org>
Date:   Tue Dec 7 00:00:32 2010 +0000

    *** empty log message ***

commit 19cac090b31890cddaecdc0eeaff8345e525c3fd
Author: Marc Khouzam <marc.khouzam@ericsson.com>
Date:   Mon Dec 6 14:23:40 2010 +0000

    	* mi/mi-parse.c (mi_parse): Missing else.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                         |    4 +++
 gdb/ChangeLog                     |   17 ++++++++++++
 gdb/mi/mi-main.c                  |   40 ++++++++++++++++++++-------
 gdb/mi/mi-parse.c                 |   53 +++++++++++++++++++------------------
 gdb/mi/mi-parse.h                 |   14 +++++----
 gdb/testsuite/ChangeLog           |    4 +++
 gdb/testsuite/gdb.base/interp.exp |   11 +++++++
 gdb/version.in                    |    2 +-
 src-release                       |    2 +-
 9 files changed, 102 insertions(+), 45 deletions(-)

First 500 lines of diff:
diff --git a/ChangeLog b/ChangeLog
index 5759b30..b812eec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-10  Tristan Gingold  <gingold@adacore.com>
+
+	* src-release (ETC_SUPPORT): add gnu-oids.texi
+
 2010-06-10  Alexandre Oliva  <aoliva@redhat.com>
 
 	* Makefile.def (configure-gcc): Depend on all-libelf.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d480538..193998e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-09  Marc Khouzam  <marc.khouzam@ericsson.com>
+
+	* mi/mi-parse.c (mi_parse): Wrong error message.
+
+2010-12-09  Tom Tromey  <tromey@redhat.com>
+
+	* mi/mi-parse.h (mi_parse): Update.
+	* mi/mi-parse.c (mi_parse_cleanup): New function.
+	(mi_parse): Add 'token' argument.  Throw exception on error.
+	* mi/mi-main.c (mi_print_exception): New function.
+	(mi_execute_command): Use mi_print_exception.  Catch exceptions
+	from mi_parse.
+
+2010-12-06  Marc Khouzam  <marc.khouzam@ericsson.com>
+
+	* mi/mi-parse.c (mi_parse): Missing else.
+
 2010-11-25  Marc Khouzam  <marc.khouzam@ericsson.com>
 
 	PR breakpoints/12217
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 96c02fe..0614506 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1744,11 +1744,26 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
   return;
 }
 
+/* Print a gdb exception to the MI output stream.  */
+
+static void
+mi_print_exception (const char *token, struct gdb_exception exception)
+{
+  fputs_unfiltered (token, raw_stdout);
+  fputs_unfiltered ("^error,msg=\"", raw_stdout);
+  if (exception.message == NULL)
+    fputs_unfiltered ("unknown error", raw_stdout);
+  else
+    fputstr_unfiltered (exception.message, '"', raw_stdout);
+  fputs_unfiltered ("\"\n", raw_stdout);
+}
 
 void
 mi_execute_command (char *cmd, int from_tty)
 {
-  struct mi_parse *command;
+  char *token;
+  struct mi_parse *command = NULL;
+  volatile struct gdb_exception exception;
 
   /* This is to handle EOF (^D). We just quit gdb.  */
   /* FIXME: we should call some API function here.  */
@@ -1757,13 +1772,22 @@ mi_execute_command (char *cmd, int from_tty)
 
   target_log_command (cmd);
 
-  command = mi_parse (cmd);
-
-  if (command != NULL)
+  TRY_CATCH (exception, RETURN_MASK_ALL)
+    {
+      command = mi_parse (cmd, &token);
+    }
+  if (exception.reason < 0)
+    {
+      mi_print_exception (token, exception);
+      xfree (token);
+    }
+  else
     {
       struct gdb_exception result;
       ptid_t previous_ptid = inferior_ptid;
 
+      command->token = token;
+
       if (do_timings)
 	{
 	  command->cmd_start = (struct mi_timestamp *)
@@ -1777,13 +1801,7 @@ mi_execute_command (char *cmd, int from_tty)
 	{
 	  /* The command execution failed and error() was called
 	     somewhere.  */
-	  fputs_unfiltered (command->token, raw_stdout);
-	  fputs_unfiltered ("^error,msg=\"", raw_stdout);
-	  if (result.message == NULL)
-	    fputs_unfiltered ("unknown error", raw_stdout);
-	  else
-	    fputstr_unfiltered (result.message, '"', raw_stdout);
-	  fputs_unfiltered ("\"\n", raw_stdout);
+	  mi_print_exception (command->token, result);
 	  mi_out_rewind (uiout);
 	}
 
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index a5a4e75..092cf72 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -223,12 +223,20 @@ mi_parse_free (struct mi_parse *parse)
   xfree (parse);
 }
 
+/* A cleanup that calls mi_parse_free.  */
+
+static void
+mi_parse_cleanup (void *arg)
+{
+  mi_parse_free (arg);
+}
 
 struct mi_parse *
-mi_parse (char *cmd)
+mi_parse (char *cmd, char **token)
 {
   char *chp;
   struct mi_parse *parse = XMALLOC (struct mi_parse);
+  struct cleanup *cleanup;
 
   memset (parse, 0, sizeof (*parse));
   parse->all = 0;
@@ -236,6 +244,8 @@ mi_parse (char *cmd)
   parse->thread = -1;
   parse->frame = -1;
 
+  cleanup = make_cleanup (mi_parse_cleanup, parse);
+
   /* Before starting, skip leading white space. */
   while (isspace (*cmd))
     cmd++;
@@ -243,9 +253,9 @@ mi_parse (char *cmd)
   /* Find/skip any token and then extract it. */
   for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++)
     ;
-  parse->token = xmalloc ((chp - cmd + 1) * sizeof (char *));
-  memcpy (parse->token, cmd, (chp - cmd));
-  parse->token[chp - cmd] = '\0';
+  *token = xmalloc ((chp - cmd + 1) * sizeof (char *));
+  memcpy (*token, cmd, (chp - cmd));
+  (*token)[chp - cmd] = '\0';
 
   /* This wasn't a real MI command.  Return it as a CLI_COMMAND. */
   if (*chp != '-')
@@ -254,6 +264,9 @@ mi_parse (char *cmd)
 	chp++;
       parse->command = xstrdup (chp);
       parse->op = CLI_COMMAND;
+
+      discard_cleanups (cleanup);
+
       return parse;
     }
 
@@ -271,15 +284,7 @@ mi_parse (char *cmd)
   /* Find the command in the MI table. */
   parse->cmd = mi_lookup (parse->command);
   if (parse->cmd == NULL)
-    {
-      /* FIXME: This should be a function call. */
-      fprintf_unfiltered
-	(raw_stdout,
-	 "%s^error,msg=\"Undefined MI command: %s\"\n",
-	 parse->token, parse->command);
-      mi_parse_free (parse);
-      return NULL;
-    }
+    error (_("Undefined MI command: %s"), parse->command);
 
   /* Skip white space following the command. */
   while (isspace (*chp))
@@ -292,7 +297,7 @@ mi_parse (char *cmd)
      to CLI.  */
   for (;;)
     {
-      char *start = chp;
+      const char *option;
       size_t as = sizeof ("--all ") - 1;
       size_t tgs = sizeof ("--thread-group ") - 1;
       size_t ts = sizeof ("--thread ") - 1;
@@ -311,6 +316,7 @@ mi_parse (char *cmd)
         }
       if (strncmp (chp, "--thread-group ", tgs) == 0)
 	{
+	  option = "--thread-group";
 	  if (parse->thread_group != -1)
 	    error (_("Duplicate '--thread-group' option"));
 	  chp += tgs;
@@ -319,8 +325,9 @@ mi_parse (char *cmd)
 	  chp += 1;
 	  parse->thread_group = strtol (chp, &chp, 10);
 	}
-      if (strncmp (chp, "--thread ", ts) == 0)
+      else if (strncmp (chp, "--thread ", ts) == 0)
 	{
+	  option = "--thread";
 	  if (parse->thread != -1)
 	    error (_("Duplicate '--thread' option"));
 	  chp += ts;
@@ -328,6 +335,7 @@ mi_parse (char *cmd)
 	}
       else if (strncmp (chp, "--frame ", fs) == 0)
 	{
+	  option = "--frame";
 	  if (parse->frame != -1)
 	    error (_("Duplicate '--frame' option"));
 	  chp += fs;
@@ -337,8 +345,7 @@ mi_parse (char *cmd)
 	break;
 
       if (*chp != '\0' && !isspace (*chp))
-	error (_("Invalid value for the '%s' option"),
-	       start[2] == 't' ? "--thread" : "--frame");
+	error (_("Invalid value for the '%s' option"), option);
       while (isspace (*chp))
 	chp++;
     }
@@ -349,15 +356,7 @@ mi_parse (char *cmd)
     {
       mi_parse_argv (chp, parse);
       if (parse->argv == NULL)
-	{
-	  /* FIXME: This should be a function call. */
-	  fprintf_unfiltered
-	    (raw_stdout,
-	     "%s^error,msg=\"Problem parsing arguments: %s %s\"\n",
-	     parse->token, parse->command, chp);
-	  mi_parse_free (parse);
-	  return NULL;
-	}
+	error (_("Problem parsing arguments: %s %s"), parse->command, chp);
     }
 
   /* FIXME: DELETE THIS */
@@ -366,6 +365,8 @@ mi_parse (char *cmd)
   if (parse->cmd->cli.cmd != NULL)
     parse->args = xstrdup (chp);
 
+  discard_cleanups (cleanup);
+
   /* Fully parsed. */
   parse->op = MI_COMMAND;
   return parse;
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index 3c6cd9a..6d0f53c 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -52,13 +52,15 @@ struct mi_parse
     int frame;
   };
 
-/* Attempts to parse CMD returning a ``struct mi_command''.  If CMD is
-   invalid, an error mesage is reported (MI format) and NULL is
-   returned. For a CLI_COMMAND, COMMAND, TOKEN and OP are initialized.
-   For an MI_COMMAND COMMAND, TOKEN, ARGS and OP are
-   initialized. Un-initialized fields are zero. */
+/* Attempts to parse CMD returning a ``struct mi_parse''.  If CMD is
+   invalid, an exception is thrown.  For an MI_COMMAND COMMAND, ARGS
+   and OP are initialized.  Un-initialized fields are zero.  *TOKEN is
+   set to the token, even if an exception is thrown.  It is allocated
+   with xmalloc; it must either be freed with xfree, or assigned to
+   the TOKEN field of the resultant mi_parse object, to be freed by
+   mi_parse_free.  */
 
-extern struct mi_parse *mi_parse (char *cmd);
+extern struct mi_parse *mi_parse (char *cmd, char **token);
 
 /* Free a command returned by mi_parse_command. */
 
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index cb55849..86286c4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-09  Tom Tromey  <tromey@redhat.com>
+
+	* gdb.base/interp.exp: Add regression test.
+
 2010-11-18  Phil Muldoon  <pmuldoon@redhat.com>
             Jan Kratochvil  <jan.kratochvil@redhat.com>
 
diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp
index ece2552..a923f1a 100644
--- a/gdb/testsuite/gdb.base/interp.exp
+++ b/gdb/testsuite/gdb.base/interp.exp
@@ -33,4 +33,15 @@ gdb_test_multiple $cmd $cmd {
 }
 gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*"
 
+# Regression test for crash when an exception occurs in mi_parse.
+gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \
+    "regression test for mi_parse crash" {
+	-re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " {
+	    pass "$cmd"
+	    gdb_expect 1 {
+		-re "\r\n$gdb_prompt $" { }
+	    }
+	}
+    }
+
 gdb_exit
diff --git a/gdb/version.in b/gdb/version.in
index 8a6eeac..ede42de 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-7.2.0.20101206-cvs
+7.2.0.20101210-cvs
diff --git a/src-release b/src-release
index bdb8c1d..8c25e6b 100644
--- a/src-release
+++ b/src-release
@@ -57,7 +57,7 @@ DEVO_SUPPORT= README Makefile.in configure configure.ac \
 # Files in devo/etc used in any net release.
 ETC_SUPPORT= Makefile.in configure configure.in standards.texi \
 	make-stds.texi standards.info* configure.texi configure.info* \
-	ChangeLog configbuild.* configdev.* fdl.texi texi2pod.pl
+	ChangeLog configbuild.* configdev.* fdl.texi texi2pod.pl gnu-oids.texi
 
 
 # When you use `make setup-dirs' or `make taz' you should always redefine


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-10 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-10 17:17 [SCM] gdb_7_2-branch: * src-release (ETC_SUPPORT): add gnu-oids.texi jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).