Re: [patch] [i386] Put hlt at the ON_STACK breakpoint [Re: GDB 7.4.91 available for testing]

Philippe Waroquiers
2012-07-25T20:39:21Z

On Wed, 2012-07-25 at 22:11 +0200, Jan Kratochvil wrote:
> On Wed, 25 Jul 2012 22:04:01 +0200, Philippe Waroquiers wrote:
> > IIUC, Jan's patch was to have GDB storing a hlt after the place
> > where GDBSERVER will put 0xCC.
>
> Not after, all the storage happens for the same byte.
Oops, I misunderstood that.
>
> hlt is stored there by memory write, int3 is stored there by Z0.
>
>
> > What Valgrind needs is to have GDB storing the 0xCC
> > (the hlt will then have no positive nor negative impact on Valgrind).
>
> I will put 0xcc == int3 there although I believe valgrind could decode hlt (or
> even nop) the same way.
I have not found the decoding of the hlt instruction in Valgrind, so
I suspect it might not be supported.

Any valid instruction that will terminate a "Valgrind block" will be ok
there. For sure, the 0xcc is ok. There are other instructions which also
ensures Valgrind stops translating the block (e.g. others "int"
instructions). I think "nop" does not stop the block translation.

So, inserting 0xcc looks more straightforward/natural/safer.

Philippe