This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Fix reattaching breakpoints after vfork


This patch fixes up a FIXME in reattach_breakpoints:

-	/* FIXME drow/2003-10-07: This doesn't handle any other kinds of
-	   breakpoints.  It's wrong for watchpoints, for example.  */

It's also wrong for catchpoints.  It tries to insert a software
breakpoint at location 0, which fails, and then it stops.  Any
breakpoints that were set after a vfork catchpoint are never
re-inserted and do not get hit.  Easily fixed by reducing code
duplication; tested x86_64-linux and committed.

-- 
Daniel Jacobowitz
CodeSourcery

2007-07-02  Daniel Jacobowitz  <dan@codesourcery.com>

	* breakpoint.c (reattach_breakpoints): Do not use remove_breakpoint.
	Call insert_bp_location.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.253
diff -u -p -r1.253 breakpoint.c
--- breakpoint.c	13 Jun 2007 17:59:50 -0000	1.253
+++ breakpoint.c	2 Jul 2007 16:12:30 -0000
@@ -1338,23 +1338,19 @@ reattach_breakpoints (int pid)
   struct bp_location *b;
   int val;
   struct cleanup *old_chain = save_inferior_ptid ();
+  struct ui_file *tmp_error_stream = mem_fileopen ();
+  int dummy1 = 0, dummy2 = 0, dummy3 = 0;
+
+  make_cleanup_ui_file_delete (tmp_error_stream);
 
-  /* Set inferior_ptid; remove_breakpoint uses this global.  */
   inferior_ptid = pid_to_ptid (pid);
   ALL_BP_LOCATIONS (b)
   {
     if (b->inserted)
       {
-	remove_breakpoint (b, mark_inserted);
-	/* Note: since we insert a breakpoint right after removing,
-	   any decisions about automatically using hardware breakpoints
-	   made in insert_bp_location are preserved.  */
-	if (b->loc_type == bp_loc_hardware_breakpoint)
-	  val = target_insert_hw_breakpoint (&b->target_info);
-	else
-	  val = target_insert_breakpoint (&b->target_info);
-	/* FIXME drow/2003-10-07: This doesn't handle any other kinds of
-	   breakpoints.  It's wrong for watchpoints, for example.  */
+	b->inserted = 0;
+	val = insert_bp_location (b, tmp_error_stream,
+				  &dummy1, &dummy2, &dummy3);
 	if (val != 0)
 	  {
 	    do_cleanups (old_chain);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]