]> git.cworth.org Git - apitrace/blobdiff - common/trace_model.hpp
common: carve out RawStackFrame::dump
[apitrace] / common / trace_model.hpp
index 36f0a03eff83cb15d5919fb86b661eb0cd271513..ba7c845362e55fdc5aae14fe42a4597fada84e49 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <map>
 #include <vector>
+#include <ostream>
 
 
 namespace trace {
@@ -388,6 +389,22 @@ struct RawStackFrame {
         offset(-1)
     {
     }
+
+    void dump(std::ostream &os) {
+        os << (this->module ? this->module : "?");
+        if (this->function != NULL) {
+            os << ": " << this->function;
+        }
+        if (this->offset >= 0) {
+            os << "+0x" << std::hex << this->offset << std::dec;
+        }
+        if (this->filename != NULL) {
+            os << ": " << this->filename;
+            if (this->linenumber >= 0) {
+                os << ":" << this->linenumber;
+            }
+        }
+    }
 };
 
 class StackFrame : public RawStackFrame {