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: [patchv2] Write bpt at the ON_STACK bpt address


On 07/26/2012 10:23 PM, Jan Kratochvil wrote:
>> But it sounds like this is forcing GDB to have insider knowledge of
>> > valgrind.
> As you were asking to put there 'int3' (and not 'hlt') the user convenience
> coincidentally matches here with what Philippe asks for valgrind.
> 
> 
> I am only concerned a bit about this change arcross all archs for 7.5.
> Maybe 7.5 could limit this patch only for i386/x86_64 which is well
> understood.

FWIW, the patch looks good to me, and I don't think that
limiting to x86 is necessary: the instruction should never
be executed; and we're already writing to the stack using functions
that throw, one more write should be any different.  If that fails,
the other writes would too.

> +	/* Write a legitimate instruction at the point where the infcall
> +	   breakpoint is going to be inserted.  While this instruction
> +	   is never going to be executed, a user investigating the
> +	   memory from GDB would see this instruction instead of random
> +	   uninitialized bytes.  We chose the breakpoint instruction
> +	   just because it may look as the most logical one to the user.
> +
> +	   If software breakpoints are unsupported for this target we
> +	   leave the user visible memory content uninitialized.  */
> +

IMO, this comment should also mention that in addition to being nice for
the user, this is actually _necessary_ for at least Valgrind v XXX.YYY.

-- 
Pedro Alves


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