* breakpoint.c (insert_catchpoint): New function.
authorDaniel Jacobowitz <drow@false.org>
Tue, 17 Jun 2003 19:17:59 +0000 (19:17 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 17 Jun 2003 19:17:59 +0000 (19:17 +0000)
(insert_breakpoints): Use catch_exceptions to call
insert_catchpoint.  Disable catchpoints if they fail to insert.

gdb/ChangeLog
gdb/breakpoint.c

index e8f31a13112f9b4f719479a06b05ef14549d1d5c..e972edcb16b06121065e81fe99428454b0cda8fe 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
+
+       * breakpoint.c (insert_catchpoint): New function.
+       (insert_breakpoints): Use catch_exceptions to call
+       insert_catchpoint.  Disable catchpoints if they fail to insert.
+
 2003-06-17  Daniel Jacobowitz  <drow@mvista.com>
 
        * symfile.c (reread_symbols): Clear sym_private.
index 0739efd2bda1a17feae399e162acc9040ff9d342..d8682256ceacb17eecc2ddb3ec537ae25d38247e 100644 (file)
@@ -703,6 +703,35 @@ read_memory_nobpt (CORE_ADDR memaddr, char *myaddr, unsigned len)
 }
 \f
 
+/* A wrapper function for inserting catchpoints.  */
+int
+insert_catchpoint (struct ui_out *uo, void *args)
+{
+  struct breakpoint *b = (struct breakpoint *) args;
+  int val = -1;
+
+  switch (b->type)
+    {
+    case bp_catch_fork:
+      val = target_insert_fork_catchpoint (PIDGET (inferior_ptid));
+      break;
+    case bp_catch_vfork:
+      val = target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
+      break;
+    case bp_catch_exec:
+      val = target_insert_exec_catchpoint (PIDGET (inferior_ptid));
+      break;
+    default:
+      warning ("Internal error, %s line %d.", __FILE__, __LINE__);
+      break;
+    }
+
+  if (val < 0)
+    throw_exception (RETURN_ERROR);
+
+  return 0;
+}
+
 /* insert_breakpoints is used when starting or continuing the program.
    remove_breakpoints is used when the program stops.
    Both return zero if successful,
@@ -1054,32 +1083,15 @@ insert_breakpoints (void)
             && !b->inserted
             && !b->duplicate)
       {
-       val = -1;
-       switch (b->type)
-         {
-         case bp_catch_fork:
-           val = target_insert_fork_catchpoint (PIDGET (inferior_ptid));
-           break;
-         case bp_catch_vfork:
-           val = target_insert_vfork_catchpoint (PIDGET (inferior_ptid));
-           break;
-         case bp_catch_exec:
-           val = target_insert_exec_catchpoint (PIDGET (inferior_ptid));
-           break;
-         default:
-           warning ("Internal error, %s line %d.", __FILE__, __LINE__);
-           break;
-         }
+       char prefix[64];
+
+       sprintf (prefix, "warning: inserting catchpoint %d: ", b->number);
+       val = catch_exceptions (uiout, insert_catchpoint, b, prefix,
+                               RETURN_MASK_ERROR);
        if (val < 0)
-         {
-           fprintf_unfiltered (tmp_error_stream, 
-                               "Cannot insert catchpoint %d.", b->number);
-         }
+         b->enable_state = bp_disabled;
        else
          b->inserted = 1;
-
-       if (val)
-         return_val = val;     /* remember failure */
       }
   }
   
This page took 0.031595 seconds and 4 git commands to generate.