This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Timer
- From: Pedro Alves <palves at redhat dot com>
- To: Marc Brünink <marc at nus dot edu dot sg>
- Cc: Doug Evans <dje at google dot com>, gdb <gdb at sourceware dot org>
- Date: Tue, 07 May 2013 11:51:08 +0100
- Subject: Re: Timer
- References: <A941B6D9-B0CA-4EC2-AEFE-476014555337 at nus dot edu dot sg> <CADPb22Q0rQCQMee992CZBPHkjJOvBkCZMhqHx0V_y7v=VWDORA at mail dot gmail dot com> <52771B43-9617-412D-B9F8-5730757D6BAF at nus dot edu dot sg> <5188BFC1 dot 8090607 at redhat dot com> <AC3E31D9-B46C-423D-B414-F3C50C0896A9 at nus dot edu dot sg>
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