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: Save the length of inserted breakpoints


On Fri, Mar 03, 2006 at 07:41:37PM +0200, Eli Zaretskii wrote:
> > Date: Fri, 3 Mar 2006 09:11:24 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
> > 
> > That patch allows us to guess whether completely unknown code is ARM or
> > Thumb.  If we are guessing based on target state and user settings,
> > rather than from the symbol table as we do now, it's possible for
> > the guess to change between when a breakpoint is inserted and when
> > it is removed.  If that happens, we can try to remove a four byte
> > breakpoint as if it were a two byte breakpoint, which will lead
> > to memory corruption.
> 
> Can't this be done ion the target-dependent code?  Why do we need to
> know, on the GDB application level, how many bytes did the breakpoint
> instruction take?

Because the target vector is told to remove breakpoints given only
an address and an opaque shadow-contents buffer big enough to hold
what may have been overwritten in memory.

The change of breakpoint size happens in architecture-specific code,
but the insertion and removal happens in target-specific code.

If every target cached the size of inserted breakpoints and made sure
to remove them at the same size, that would work too, but right now
most targets don't need to remember anything about the breakpoints
they've inserted; the common layer of GDB handles it.

-- 
Daniel Jacobowitz
CodeSourcery


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