2017-12-10 22:00:49 +00:00
|
|
|
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: gdb-archer-pie-addons-keep-disabled.patch
|
|
|
|
|
|
|
|
FileName: gdb-archer-pie-addons-keep-disabled.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;;=push+jan: Breakpoints disabling matching should not be based on address.
|
|
|
|
---
|
|
|
|
gdb/breakpoint.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
gdb/breakpoint.h | 3 +++
|
|
|
|
gdb/objfiles.c | 5 +++++
|
|
|
|
3 files changed, 52 insertions(+)
|
2017-12-04 19:24:00 +00:00
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
2017-12-18 17:28:39 +00:00
|
|
|
index b68718d250..bfe92f679f 100644
|
2017-12-08 04:31:26 +00:00
|
|
|
--- a/gdb/breakpoint.c
|
|
|
|
+++ b/gdb/breakpoint.c
|
2017-12-18 17:28:39 +00:00
|
|
|
@@ -15590,6 +15590,50 @@ initialize_breakpoint_ops (void)
|
2017-12-08 04:31:26 +00:00
|
|
|
|
2013-01-19 22:41:55 +00:00
|
|
|
static struct cmd_list_element *enablebreaklist = NULL;
|
2012-01-03 15:00:12 +00:00
|
|
|
|
2017-12-08 04:31:26 +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)
|
2016-08-29 07:50:02 +00:00
|
|
|
+ remove_breakpoint (bl);
|
2010-01-12 22:15:57 +00:00
|
|
|
+
|
|
|
|
+ bl->address += delta_offset;
|
|
|
|
+ bl->requested_address += delta_offset;
|
|
|
|
+
|
|
|
|
+ changed = 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (changed)
|
2017-04-21 12:47:41 +00:00
|
|
|
+ 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
|
|
|
+
|
2017-12-08 04:31:26 +00:00
|
|
|
void
|
2011-07-22 22:41:56 +00:00
|
|
|
_initialize_breakpoint (void)
|
2012-01-03 15:00:12 +00:00
|
|
|
{
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
|
|
|
|
index 6406a1d32b..eed2c968f2 100644
|
|
|
|
--- a/gdb/breakpoint.h
|
|
|
|
+++ b/gdb/breakpoint.h
|
|
|
|
@@ -1656,6 +1656,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg);
|
2016-01-22 18:00:27 +00:00
|
|
|
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);
|
|
|
|
+
|
2017-12-08 04:31:26 +00:00
|
|
|
/* Print the specified breakpoint. */
|
|
|
|
extern void print_breakpoint (breakpoint *bp);
|
|
|
|
|
|
|
|
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
|
|
|
index edde399802..1d24fa95ba 100644
|
|
|
|
--- a/gdb/objfiles.c
|
|
|
|
+++ b/gdb/objfiles.c
|
|
|
|
@@ -879,6 +879,11 @@ objfile_relocate1 (struct objfile *objfile,
|
2014-06-19 20:14:32 +00:00
|
|
|
obj_section_addr (s));
|
|
|
|
}
|
2010-01-16 22:32:10 +00:00
|
|
|
|
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);
|
|
|
|
+
|
2010-01-16 22:32:10 +00:00
|
|
|
/* Data changed. */
|
|
|
|
return 1;
|
2010-01-12 22:15:57 +00:00
|
|
|
}
|
2017-12-08 04:31:26 +00:00
|
|
|
--
|
|
|
|
2.14.3
|
|
|
|
|