namespace trace {
+// Should match Call::no
+typedef unsigned CallNo;
+
+
typedef unsigned Id;
class Visitor;
+class Null;
+class Struct;
+class Array;
class Value
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;
};
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; }
};
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<Value *> members;
};
bool toBool(void) const;
void visit(Visitor &visitor);
+ const Array *toArray(void) const { return this; }
+ Array *toArray(void) { return this; }
+
std::vector<Value *> values;
inline size_t
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<StackFrame*> frames;
- ~Backtrace();
- void addFrame(StackFrame* frame);
+ ~StackFrame();
};
+typedef std::vector<StackFrame *> Backtrace;
+
class Visitor
{
public: