keiths / rpms / gdb

Forked from rpms/gdb 3 days ago
Clone
dd46ae6
Index: gdb-7.1.90.20100711/gdb/breakpoint.c
8c4c91e
===================================================================
dd46ae6
--- gdb-7.1.90.20100711.orig/gdb/breakpoint.c	2010-07-12 23:07:33.000000000 +0200
dd46ae6
+++ gdb-7.1.90.20100711/gdb/breakpoint.c	2010-07-13 00:38:04.000000000 +0200
dd46ae6
@@ -10159,6 +10159,50 @@ update_breakpoint_locations (struct brea
0911f37
   update_global_location_list (1);
0911f37
 }
0911f37
 
0911f37
+void
0911f37
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
0911f37
+{
0911f37
+  struct bp_location *bl, **blp_tmp;
0911f37
+  int changed = 0;
0911f37
+
0911f37
+  gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
0911f37
+
0911f37
+  ALL_BP_LOCATIONS (bl, blp_tmp)
0911f37
+    {
0911f37
+      struct obj_section *osect;
0911f37
+
0911f37
+      /* BL->SECTION can be correctly NULL for breakpoints with multiple
0911f37
+         locations expanded through symtab.  */
0911f37
+
0911f37
+      ALL_OBJFILE_OSECTIONS (objfile, osect)
0911f37
+	{
0911f37
+	  CORE_ADDR relocated_address;
0911f37
+	  CORE_ADDR delta_offset;
0911f37
+
0911f37
+	  delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
0911f37
+	  if (delta_offset == 0)
0911f37
+	    continue;
0911f37
+	  relocated_address = bl->address + delta_offset;
0911f37
+
0911f37
+	  if (obj_section_addr (osect) <= relocated_address
0911f37
+	      && relocated_address < obj_section_endaddr (osect))
0911f37
+	    {
0911f37
+	      if (bl->inserted)
0911f37
+		remove_breakpoint (bl, mark_uninserted);
0911f37
+
0911f37
+	      bl->address += delta_offset;
0911f37
+	      bl->requested_address += delta_offset;
0911f37
+
0911f37
+	      changed = 1;
0911f37
+	    }
0911f37
+	}
0911f37
+    }
0911f37
+
0911f37
+  if (changed)
0911f37
+    qsort (bp_location, bp_location_count, sizeof (*bp_location),
8c4c91e
+	   bp_location_compare);
0911f37
+}
dd46ae6
+
0911f37
 /* Reset a breakpoint given it's struct breakpoint * BINT.
0911f37
    The value we return ends up being the return value from catch_errors.
dd46ae6
    Unused in this case.  */
dd46ae6
Index: gdb-7.1.90.20100711/gdb/breakpoint.h
8c4c91e
===================================================================
dd46ae6
--- gdb-7.1.90.20100711.orig/gdb/breakpoint.h	2010-07-12 23:07:33.000000000 +0200
dd46ae6
+++ gdb-7.1.90.20100711/gdb/breakpoint.h	2010-07-13 00:37:34.000000000 +0200
dd46ae6
@@ -1088,4 +1088,7 @@ extern void check_tracepoint_command (ch
dd46ae6
 extern void start_rbreak_breakpoints (void);
dd46ae6
 extern void end_rbreak_breakpoints (void);
0911f37
 
0911f37
+extern void breakpoints_relocate (struct objfile *objfile,
0911f37
+				  struct section_offsets *delta);
0911f37
+
0911f37
 #endif /* !defined (BREAKPOINT_H) */
dd46ae6
Index: gdb-7.1.90.20100711/gdb/objfiles.c
8c4c91e
===================================================================
dd46ae6
--- gdb-7.1.90.20100711.orig/gdb/objfiles.c	2010-05-16 02:46:46.000000000 +0200
dd46ae6
+++ gdb-7.1.90.20100711/gdb/objfiles.c	2010-07-13 00:37:19.000000000 +0200
dd46ae6
@@ -834,6 +834,11 @@ objfile_relocate1 (struct objfile *objfi
0911f37
 				obj_section_addr (s));
0911f37
     }
8c4c91e
 
0911f37
+  /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
0911f37
+     their addresses match.  */
0911f37
+  if (objfile->separate_debug_objfile_backlink == NULL)
0911f37
+    breakpoints_relocate (objfile, delta);
0911f37
+
8c4c91e
   /* Data changed.  */
8c4c91e
   return 1;
0911f37
 }