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

f9426a
Index: gdb-7.7.50.20140609/gdb/breakpoint.c
f9426a
===================================================================
f9426a
--- gdb-7.7.50.20140609.orig/gdb/breakpoint.c	2014-06-13 20:24:34.564667225 +0200
f9426a
+++ gdb-7.7.50.20140609/gdb/breakpoint.c	2014-06-13 20:24:35.650668351 +0200
f9426a
@@ -16364,6 +16364,50 @@ initialize_breakpoint_ops (void)
f9426a
 static struct cmd_list_element *enablebreaklist = NULL;
f9426a
 
f9426a
 void
f9426a
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
f9426a
+{
f9426a
+  struct bp_location *bl, **blp_tmp;
f9426a
+  int changed = 0;
f9426a
+
f9426a
+  gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
f9426a
+
f9426a
+  ALL_BP_LOCATIONS (bl, blp_tmp)
f9426a
+    {
f9426a
+      struct obj_section *osect;
f9426a
+
f9426a
+      /* BL->SECTION can be correctly NULL for breakpoints with multiple
f9426a
+         locations expanded through symtab.  */
f9426a
+
f9426a
+      ALL_OBJFILE_OSECTIONS (objfile, osect)
f9426a
+	{
f9426a
+	  CORE_ADDR relocated_address;
f9426a
+	  CORE_ADDR delta_offset;
f9426a
+
f9426a
+	  delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
f9426a
+	  if (delta_offset == 0)
f9426a
+	    continue;
f9426a
+	  relocated_address = bl->address + delta_offset;
f9426a
+
f9426a
+	  if (obj_section_addr (osect) <= relocated_address
f9426a
+	      && relocated_address < obj_section_endaddr (osect))
f9426a
+	    {
f9426a
+	      if (bl->inserted)
f9426a
+		remove_breakpoint (bl, mark_uninserted);
f9426a
+
f9426a
+	      bl->address += delta_offset;
f9426a
+	      bl->requested_address += delta_offset;
f9426a
+
f9426a
+	      changed = 1;
f9426a
+	    }
f9426a
+	}
f9426a
+    }
f9426a
+
f9426a
+  if (changed)
f9426a
+    qsort (bp_location, bp_location_count, sizeof (*bp_location),
f9426a
+	   bp_location_compare);
f9426a
+}
f9426a
+
f9426a
+void
f9426a
 _initialize_breakpoint (void)
f9426a
 {
f9426a
   struct cmd_list_element *c;
f9426a
Index: gdb-7.7.50.20140609/gdb/breakpoint.h
f9426a
===================================================================
f9426a
--- gdb-7.7.50.20140609.orig/gdb/breakpoint.h	2014-06-13 20:24:34.566667227 +0200
f9426a
+++ gdb-7.7.50.20140609/gdb/breakpoint.h	2014-06-13 20:24:35.651668352 +0200
f9426a
@@ -1553,4 +1553,7 @@ extern void breakpoint_free_objfile (str
f9426a
 
f9426a
 extern char *ep_parse_optional_if_clause (char **arg);
f9426a
 
f9426a
+extern void breakpoints_relocate (struct objfile *objfile,
f9426a
+				  struct section_offsets *delta);
f9426a
+
f9426a
 #endif /* !defined (BREAKPOINT_H) */
f9426a
Index: gdb-7.7.50.20140609/gdb/objfiles.c
f9426a
===================================================================
f9426a
--- gdb-7.7.50.20140609.orig/gdb/objfiles.c	2014-06-13 20:24:35.652668353 +0200
f9426a
+++ gdb-7.7.50.20140609/gdb/objfiles.c	2014-06-13 20:25:10.867704891 +0200
f9426a
@@ -820,6 +820,11 @@ objfile_relocate1 (struct objfile *objfi
f9426a
 				obj_section_addr (s));
f9426a
     }
f9426a
 
f9426a
+  /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
f9426a
+     their addresses match.  */
f9426a
+  if (objfile->separate_debug_objfile_backlink == NULL)
f9426a
+    breakpoints_relocate (objfile, delta);
f9426a
+
f9426a
   /* Data changed.  */
f9426a
   return 1;
f9426a
 }