Re: Debugging GCC STL: Debugger break instead of abort?
Re: Debugging GCC STL: Debugger break instead of abort?
- Subject: Re: Debugging GCC STL: Debugger break instead of abort?
- From: Wim Lewis <email@hidden>
- Date: Mon, 13 Mar 2006 11:28:55 -0800
On 8 Mar, 2006, at 4:51 AM, Thomas Engelmeier wrote:
Sounds pretty basic, but how does one set an breakpoint related to
STL debugging (_GLIBCXX_DEBUG) errors? The error might be within my
main application or one of the 10 loaded Plug-Ins.
I tried to:
- set an breakpoint in safe_iterator.h
- set breakpoints in the relevant functions of formatter.h
but I don't get an break into the debugger. Is there an better
place to put an breakpoint? abort()? Or did I miss some
customizable behavior of the GCC STL?
Since I haven't seen a reply, I'll post a random suggestion. It's
possible to set custom handlers for C++'s terminate and unexpected-
exception routines. Maybe the assertions you're hitting call these
handlers, or maybe there's a similarly replaceable handler for the
assertion failure ... seems worth a try:
#include <exception> // See /usr/include/c++/4.0.0/exception for info
static std::terminate_handler previousTerminationHandler;
static std::unexpected_handler previousUnexpectedHandler;
static void exampleTerminationHandler(void)
{
// Do something more useful than aborting
// Maybe call __gnu_cxx::__verbose_terminate_handler()
// Maybe call previousTerminationHandler
}
static void exampleUnexpectedHandler(void)
{
// Do something more useful than aborting
// Maybe call the previousUnexpectedHandler afterwards
}
void InstallHandler_CPlusPlus(void)
{
previousTerminationHandler = std::set_terminate
(&exampleTerminationHandler);
previousUnexpectedHandler = std::set_unexpected
(&exampleUnexpectedHandler);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden