Timer

Pedro Alves palves@redhat.com
Tue May 7 10:51:00 GMT 2013


On 05/07/2013 11:18 AM, Marc Brünink wrote:

>> You could also use another signal instead of SIGTRAP.
> 
> Yes, this is probably the way to go. However, I remember having some issues with different signals. Esp if an applications depends on the delivery of a signal and I use it to implement the timer interrupt. But I suppose using SIGPROF or something similar should be fine.
> 
>>
>>>> bash$ man setitimer
>>>
>>> I suppose you are suggesting to modify either GDB or the application. This is exactly what I don't want. Any other way to accomplish this (using gdb)?
>>
>> You could use LD_PRELOAD to inject a library that uses setitimer into your program.
> 
> Possible, but contradicts the gdb-only approach. 

Well, so does the "way to go" above.  :-)

>> I guess you could do it with gdb python scripting too.
> 
> This would be nice but does not work. As far as I remember there is a sigsupend in linux-nat.c which will thwart using a simple threading.Timer. But I might be wrong here. Whatever the reason, it does not work.

GDB's event loop supports timer events.  I guess those could be hooked up
to python gdb somehow.  (you'd need to use "set target-async".)  But
that'd require changing gdb...

-- 
Pedro Alves



More information about the Gdb mailing list