From: José Fonseca Date: Thu, 22 Nov 2012 14:46:06 +0000 (+0000) Subject: retrace: Dump call number on exceptions. X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=00611a483a0a531272ba5810b77fb5d293db1723 retrace: Dump call number on exceptions. --- diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp index 27ff2b4..a59ee9a 100644 --- a/retrace/retrace_main.cpp +++ b/retrace/retrace_main.cpp @@ -545,6 +545,13 @@ longOptions[] = { {0, 0, 0, 0} }; + +static void exceptionCallback(void) +{ + std::cerr << retrace::callNo << ": error: caught an unhandled exception\n"; +} + + extern "C" int main(int argc, char **argv) { @@ -645,6 +652,8 @@ int main(int argc, char **argv) retrace::profiler.setup(retrace::profilingCpuTimes, retrace::profilingGpuTimes, retrace::profilingPixelsDrawn); } + os::setExceptionCallback(exceptionCallback); + for (i = optind; i < argc; ++i) { if (!retrace::parser.open(argv[i])) { return 1; @@ -654,6 +663,8 @@ int main(int argc, char **argv) retrace::parser.close(); } + + os::resetExceptionCallback(); // XXX: X often hangs on XCloseDisplay //retrace::cleanUp();