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