]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/application.cpp
Improve BackTrace printing
[libs/core.git] / source / core / application.cpp
index bcb7e3de49e2cb0b3058844f2559f336cfdc5a50..82134df90af16cba7fcab8457819c9cad5a55902 100644 (file)
@@ -62,6 +62,12 @@ int Application::run(int argc, char **argv, void *data)
        }
        catch(const exception &e)
        {
+               delete app_;
+
+#ifdef WIN32
+               string msg=Debug::demangle(typeid(e).name())+":\n"+e.what();
+               MessageBox(0, msg.c_str(), "Uncaught exception", MB_OK|MB_ICONERROR);
+#else
                cerr<<"An uncaught exception occurred.\n";
                cerr<<"  type:   "<<Debug::demangle(typeid(e).name())<<'\n';
                cerr<<"  what(): "<<e.what()<<'\n';
@@ -72,15 +78,10 @@ int Application::run(int argc, char **argv, void *data)
                        cerr<<"  backtrace:\n";
                        const Debug::Backtrace::FrameSeq &frames=exc->get_backtrace().get_frames();
                        for(Debug::Backtrace::FrameSeq::const_iterator i=frames.begin(); i!=frames.end(); ++i)
-                       {
-                               cerr<<"    "<<i->address;
-                               if(!i->symbol.empty())
-                                       cerr<<" in "<<i->symbol;
-                               cerr<<" from "<<i->file<<'\n';
-                       }
+                               cerr<<"    "<<*i<<'\n';
                }
+#endif
 
-               delete app_;
                return 124;
        }
 }