Re: Can GDB support "temporal breakpoints"?

Doug Evans <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CADPb22QdQuCi6Ca3Y5EVYXdsdVmq_sKzE91AVkcpAHLO9f80DA@mail.gmail.com>
On Wed, Oct 29, 2014 at 11:55 AM,  <[email protected]> wrote:
> Hello everyone, again,
>
> From what I've learned after reading GDB's excellent documentation, I know I
> can set a memory trigger (i. e., a breakpoint that is set every time a
> certain memory address changes) by setting a watchpoint at the desired
> memory address (a practical example is available here:
> http://stackoverflow.com/questions/58851/can-i-set-a-breakpoint-on-memory-access-in-gdb).
> The question I have now is if I can set a temporal breakpoint (i. e., a
> breakpoint that is only triggered after a user-defined amount of time has
> passed), in few words a breakpoint that is only fired after some kind of
> timer has expired. I haven't found anything related to this on the GDB docs,
> so I guess it's not possible, but they are huge and maybe I've missed
> something, somewhere. If anyone can confirm or deny this deduction, it would
> be great, because this feature is crucial to my work.

Hi.

There is no such thing, per se, but you might be able to approximate it
by a breakpoint on a line of code that only triggers when the time has passed,
or after the breakpoint is hit a certain number of times.

I can also imagine a hack where you run a side program
that sleeps for the specified period of time and it sends SIGUSR1
(or whatever) to the inferior, and then have gdb catch SIGUSR1,
do whatever you want at that time,
and then resume the inferior (discarding the signal).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.