* [commit] Fix new failures in break.exp
@ 2003-06-17 19:46 Daniel Jacobowitz
2003-06-17 20:41 ` Andrew Cagney
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2003-06-17 19:46 UTC (permalink / raw)
To: gdb-patches
Oops, I apparently failed to run the testsuite before and after my last fork
patch. break.exp does "catch fork; continue" and expects either the catch
to fail, or the continue to succeed and the catch never to be hit. But
catch fork was turned into an error () in some circumstances.
This wraps the call to target_insert_fork_catchpoint in a catch_exceptions,
and disables the catchpoint if we can't insert it - which both fixes the
testsuite, and makes a lot more sense to me. Checked in.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
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.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.122
diff -u -p -r1.122 breakpoint.c
--- breakpoint.c 8 Jun 2003 18:27:12 -0000 1.122
+++ breakpoint.c 17 Jun 2003 19:07:24 -0000
@@ -703,6 +703,35 @@ read_memory_nobpt (CORE_ADDR memaddr, ch
}
\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 */
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [commit] Fix new failures in break.exp
2003-06-17 19:46 [commit] Fix new failures in break.exp Daniel Jacobowitz
@ 2003-06-17 20:41 ` Andrew Cagney
2003-06-19 20:38 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2003-06-17 20:41 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
> + default:
> + warning ("Internal error, %s line %d.", __FILE__, __LINE__);
> + break;
Please, no. If its an internal error, call internal_error.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [commit] Fix new failures in break.exp
2003-06-17 20:41 ` Andrew Cagney
@ 2003-06-19 20:38 ` Daniel Jacobowitz
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2003-06-19 20:38 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Tue, Jun 17, 2003 at 04:35:28PM -0400, Andrew Cagney wrote:
> >+ default:
> >+ warning ("Internal error, %s line %d.", __FILE__, __LINE__);
> >+ break;
>
> Please, no. If its an internal error, call internal_error.
I was just moving old code around. But I've fixed it.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-06-19 Daniel Jacobowitz <drow@mvista.com>
* breakpoint.c (insert_catchpoint): Call internal_error.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.123
diff -u -p -r1.123 breakpoint.c
--- breakpoint.c 17 Jun 2003 19:17:59 -0000 1.123
+++ breakpoint.c 19 Jun 2003 20:01:46 -0000
@@ -722,7 +722,7 @@ insert_catchpoint (struct ui_out *uo, vo
val = target_insert_exec_catchpoint (PIDGET (inferior_ptid));
break;
default:
- warning ("Internal error, %s line %d.", __FILE__, __LINE__);
+ internal_error (__FILE__, __LINE__, "unknown breakpoint type");
break;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-19 20:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-17 19:46 [commit] Fix new failures in break.exp Daniel Jacobowitz
2003-06-17 20:41 ` Andrew Cagney
2003-06-19 20:38 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox