|
|
7bc85d |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
7bc85d |
From: Fedora GDB patches <invalid@email.com>
|
|
|
7bc85d |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
7bc85d |
Subject: gdb-archer-pie-addons-keep-disabled.patch
|
|
|
7bc85d |
|
|
|
7bc85d |
;;=push+jan: Breakpoints disabling matching should not be based on address.
|
|
|
7bc85d |
|
|
|
7bc85d |
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
|
|
7bc85d |
--- a/gdb/breakpoint.c
|
|
|
7bc85d |
+++ b/gdb/breakpoint.c
|
|
|
ce65b8 |
@@ -15523,6 +15523,50 @@ initialize_breakpoint_ops (void)
|
|
|
7bc85d |
static struct cmd_list_element *enablebreaklist = NULL;
|
|
|
7bc85d |
|
|
|
ce65b8 |
void
|
|
|
7bc85d |
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
|
|
|
7bc85d |
+{
|
|
|
7bc85d |
+ struct bp_location *bl, **blp_tmp;
|
|
|
7bc85d |
+ int changed = 0;
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ ALL_BP_LOCATIONS (bl, blp_tmp)
|
|
|
7bc85d |
+ {
|
|
|
7bc85d |
+ struct obj_section *osect;
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ /* BL->SECTION can be correctly NULL for breakpoints with multiple
|
|
|
7bc85d |
+ locations expanded through symtab. */
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
|
|
|
7bc85d |
+ {
|
|
|
7bc85d |
+ CORE_ADDR relocated_address;
|
|
|
7bc85d |
+ CORE_ADDR delta_offset;
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ delta_offset = ANOFFSET (delta, osect->the_bfd_section->index);
|
|
|
7bc85d |
+ if (delta_offset == 0)
|
|
|
7bc85d |
+ continue;
|
|
|
7bc85d |
+ relocated_address = bl->address + delta_offset;
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ if (obj_section_addr (osect) <= relocated_address
|
|
|
7bc85d |
+ && relocated_address < obj_section_endaddr (osect))
|
|
|
7bc85d |
+ {
|
|
|
7bc85d |
+ if (bl->inserted)
|
|
|
7bc85d |
+ remove_breakpoint (bl);
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ bl->address += delta_offset;
|
|
|
7bc85d |
+ bl->requested_address += delta_offset;
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ changed = 1;
|
|
|
7bc85d |
+ }
|
|
|
7bc85d |
+ }
|
|
|
7bc85d |
+ }
|
|
|
7bc85d |
+
|
|
|
7bc85d |
+ if (changed)
|
|
|
7bc85d |
+ qsort (bp_locations, bp_locations_count, sizeof (*bp_locations),
|
|
|
7bc85d |
+ bp_locations_compare);
|
|
|
7bc85d |
+}
|
|
|
7bc85d |
+
|
|
|
ce65b8 |
+void
|
|
|
7bc85d |
_initialize_breakpoint (void)
|
|
|
7bc85d |
{
|
|
|
ce65b8 |
struct cmd_list_element *c;
|
|
|
7bc85d |
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
|
|
|
7bc85d |
--- a/gdb/breakpoint.h
|
|
|
7bc85d |
+++ b/gdb/breakpoint.h
|
|
|
7bc85d |
@@ -1679,6 +1679,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
|
|
|
7bc85d |
UIOUT iff debugging multiple threads. */
|
|
|
7bc85d |
extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout);
|
|
|
7bc85d |
|
|
|
7bc85d |
+extern void breakpoints_relocate (struct objfile *objfile,
|
|
|
7bc85d |
+ struct section_offsets *delta);
|
|
|
7bc85d |
+
|
|
|
7bc85d |
/* Print the specified breakpoint. */
|
|
|
7bc85d |
extern void print_breakpoint (breakpoint *bp);
|
|
|
7bc85d |
|
|
|
7bc85d |
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
|
|
7bc85d |
--- a/gdb/objfiles.c
|
|
|
7bc85d |
+++ b/gdb/objfiles.c
|
|
|
7bc85d |
@@ -883,6 +883,11 @@ objfile_relocate1 (struct objfile *objfile,
|
|
|
7bc85d |
obj_section_addr (s));
|
|
|
7bc85d |
}
|
|
|
7bc85d |
|
|
|
7bc85d |
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
|
|
|
7bc85d |
+ their addresses match. */
|
|
|
7bc85d |
+ if (objfile->separate_debug_objfile_backlink == NULL)
|
|
|
7bc85d |
+ breakpoints_relocate (objfile, delta);
|
|
|
7bc85d |
+
|
|
|
7bc85d |
/* Data changed. */
|
|
|
7bc85d |
return 1;
|
|
|
7bc85d |
}
|