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

84 lines
2.6 KiB
Diff
Raw Normal View History

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