]> git.tdb.fi Git - libs/core.git/commitdiff
Improve BackTrace printing
authorMikko Rasa <tdb@tdb.fi>
Sun, 24 Aug 2008 21:35:30 +0000 (21:35 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sun, 24 Aug 2008 21:35:30 +0000 (21:35 +0000)
source/core/application.cpp
source/debug/backtrace.cpp
source/debug/backtrace.h

index cc9946cb32c7410a3f8e30fbd568728b55ee2c82..82134df90af16cba7fcab8457819c9cad5a55902 100644 (file)
@@ -78,12 +78,7 @@ 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
 
index 5e96005538eed6830bcb87b6e0e967467aa4af2b..fe7dbffcd51a39216c783bdcd47f7d2bb45200dd 100644 (file)
@@ -52,7 +52,17 @@ ostream &operator<<(ostream &out, const Backtrace &bt)
 {
        const Backtrace::FrameSeq &frames=bt.get_frames();
        for(Backtrace::FrameSeq::const_iterator i=frames.begin(); i!=frames.end(); ++i)
-               out<<i->address<<" in "<<i->symbol<<" from "<<i->file<<'\n';
+               out<<*i<<'\n';
+
+       return out;
+}
+
+ostream &operator<<(ostream &out, const Backtrace::StackFrame &sf)
+{
+       out<<sf.address;
+       if(!sf.symbol.empty())
+               out<<" in "<<sf.symbol;
+       out<<" from "<<sf.file;
 
        return out;
 }
index 9715df0ed8026c395af1cf1b865b1fc9b4ba4a64..6ba3ad1b0d297a5b9ad9e705f2b1d6740a2f9e78 100644 (file)
@@ -35,6 +35,7 @@ private:
 };
 
 std::ostream &operator<<(std::ostream &, const Backtrace &);
+std::ostream &operator<<(std::ostream &, const Backtrace::StackFrame &);
 
 } // namespace Debug
 } // namespace Msp