This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [i386] Put hlt at the ON_STACK breakpoint [Re: GDB 7.4.91 available for testing]
- From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Joel Brobecker <brobecker at adacore dot com>, gdb-patches at sourceware dot org, Pedro Alves <palves at redhat dot com>
- Date: Mon, 23 Jul 2012 22:07:27 +0200
- Subject: Re: [patch] [i386] Put hlt at the ON_STACK breakpoint [Re: GDB 7.4.91 available for testing]
- References: <20120718163413.GA17548@adacore.com> <1342739016.2220.32.camel@soleil> <20120720071158.GA7053@host2.jankratochvil.net> <1342817409.2149.41.camel@soleil> <20120722173053.GA22036@host2.jankratochvil.net> <1342983655.2301.55.camel@soleil> <20120723072125.GA12958@host2.jankratochvil.net> <20120723155951.GA24718@adacore.com> <20120723163513.GA1222@host2.jankratochvil.net>
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,
Philippe