Blame SOURCES/gdb-archer-pie-addons-keep-disabled.patch

01917d
Index: gdb-7.5.50.20130215/gdb/breakpoint.c
01917d
===================================================================
01917d
--- gdb-7.5.50.20130215.orig/gdb/breakpoint.c	2013-02-15 22:31:37.000000000 +0100
01917d
+++ gdb-7.5.50.20130215/gdb/breakpoint.c	2013-02-15 22:37:08.216381988 +0100
01917d
@@ -16020,6 +16020,50 @@ initialize_breakpoint_ops (void)
01917d
 static struct cmd_list_element *enablebreaklist = NULL;
01917d
 
01917d
 void
01917d
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
01917d
+{
01917d
+  struct bp_location *bl, **blp_tmp;
01917d
+  int changed = 0;
01917d
+
01917d
+  gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
01917d
+
01917d
+  ALL_BP_LOCATIONS (bl, blp_tmp)
01917d
+    {
01917d
+      struct obj_section *osect;
01917d
+
01917d
+      /* BL->SECTION can be correctly NULL for breakpoints with multiple
01917d
+         locations expanded through symtab.  */
01917d
+
01917d
+      ALL_OBJFILE_OSECTIONS (objfile, osect)
01917d
+	{
01917d
+	  CORE_ADDR relocated_address;
01917d
+	  CORE_ADDR delta_offset;
01917d
+
01917d
+	  delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
01917d
+	  if (delta_offset == 0)
01917d
+	    continue;
01917d
+	  relocated_address = bl->address + delta_offset;
01917d
+
01917d
+	  if (obj_section_addr (osect) <= relocated_address
01917d
+	      && relocated_address < obj_section_endaddr (osect))
01917d
+	    {
01917d
+	      if (bl->inserted)
01917d
+		remove_breakpoint (bl, mark_uninserted);
01917d
+
01917d
+	      bl->address += delta_offset;
01917d
+	      bl->requested_address += delta_offset;
01917d
+
01917d
+	      changed = 1;
01917d
+	    }
01917d
+	}
01917d
+    }
01917d
+
01917d
+  if (changed)
01917d
+    qsort (bp_location, bp_location_count, sizeof (*bp_location),
01917d
+	   bp_location_compare);
01917d
+}
01917d
+
01917d
+void
01917d
 _initialize_breakpoint (void)
01917d
 {
01917d
   struct cmd_list_element *c;
01917d
Index: gdb-7.5.50.20130215/gdb/breakpoint.h
01917d
===================================================================
01917d
--- gdb-7.5.50.20130215.orig/gdb/breakpoint.h	2013-02-03 16:57:06.000000000 +0100
01917d
+++ gdb-7.5.50.20130215/gdb/breakpoint.h	2013-02-15 22:37:19.025395693 +0100
01917d
@@ -1556,4 +1556,7 @@ extern void handle_solib_event (void);
01917d
 
01917d
 extern void breakpoint_free_objfile (struct objfile *objfile);
01917d
 
01917d
+extern void breakpoints_relocate (struct objfile *objfile,
01917d
+				  struct section_offsets *delta);
01917d
+
01917d
 #endif /* !defined (BREAKPOINT_H) */
01917d
Index: gdb-7.5.50.20130215/gdb/objfiles.c
01917d
===================================================================
01917d
--- gdb-7.5.50.20130215.orig/gdb/objfiles.c	2013-02-03 16:57:07.000000000 +0100
01917d
+++ gdb-7.5.50.20130215/gdb/objfiles.c	2013-02-15 22:37:08.217381990 +0100
01917d
@@ -831,6 +831,11 @@ objfile_relocate1 (struct objfile *objfi
01917d
     objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
01917d
 						    new_offsets, delta);
01917d
 
01917d
+  /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
01917d
+     their addresses match.  */
01917d
+  if (objfile->separate_debug_objfile_backlink == NULL)
01917d
+    breakpoints_relocate (objfile, delta);
01917d
+
01917d
   /* Data changed.  */
01917d
   return 1;
01917d
 }