From: Doug Evans <dje@google.com>
To: "Marc Brünink" <marc@nus.edu.sg>
Cc: gdb <gdb@sourceware.org>
Subject: Re: Timer
Date: Tue, 07 May 2013 04:43:00 -0000 [thread overview]
Message-ID: <CADPb22Q0rQCQMee992CZBPHkjJOvBkCZMhqHx0V_y7v=VWDORA@mail.gmail.com> (raw)
In-Reply-To: <A941B6D9-B0CA-4EC2-AEFE-476014555337@nus.edu.sg>
On Mon, May 6, 2013 at 2:52 AM, Marc Brünink <marc@nus.edu.sg> wrote:
> I want to execute a piece of code at regular intervals. Actually I'm sampling $pc.
> (let's not go into detail why I use gdb)
>
> My current solution just starts another process that sends a SIGTRAP to the debugged application. Using a simple script I can print the $pc.
>
> However, I just realised that this approach does not work too well. If gdb is stopped due to a breakpoint it will interpret the received SIGTRAP as another hit of the very same breakpoint.
>
> Reproduce:
> 1. Attach to any program
> 2. Create any breakpoint
> 3. Wait until breakpoint is hit
> 4. Send SIGTRAP to debugged application
> 5. continue
>
> Actually, now that I think about it, I should have anticipated this behaviour.
> Is there a better way to execute a piece of code at regular intervals?
bash$ man setitimer
?
next prev parent reply other threads:[~2013-05-07 4:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-06 9:52 Timer Marc Brünink
2013-05-07 4:43 ` Doug Evans [this message]
2013-05-07 6:42 ` Timer Marc Brünink
2013-05-07 8:48 ` Timer Pedro Alves
2013-05-07 10:18 ` Timer Marc Brünink
2013-05-07 10:51 ` Timer Pedro Alves
2013-05-07 13:44 ` Timer Tom Tromey
2013-05-07 13:28 ` Timer Phil Muldoon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADPb22Q0rQCQMee992CZBPHkjJOvBkCZMhqHx0V_y7v=VWDORA@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb@sourceware.org \
--cc=marc@nus.edu.sg \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox