diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-11-25 15:48:46 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-11-25 15:48:46 +0000 |
commit | f4b071e057378a0e8cd0a785a5a396f3bb44a59a (patch) | |
tree | 17b1cd3c515e41c2a87eabedff3f2267aacba7f3 /trace_parser.hpp | |
parent | e0e6140ab6d52e0173a2ed0541102d724cbcce14 (diff) |
Trace parse debugging.
Diffstat (limited to 'trace_parser.hpp')
-rw-r--r-- | trace_parser.hpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/trace_parser.hpp b/trace_parser.hpp index ed9fc7e..6a2c92f 100644 --- a/trace_parser.hpp +++ b/trace_parser.hpp @@ -39,6 +39,9 @@ #include "trace_model.hpp" +#define TRACE_VERBOSE 0 + + namespace Trace { @@ -254,12 +257,17 @@ done: std::string name; size_t id = read_uint(); if (id >= names.size()) { + assert(id == names.size()); name = read_string(); names[id] = name; return name; } else { - return names[id]; + name = names[id]; } +#if TRACE_VERBOSE + std::cerr << "\tNAME " << id << " " << name << "\n"; +#endif + return name; } std::string read_string(void) { @@ -271,8 +279,8 @@ done: gzread(file, buf, len); std::string value(buf, len); delete [] buf; -#ifdef TRACE_VERBOSE - std::cerr << '"' << value << '"' << "\n"; +#if TRACE_VERBOSE + std::cerr << "\tSTRING \"" << value << "\"\n"; #endif return value; } @@ -289,19 +297,19 @@ done: value |= (unsigned long long)(c & 0x7f) << shift; shift += 7; } while(c & 0x80); -#ifdef TRACE_VERBOSE - std::cerr << value << "\n"; +#if TRACE_VERBOSE + std::cerr << "\tUINT " << value << "\n"; #endif return value; } int read_byte(void) { int c = gzgetc(file); -#ifdef TRACE_VERBOSE +#if TRACE_VERBOSE if (c < 0) - std::cerr << "EOF" << "\n"; + std::cerr << "\tEOF" << "\n"; else - std::cerr << "0x" << std::hex << c << "\n"; + std::cerr << "\tBYTE 0x" << std::hex << c << std::dec << "\n"; #endif return c; } |