Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <Michael.Snyder@palmsource.com>
To: Michael FIG <michael-dated-1177036471.79d946@fig.org>
Cc: gdb@sourceware.org
Subject: Re: debugging a program that uses SIGTRAP
Date: Wed, 21 Mar 2007 18:51:00 -0000	[thread overview]
Message-ID: <1174503093.30660.31.camel@localhost.localdomain> (raw)
In-Reply-To: <7qtzwfuxxk.fsf@babe.fig.org>

On Tue, 2007-03-20 at 20:34 -0600, Michael FIG wrote:
> Thanks for the swift reply!
> 
> Daniel Jacobowitz <drow@false.org> writes:
> 
> > I don't see any good way to solve this.  You've got two sets of
> > breakpoints and they're both going to stop GDB - it doesn't know which
> > ones you want and which you don't.
> 
> Okay.  I thought somehow GDB would pass SIGTRAP iff it knows it has
> not set a breakpoint on the current instruction pointer by scanning
> its list of breakpoints.
> 
> > Even if you get past that point, your handler will now get called
> > every time GDB hits a breakpoint or single steps - single stepping
> > will probably be broken.
> 
> Would the above suggestion be reasonable?  I think it would behave
> nicer than what I have now, especially for my circumstance, since
> there isn't any overlap between the code I'm trying to debug and the
> code _it's_ trying to debug.
> 
> If it does seem reasonable, I can look into creating a patch.  I
> haven't gotten my hands dirty in GDB before. :)

Michael, rather than telling gdb to always pass SIGTRAP
(handle SIGTRAP pass), or modifying gdb, you might be able
to debug at least a simple case (say, where there are only
a few non-breakpoint traps) by explicitly telling gdb to
pass the SIGTRAP on a case by case basis:

    Program received signal SIGTRAP, Trace/breakpoint trap.
    (gdb) signal SIGTRAP
    Continuing with signal SIGTRAP.

If you expect a lot of events, there is a little-known 
feature called a hook.  You can put a hook on the "stop"
event, and have it do something to recognize your events.
Perhaps you can maintain your own list of locations.

    (gdb) define hook-stop
    > if in-my-list
      > signal SIGTRAP
      > end
    > end




      parent reply	other threads:[~2007-03-21 18:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21  2:06 Michael FIG
2007-03-21  2:18 ` Daniel Jacobowitz
2007-03-21  2:34   ` Michael FIG
2007-03-21 11:14     ` Daniel Jacobowitz
2007-03-23  4:30       ` Michael FIG
2007-03-21 14:14     ` Joel Brobecker
2007-03-21 18:51     ` Michael Snyder [this message]

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=1174503093.30660.31.camel@localhost.localdomain \
    --to=michael.snyder@palmsource.com \
    --cc=gdb@sourceware.org \
    --cc=michael-dated-1177036471.79d946@fig.org \
    /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