From: Joshua Haberman <joshua@haberman.com>
To: gdb@sources.redhat.com
Subject: detecting gdb at runtime?
Date: Mon, 12 Apr 2004 21:38:00 -0000 [thread overview]
Message-ID: <E513906C-8CC7-11D8-B993-000A95A886F8@haberman.com> (raw)
Is there any way to detect GDB at runtime?
I am currently experimenting with different ways to handle errors in a
C++ library I am writing. I am using an Assert() macro to verify
conditions throughout the program, much like C's assert() function. I
believe that the best way to respond to a failed assertion is to throw
an exception because it gives the client application a chance to
recover as best it can. However, if the program is running in a
debugger, throwing an exception is sub-optimal because it cannot give
you a stack trace.
My goal is to have my Assert() macro SIGTRAP if a debugger is running
to break into the debugger, otherwise throw an exception. Is there any
way to make this happen?
(Please CC me, I am not subscribed).
Josh Haberman
next reply other threads:[~2004-04-12 21:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-12 21:38 Joshua Haberman [this message]
2004-04-12 21:52 ` Daniel Jacobowitz
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=E513906C-8CC7-11D8-B993-000A95A886F8@haberman.com \
--to=joshua@haberman.com \
--cc=gdb@sources.redhat.com \
/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