From: Joel Dice <dicej@mailsnare.net>
To: Yang Zhang <yanghatespam@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Customizing uncaught exception messages
Date: Thu, 15 May 2008 14:46:00 -0000 [thread overview]
Message-ID: <alpine.DEB.0.999.0805150805390.18814@joeldicepc.ecovate.com> (raw)
In-Reply-To: <482BD231.4040401@gmail.com>
On Thu, 15 May 2008, Yang Zhang wrote:
> Hi, is it possible to get more informative error messages for uncaught
> exceptions? For instance, I'm interested in getting Java-like tracebacks
> with file and line numbers. Currently what I see is far from that, e.g.:
>
> terminate called after throwing an instance of 'std::logic_error'
> what(): basic_string::_S_construct NULL not valid
>
> Is there any way to hook into the exception handling mechanisms and produce
> such a traceback? If the solution is platform-dependent, I am using
> GNU/Linux with gcc 4.2.3.
In cases where the exception is thrown by your own code, you may be able
to use backtrace() and backtrace_symbols(), declared in execinfo.h, to
capture the stack trace before unwinding. Then use addr2line (a command
line utility included in binutils) to get the line numbers.
next prev parent reply other threads:[~2008-05-15 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-15 7:16 Yang Zhang
2008-05-15 9:48 ` me22
2008-05-15 15:40 ` Yang Zhang
2008-05-15 14:46 ` Joel Dice [this message]
2008-05-15 16:01 ` Yang Zhang
2008-05-15 16:05 ` Ian Lance Taylor
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=alpine.DEB.0.999.0805150805390.18814@joeldicepc.ecovate.com \
--to=dicej@mailsnare.net \
--cc=gcc-help@gcc.gnu.org \
--cc=yanghatespam@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).