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

e1d87d
Index: gdb-7.99.90.20170420/gdb/breakpoint.c
e1d87d
===================================================================
e1d87d
--- gdb-7.99.90.20170420.orig/gdb/breakpoint.c	2017-04-20 23:04:39.627960523 +0200
e1d87d
+++ gdb-7.99.90.20170420/gdb/breakpoint.c	2017-04-20 23:07:29.854919725 +0200
e1d87d
@@ -16086,6 +16086,50 @@
e1d87d
 static struct cmd_list_element *enablebreaklist = NULL;
e1d87d
 
e1d87d
 void
e1d87d
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
e1d87d
+{
e1d87d
+  struct bp_location *bl, **blp_tmp;
e1d87d
+  int changed = 0;
e1d87d
+
e1d87d
+  gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
e1d87d
+
e1d87d
+  ALL_BP_LOCATIONS (bl, blp_tmp)
e1d87d
+    {
e1d87d
+      struct obj_section *osect;
e1d87d
+
e1d87d
+      /* BL->SECTION can be correctly NULL for breakpoints with multiple
e1d87d
+         locations expanded through symtab.  */
e1d87d
+
e1d87d
+      ALL_OBJFILE_OSECTIONS (objfile, osect)
e1d87d
+	{
e1d87d
+	  CORE_ADDR relocated_address;
e1d87d
+	  CORE_ADDR delta_offset;
e1d87d
+
e1d87d
+	  delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
e1d87d
+	  if (delta_offset == 0)
e1d87d
+	    continue;
e1d87d
+	  relocated_address = bl->address + delta_offset;
e1d87d
+
e1d87d
+	  if (obj_section_addr (osect) <= relocated_address
e1d87d
+	      && relocated_address < obj_section_endaddr (osect))
e1d87d
+	    {
e1d87d
+	      if (bl->inserted)
e1d87d
+		remove_breakpoint (bl);
e1d87d
+
e1d87d
+	      bl->address += delta_offset;
e1d87d
+	      bl->requested_address += delta_offset;
e1d87d
+
e1d87d
+	      changed = 1;
e1d87d
+	    }
e1d87d
+	}
e1d87d
+    }
e1d87d
+
e1d87d
+  if (changed)
e1d87d
+    qsort (bp_locations, bp_locations_count, sizeof (*bp_locations),
e1d87d
+	   bp_locations_compare);
e1d87d
+}
e1d87d
+
e1d87d
+void
e1d87d
 _initialize_breakpoint (void)
e1d87d
 {
e1d87d
   struct cmd_list_element *c;
e1d87d
Index: gdb-7.99.90.20170420/gdb/breakpoint.h
e1d87d
===================================================================
e1d87d
--- gdb-7.99.90.20170420.orig/gdb/breakpoint.h	2017-04-20 23:04:39.627960523 +0200
e1d87d
+++ gdb-7.99.90.20170420/gdb/breakpoint.h	2017-04-20 23:04:48.331009563 +0200
e1d87d
@@ -1646,4 +1646,7 @@
e1d87d
    UIOUT iff debugging multiple threads.  */
e1d87d
 extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
e1d87d
 
e1d87d
+extern void breakpoints_relocate (struct objfile *objfile,
e1d87d
+				  struct section_offsets *delta);
e1d87d
+
e1d87d
 #endif /* !defined (BREAKPOINT_H) */
e1d87d
Index: gdb-7.99.90.20170420/gdb/objfiles.c
e1d87d
===================================================================
e1d87d
--- gdb-7.99.90.20170420.orig/gdb/objfiles.c	2017-04-20 23:04:39.627960523 +0200
e1d87d
+++ gdb-7.99.90.20170420/gdb/objfiles.c	2017-04-20 23:04:48.332009569 +0200
e1d87d
@@ -909,6 +909,11 @@
e1d87d
 				obj_section_addr (s));
e1d87d
     }
e1d87d
 
e1d87d
+  /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
e1d87d
+     their addresses match.  */
e1d87d
+  if (objfile->separate_debug_objfile_backlink == NULL)
e1d87d
+    breakpoints_relocate (objfile, delta);
e1d87d
+
e1d87d
   /* Data changed.  */
e1d87d
   return 1;
e1d87d
 }