This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Harden gdb.base/bp-permanent.exp
- From: Pedro Alves <palves at redhat dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>, "'gdb-patches at sourceware dot org'" <gdb-patches at sourceware dot org>
- Date: Fri, 10 Apr 2015 15:15:26 +0100
- Subject: Re: [PATCH] Harden gdb.base/bp-permanent.exp
- Authentication-results: sourceware.org; auth=none
- References: <5526B296 dot 8040000 at codesourcery dot com> <5527A047 dot 1030201 at redhat dot com> <5527D804 dot 10709 at codesourcery dot com>
On 04/10/2015 03:02 PM, Luis Machado wrote:
> On 04/10/2015 07:04 AM, Pedro Alves wrote:
>> On 04/09/2015 06:10 PM, Luis Machado wrote:
>> unsupported "Cannot access memory"
>>
>
> Did you mean untested here also?
No.
>> I'm thinking it'd be good to adjust the test to hardcode the
>> breakpoint instruction (on an arch by arch basis, leaving the
>> current generic code in place), as it'd be good to test
>> stepping past permanent/program trap instructions
>> on QEMU/Valgrind, etc. too.
>
> Originally i had modified the testcase so it would write the breakpoint
> on its own based on what memcpy read before. We could still use this
> mechanism so we don't need to hardcode per-arch breakpoint patterns.
> What is your idea?
Then we'd have somehow made .text writable, or copy the instructions
somewhere else we can write, and execute them there. Either way
sounds like we'd lose portability.
My idea was just around something like:
#ifdef __i386__
# define BP int3
#else if __aarch64__
# define BP ...
#else
# define BP NOP
#endif
and then in .exp file, if the breakpoint address
still has a NOP, do the probing magic, otherwise, skip it.
Thanks,
Pedro Alves