#include <iostream>
#include <list>
-#include <string>
+#include <set>
+#include "trace_file.hpp"
#include "trace_format.hpp"
#include "trace_model.hpp"
namespace Trace {
-
class Parser
{
protected:
- void *file;
+ File *file;
typedef std::list<Call *> CallList;
CallList calls;
- typedef std::vector<Call::Signature *> FunctionMap;
+ typedef std::vector<FunctionSig *> FunctionMap;
FunctionMap functions;
- typedef std::vector<Struct::Signature *> StructMap;
+ typedef std::vector<StructSig *> StructMap;
StructMap structs;
- typedef std::vector<Enum::Signature *> EnumMap;
+ typedef std::vector<EnumSig *> EnumMap;
EnumMap enums;
- typedef std::vector<Bitmask::Signature *> BitmaskMap;
+ typedef std::vector<BitmaskSig *> BitmaskMap;
BitmaskMap bitmasks;
+ typedef std::set<File::Offset> TraceOffsets;
+ TraceOffsets m_callSigOffsets;
+ TraceOffsets m_structSigOffsets;
+ TraceOffsets m_enumSigOffsets;
+ TraceOffsets m_bitmaskSigOffsets;
+
+ typedef std::map<File::Offset, unsigned> CallNumOffsets;
+ CallNumOffsets m_callNumOffsets;
+
unsigned next_call_no;
public:
Call *parse_call(void);
+ bool supportsOffsets() const
+ {
+ return file->supportsOffsets();
+ }
+
+ File::Offset currentOffset()
+ {
+ return file->currentOffset();
+ }
+
+ void setCurrentOffset(const File::Offset &offset)
+ {
+ file->setCurrentOffset(offset);
+ }
+
+ bool callWithSignature(const File::Offset &offset) const;
+ bool structWithSignature(const File::Offset &offset) const;
+ bool enumWithSignature(const File::Offset &offset) const;
+ bool bitmaskWithSignature(const File::Offset &offset) const;
+
+ unsigned currentCallNumber() const
+ {
+ return next_call_no;
+ }
+
+ void setCurrentCallNumber(unsigned num)
+ {
+ next_call_no = num;
+ }
+
protected:
void parse_enter(void);
Value *parse_opaque();
- std::string read_string(void);
+ const char * read_string(void);
unsigned long long read_uint(void);