Fix probe-related internal error on AIX
authorSergio Durigan Junior <sergiodj@redhat.com>
Thu, 20 Mar 2014 21:08:31 +0000 (18:08 -0300)
committerSergio Durigan Junior <sergiodj@redhat.com>
Thu, 20 Mar 2014 21:08:31 +0000 (18:08 -0300)
-- Initial message by Tom Tromey:

While testing on AIX, I happened to notice an internal error coming
from parse_probes.  This happens because there are no probes defined
on this platform.  This patch fixes the problem by changing an assert
into an ordinary error, and then changing the relevant caller to cope.

This fixes a few tests on AIX; also regtested on x86-64 Fedora 18.

-- Followup by Sergio Durigan Junior:

By reading the patch (and the original code), I found it a little bit
obscure, so I took the liberty to try to improve it.  Here's the patch.
Could you please take a look and see if it works on AIX (and also if you
like the approach)?

gdb/
2014-03-20  Tom Tromey  <tromey@redhat.com>
    Sergio Durigan Junior  <sergiodj@redhat.com>

* probe.c (parse_probes): Turn assert into an ordinary error.
* break-catch-throw.c (re_set_exception_catchpoint): Ignore
exceptions when parsing probes.  Rearrange the code for clarity.

gdb/ChangeLog
gdb/break-catch-throw.c
gdb/probe.c

index 1db0ee97a073a087b73dcc1115d25deb3e970a02..1f4e8e76bed37123c6fef47b473930ccb795beac 100644 (file)
@@ -1,3 +1,10 @@
+2014-03-20  Tom Tromey  <tromey@redhat.com>
+           Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       * probe.c (parse_probes): Turn assert into an ordinary error.
+       * break-catch-throw.c (re_set_exception_catchpoint): Ignore
+       exceptions when parsing probes.  Rearrange the code for clarity.
+
 2014-03-20  Tom Tromey  <tromey@redhat.com>
 
        PR gdb/14135
index 72834902f0ca6a0d827223cf7b7297a0995f0a84..9831d96f4154bdf14dfbef287658010ec4a60419 100644 (file)
@@ -207,29 +207,32 @@ re_set_exception_catchpoint (struct breakpoint *self)
   volatile struct gdb_exception e;
   struct cleanup *cleanup;
   enum exception_event_kind kind = classify_exception_breakpoint (self);
-  int pass;
 
-  for (pass = 0; sals.sals == NULL && pass < 2; ++pass)
+  /* We first try to use the probe interface.  */
+  TRY_CATCH (e, RETURN_MASK_ERROR)
     {
-      TRY_CATCH (e, RETURN_MASK_ERROR)
+      char *spec = ASTRDUP (exception_functions[kind].probe);
+
+      sals = parse_probes (&spec, NULL);
+    }
+
+  if (e.reason < 0)
+    {
+      volatile struct gdb_exception ex;
+
+      /* Using the probe interface failed.  Let's fallback to the normal
+        catchpoint mode.  */
+      TRY_CATCH (ex, RETURN_MASK_ERROR)
        {
-         char *spec;
-
-         if (pass == 0)
-           {
-             spec = ASTRDUP (exception_functions[kind].probe);
-             sals = parse_probes (&spec, NULL);
-           }
-         else
-           {
-             spec = ASTRDUP (exception_functions[kind].function);
-             self->ops->decode_linespec (self, &spec, &sals);
-           }
+         char *spec = ASTRDUP (exception_functions[kind].function);
+
+         self->ops->decode_linespec (self, &spec, &sals);
        }
+
       /* NOT_FOUND_ERROR just means the breakpoint will be pending, so
         let it through.  */
-      if (e.reason < 0 && e.error != NOT_FOUND_ERROR)
-       throw_exception (e);
+      if (ex.reason < 0 && ex.error != NOT_FOUND_ERROR)
+       throw_exception (ex);
     }
 
   cleanup = make_cleanup (xfree, sals.sals);
index 623f65cb05176d129a09c7b3156c206019ce9193..838d9f98195f68f0e5601c6b25e79220a56030d9 100644 (file)
@@ -59,7 +59,8 @@ parse_probes (char **argptr, struct linespec_result *canonical)
 
   cs = *argptr;
   probe_ops = probe_linespec_to_ops (&cs);
-  gdb_assert (probe_ops != NULL);
+  if (probe_ops == NULL)
+    error (_("'%s' is not a probe linespec"), arg_start);
 
   arg = (char *) cs;
   arg = skip_spaces (arg);
This page took 0.03121 seconds and 4 git commands to generate.