This is the mail archive of the gdb-patches@sources.redhat.com 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]

[RFA] breakpoints.c clear_command fix


The clear command improperly detects overlays and fails 
to clear breakpoints if overlays are not disabled.

Tested with linux-x-mips (overlays enabled) and linux x86 native.
-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.

2002-03-26  Martin M. Hunt  <hunt@redhat.com>

	* breakpoint.c (clear_command): Make the first loop 
	through breakpoints use the same conditions as the second.
	Correct both passes to properly detect when a breakpoint 
	is in an overlay.

Index: breakpoint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/breakpoint.c,v
retrieving revision 1.331
diff -u -u -r1.331 breakpoint.c
--- breakpoint.c	2002/03/17 02:37:26	1.331
+++ breakpoint.c	2002/03/26 23:57:10
@@ -6445,24 +6445,20 @@
       sal = sals.sals[i];
       found = (struct breakpoint *) 0;
 
-
       while (breakpoint_chain
-      /* Why don't we check here that this is not
-         a watchpoint, etc., as we do below?
-         I can't make it fail, but don't know
-         what's stopping the failure: a watchpoint
-         of the same address as "sal.pc" should
-         wind up being deleted. */
-
-	     && (((sal.pc && (breakpoint_chain->address == sal.pc)) 
-		  && (!overlay_debugging 
-		      || breakpoint_chain->section == sal.section))
+	     && breakpoint_chain->type != bp_none
+	     && breakpoint_chain->type != bp_watchpoint
+	     && breakpoint_chain->type != bp_hardware_watchpoint
+	     && breakpoint_chain->type != bp_read_watchpoint
+	     && breakpoint_chain->type != bp_access_watchpoint
+	     && (((sal.pc && (breakpoint_chain->address == sal.pc))
+		  && (!section_is_overlay (breakpoint_chain->section)
+		      || section_is_mapped (breakpoint_chain->section)))
 		 || ((default_match || (0 == sal.pc))
 		     && breakpoint_chain->source_file != NULL
 		     && sal.symtab != NULL
-	      && STREQ (breakpoint_chain->source_file, sal.symtab->filename)
+		     && STREQ (breakpoint_chain->source_file, sal.symtab->filename)
 		     && breakpoint_chain->line_number == sal.line)))
-
 	{
 	  b1 = breakpoint_chain;
 	  breakpoint_chain = b1->next;
@@ -6478,14 +6474,13 @@
 	       && b->next->type != bp_read_watchpoint
 	       && b->next->type != bp_access_watchpoint
 	       && (((sal.pc && (b->next->address == sal.pc)) 
-		    && (!overlay_debugging || b->next->section == sal.section))
+		    && (!section_is_overlay (b->next->section)
+			|| section_is_mapped (b->next->section)))
 		   || ((default_match || (0 == sal.pc))
 		       && b->next->source_file != NULL
 		       && sal.symtab != NULL
 		       && STREQ (b->next->source_file, sal.symtab->filename)
 		       && b->next->line_number == sal.line)))
-
-
 	{
 	  b1 = b->next;
 	  b->next = b1->next;


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