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: [PATCH] Harden gdb.base/bp-permanent.exp


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


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