This is the mail archive of the 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] [i386] Put hlt at the ON_STACK breakpoint [Re: GDB 7.4.91 available for testing]

On Mon, 2012-07-23 at 18:35 +0200, Jan Kratochvil wrote:
> On Mon, 23 Jul 2012 17:59:51 +0200, Joel Brobecker wrote:
> > It even seems to me that this should be done on all platforms, no?
> Yes; just looking at the other archs it was not trivial to me so I wanted to
> be sure it at least really helps valgrind.

Yes, that will help.

To avoid the need for the "grow" guess, Valgrind gdbsrv will need both
the Z0 packet (so as to have the breakpoint helperc inserted at
translation time) and the breakpoint trap instruction (to avoid
encountering random instruction when translating the instructions
on the stack).

Valgrind decoder stops decoding when it encounters the trap
instruction. So, writing the trap instruction + Z0 packet is good
enough, there is no need for an hlt instruction (but I see no problem
of having this hlt instruction).

Note that the trap instruction should only be written by the
push_dummy_code function : for Normal breakpoints, only a Z0 packet
should be done, as Valgrind will not allow to modify the guest
executable code (it is not mapped writable). 

I will currently not commit the "grow guess" patch in Valgrind, waiting
to see if the above approach is done in GDB (as this is a lot cleaner
that the "grow guess", which is a somewhat fragile heuristic kludge).

Thanks for all that,


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