X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Ftrace_writer.hpp;h=a46b43edc487f15faff6f22bc68fade0a57924fa;hb=4f9982f5ec3dccae65d5a49dfd5a81b9737d90cd;hp=dfb76b2508a4bac02f455b9d570cc733c5492f9a;hpb=ae2b4d32ed56e3ac193cc7205aeb58082c448ce8;p=apitrace diff --git a/common/trace_writer.hpp b/common/trace_writer.hpp index dfb76b2..a46b43e 100644 --- a/common/trace_writer.hpp +++ b/common/trace_writer.hpp @@ -38,7 +38,7 @@ #include "trace_model.hpp" -namespace Trace { +namespace trace { class File; class Writer { @@ -58,7 +58,7 @@ namespace Trace { bool open(const char *filename); void close(void); - unsigned beginEnter(const FunctionSig *sig); + unsigned beginEnter(const FunctionSig *sig, unsigned thread_id); void endEnter(void); void beginLeave(unsigned call); @@ -79,6 +79,9 @@ namespace Trace { void beginStruct(const StructSig *sig); inline void endStruct(void) {} + void beginRepr(void); + inline void endRepr(void) {} + void writeBool(bool value); void writeSInt(signed long long value); void writeUInt(unsigned long long value); @@ -88,10 +91,10 @@ namespace Trace { void writeString(const char *str, size_t size); void writeWString(const wchar_t *str); void writeBlob(const void *data, size_t size); - void writeEnum(const EnumSig *sig); + void writeEnum(const EnumSig *sig, signed long long value); void writeBitmask(const BitmaskSig *sig, unsigned long long value); void writeNull(void); - void writeOpaque(const void *ptr); + void writePointer(unsigned long long addr); void writeCall(Call *call); @@ -105,41 +108,6 @@ namespace Trace { }; - /** - * A specialized Writer class, mean to trace the current process. - * - * In particular: - * - it creates a trace file based on the current process name - * - uses mutexes to allow tracing from multiple threades - * - flushes the output to ensure the last call is traced in event of - * abnormal termination - */ - class LocalWriter : public Writer { - protected: - int acquired; - - public: - /** - * Should never called directly -- use localWriter singleton below instead. - */ - LocalWriter(); - ~LocalWriter(); - - void open(void); - - unsigned beginEnter(const FunctionSig *sig); - void endEnter(void); - - void beginLeave(unsigned call); - void endLeave(void); - - void flush(void); - }; - - /** - * Singleton. - */ - extern LocalWriter localWriter; -} +} /* namespace trace */ #endif /* _TRACE_WRITER_HPP_ */