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

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