This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] mem-break: Fix breakpoint insertion location
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- 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 14:57:48 +0100
- Subject: Re: [PATCH] mem-break: Fix breakpoint insertion location
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.00.1708011707230.29991@tp.orcam.me.uk> <172ea7a987fae99d7438bee77a704c76@polymtl.ca>
On Fri, 4 Aug 2017, Simon Marchi wrote:
> On 2017-08-01 18:36, Maciej W. Rozycki wrote:
> > 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
> > 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_size has to be used for the initialization.
[...]
> IIUC, we end up writing the good breakpoint kind, but at the wrong address?
> For example, if the requested address is 0x1001, it means that there should be
> a micro/compressed MIPS breakpoint at address 0x1000, but that bug caused the
> breakpoint to be written at address 0x1001 instead. Is that right?
Exactly!
Moreover, as the breakpoint is removed the original instruction bytes
will be written back to 0x1000, further corrupting the executable, as
`default_memory_remove_breakpoint' already correctly uses
`->placed_address'.
I can see now that I incorrectly wrote `->placed_size' across the patch
description where I meant `->placed_address'. I'll correct that and
repost the patch with PR annotation additionally included.
Maciej