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

7a6771
Index: gdb-7.11.90.20160829/gdb/breakpoint.c
7a6771
===================================================================
7a6771
--- gdb-7.11.90.20160829.orig/gdb/breakpoint.c	2016-08-29 09:41:57.054875810 +0200
7a6771
+++ gdb-7.11.90.20160829/gdb/breakpoint.c	2016-08-29 09:45:04.166612376 +0200
7a6771
@@ -16176,6 +16176,50 @@
7a6771
 static struct cmd_list_element *enablebreaklist = NULL;
7a6771
 
7a6771
 void
7a6771
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
7a6771
+{
7a6771
+  struct bp_location *bl, **blp_tmp;
7a6771
+  int changed = 0;
7a6771
+
7a6771
+  gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
7a6771
+
7a6771
+  ALL_BP_LOCATIONS (bl, blp_tmp)
7a6771
+    {
7a6771
+      struct obj_section *osect;
7a6771
+
7a6771
+      /* BL->SECTION can be correctly NULL for breakpoints with multiple
7a6771
+         locations expanded through symtab.  */
7a6771
+
7a6771
+      ALL_OBJFILE_OSECTIONS (objfile, osect)
7a6771
+	{
7a6771
+	  CORE_ADDR relocated_address;
7a6771
+	  CORE_ADDR delta_offset;
7a6771
+
7a6771
+	  delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
7a6771
+	  if (delta_offset == 0)
7a6771
+	    continue;
7a6771
+	  relocated_address = bl->address + delta_offset;
7a6771
+
7a6771
+	  if (obj_section_addr (osect) <= relocated_address
7a6771
+	      && relocated_address < obj_section_endaddr (osect))
7a6771
+	    {
7a6771
+	      if (bl->inserted)
7a6771
+		remove_breakpoint (bl);
7a6771
+
7a6771
+	      bl->address += delta_offset;
7a6771
+	      bl->requested_address += delta_offset;
7a6771
+
7a6771
+	      changed = 1;
7a6771
+	    }
7a6771
+	}
7a6771
+    }
7a6771
+
7a6771
+  if (changed)
7a6771
+    qsort (bp_location, bp_location_count, sizeof (*bp_location),
7a6771
+	   bp_location_compare);
7a6771
+}
7a6771
+
7a6771
+void
7a6771
 _initialize_breakpoint (void)
7a6771
 {
7a6771
   struct cmd_list_element *c;
7a6771
Index: gdb-7.11.90.20160829/gdb/breakpoint.h
7a6771
===================================================================
7a6771
--- gdb-7.11.90.20160829.orig/gdb/breakpoint.h	2016-08-29 09:41:57.054875810 +0200
7a6771
+++ gdb-7.11.90.20160829/gdb/breakpoint.h	2016-08-29 09:42:24.370129320 +0200
7a6771
@@ -1644,4 +1644,7 @@
7a6771
    UIOUT iff debugging multiple threads.  */
7a6771
 extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
7a6771
 
7a6771
+extern void breakpoints_relocate (struct objfile *objfile,
7a6771
+				  struct section_offsets *delta);
7a6771
+
7a6771
 #endif /* !defined (BREAKPOINT_H) */
7a6771
Index: gdb-7.11.90.20160829/gdb/objfiles.c
7a6771
===================================================================
7a6771
--- gdb-7.11.90.20160829.orig/gdb/objfiles.c	2016-08-29 09:41:57.054875810 +0200
7a6771
+++ gdb-7.11.90.20160829/gdb/objfiles.c	2016-08-29 09:42:24.370129320 +0200
7a6771
@@ -916,6 +916,11 @@
7a6771
 				obj_section_addr (s));
7a6771
     }
7a6771
 
7a6771
+  /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
7a6771
+     their addresses match.  */
7a6771
+  if (objfile->separate_debug_objfile_backlink == NULL)
7a6771
+    breakpoints_relocate (objfile, delta);
7a6771
+
7a6771
   /* Data changed.  */
7a6771
   return 1;
7a6771
 }