X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_model.hpp;h=36f0a03eff83cb15d5919fb86b661eb0cd271513;hb=75af867d17044b6e3992e579c35915e35d2a7e78;hp=fbfa1fbbc989102710a5e4a99cc3eb48a259b9a0;hpb=69909e3853c23d0ce062b6c9f232191970da9aee;p=apitrace diff --git a/common/trace_model.hpp b/common/trace_model.hpp index fbfa1fb..36f0a03 100644 --- a/common/trace_model.hpp +++ b/common/trace_model.hpp @@ -41,6 +41,10 @@ namespace trace { +// Should match Call::no +typedef unsigned CallNo; + + typedef unsigned Id; @@ -87,6 +91,9 @@ struct BitmaskSig { class Visitor; +class Null; +class Struct; +class Array; class Value @@ -106,6 +113,15 @@ public: virtual unsigned long long toUIntPtr(void) const; virtual const char *toString(void) const; + virtual const Null *toNull(void) const { return NULL; } + virtual Null *toNull(void) { return NULL; } + + virtual const Array *toArray(void) const { return NULL; } + virtual Array *toArray(void) { return NULL; } + + virtual const Struct *toStruct(void) const { return NULL; } + virtual Struct *toStruct(void) { return NULL; } + const Value & operator[](size_t index) const; }; @@ -123,6 +139,9 @@ public: unsigned long long toUIntPtr(void) const; const char *toString(void) const; void visit(Visitor &visitor); + + const Null *toNull(void) const { return this; } + Null *toNull(void) { return this; } }; @@ -262,6 +281,9 @@ public: bool toBool(void) const; void visit(Visitor &visitor); + const Struct *toStruct(void) const { return this; } + Struct *toStruct(void) { return this; } + const StructSig *sig; std::vector members; }; @@ -276,6 +298,9 @@ public: bool toBool(void) const; void visit(Visitor &visitor); + const Array *toArray(void) const { return this; } + Array *toArray(void) { return this; } + std::vector values; inline size_t @@ -348,30 +373,30 @@ public: void visit(Visitor &visitor); }; -class StackFrame { -public: - String* module; - String* function; - String* filename; - String* linenumber; - String* offset; - StackFrame() : - module(NULL), - function(NULL), - filename(NULL), - linenumber(NULL), - offset(NULL) - {} - ~StackFrame(); +struct RawStackFrame { + Id id; + const char * module; + const char * function; + const char * filename; + int linenumber; + long long offset; + RawStackFrame() : + module(0), + function(0), + filename(0), + linenumber(-1), + offset(-1) + { + } }; -class Backtrace { +class StackFrame : public RawStackFrame { public: - std::vector frames; - ~Backtrace(); - void addFrame(StackFrame* frame); + ~StackFrame(); }; +typedef std::vector Backtrace; + class Visitor { public: