X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_parser.hpp;h=f340da0e72613573aa5ea6d61e0e029779672e29;hb=f562f318ddee6da2041696887e2195fc3c96d740;hp=78ea4273778bcc6489a3863682622a0b43b7527c;hpb=57dbaf5831f6a26df951de609f54910366ed8a48;p=apitrace diff --git a/trace_parser.hpp b/trace_parser.hpp index 78ea427..f340da0 100644 --- a/trace_parser.hpp +++ b/trace_parser.hpp @@ -28,41 +28,49 @@ #include -#include #include -#include +#include +#include "trace_file.hpp" #include "trace_format.hpp" #include "trace_model.hpp" namespace Trace { - class Parser { protected: - void *file; + File *file; typedef std::list CallList; CallList calls; - typedef std::vector FunctionMap; + typedef std::vector FunctionMap; FunctionMap functions; - typedef std::vector StructMap; + typedef std::vector StructMap; StructMap structs; - typedef std::vector EnumMap; + typedef std::vector EnumMap; EnumMap enums; - typedef std::vector BitmaskMap; + typedef std::vector BitmaskMap; BitmaskMap bitmasks; + typedef std::set TraceOffsets; + TraceOffsets m_callSigOffsets; + TraceOffsets m_structSigOffsets; + TraceOffsets m_enumSigOffsets; + TraceOffsets m_bitmaskSigOffsets; + + typedef std::map CallNumOffsets; + CallNumOffsets m_callNumOffsets; + unsigned next_call_no; public: - static unsigned long long version; + unsigned long long version; Parser(); @@ -74,12 +82,42 @@ 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); Call *parse_leave(void); - void parse_call_details(Call *call); + bool parse_call_details(Call *call); void parse_arg(Call *call); @@ -107,7 +145,7 @@ protected: Value *parse_opaque(); - std::string read_string(void); + const char * read_string(void); unsigned long long read_uint(void);