This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2] PR breakpoints/21886: mem-break: Fix breakpoint insertion location
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: <gdb-patches at sourceware dot org>, Yao Qi <yao dot qi at linaro dot org>, Joel Brobecker <brobecker at adacore dot com>
- Date: Fri, 4 Aug 2017 15:12:27 +0100
- Subject: [PATCH v2] PR breakpoints/21886: mem-break: Fix breakpoint insertion location
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.00.1708011707230.29991@tp.orcam.me.uk> <86zibf1n5e.fsf@gmail.com>
Fix a commit cd6c3b4ffc4e ("New gdbarch methods breakpoint_kind_from_pc
and sw_breakpoint_from_kind") regression and restore the use of
`->placed_address' rather than `->reqstd_address' as the location for a
memory breakpoint to be inserted at. Previously
`gdbarch_breakpoint_from_pc' was used that made that adjustment in
`default_memory_insert_breakpoint' from the preinitialized value,
however with the said commit that call is gone, so the passed
`->placed_address' has to be used for the initialization.
The regression manifests itself as the inability to debug any MIPS/Linux
compressed ISA dynamic executable as GDB corrupts the dynamic loader
with one of its implicit breakpoints, causing the program to crash, as
seen for example with the `mips-linux-gnu' target, o32 ABI, MIPS16 code,
and the gdb.base/advance.exp test case:
(gdb) continue
Continuing.
Program received signal SIGBUS, Bus error.
_dl_debug_initialize (ldbase=0, ns=0) at dl-debug.c:51
51 r = &_r_debug;
(gdb) FAIL: gdb.base/advance.exp: Can't run to main
gdb/
PR breakpoints/21886
* mem-break.c (default_memory_insert_breakpoint): Use
`->placed_address' rather than `->reqstd_address' for the
breakpoint location.
---
On Fri, 4 Aug 2017, Yao Qi wrote:
> "Maciej W. Rozycki" <macro@imgtec.com> writes:
>
> > Fix a commit cd6c3b4ffc4e ("New gdbarch methods breakpoint_kind_from_pc
> > and sw_breakpoint_from_kind") regression and restore the use of
> > ->placed_size rather than ->reqstd_address as the location for a memory
>
> s/placed_size/placed_address/
Oh, I see you've noticed it too! :)
> The patch looks good to me, but please give me two or three days to run
> the tests on an armv7 board. The board is being used for other tests,
> and I'll start the regression test on Monday next week.
Sure. Here's v2 with an updated description. No changes to the patch
itself.
Maciej
Changes from v1:
- Description corrected, s/->placed_size/->placed_address/,
- Quotation made consistent across the description, e.g.
`->reqstd_address' vs previous ->reqstd_address,
- PR annotation added.
---
gdb/mem-break.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
gdb-mem-break-placed-address.diff
Index: binutils/gdb/mem-break.c
===================================================================
--- binutils.orig/gdb/mem-break.c 2017-07-30 22:45:34.000000000 +0100
+++ binutils/gdb/mem-break.c 2017-07-30 23:41:28.595612206 +0100
@@ -37,7 +37,7 @@ int
default_memory_insert_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr = bp_tgt->reqstd_address;
+ CORE_ADDR addr = bp_tgt->placed_address;
const unsigned char *bp;
gdb_byte *readbuf;
int bplen;