This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] mem-break: Fix breakpoint insertion location


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]