CompareDump: fix reporting bugs. The top stack entry was missing (!) and we had an off-by-one in the index computation.

Also, all of this should be rewritten from scratch.
pull/515/head
Alexander Gessler 2015-03-28 12:51:46 +01:00 committed by Alexander Gessler
parent e0dd061dcb
commit e2addcee77
1 changed files with 4 additions and 4 deletions

View File

@ -134,7 +134,7 @@ public:
if(it != history.back().second.end()) { if(it != history.back().second.end()) {
++history.back().second[s]; ++history.back().second[s];
} }
else history.back().second[s] = 1; else history.back().second[s] = 0;
history.push_back(HistoryEntry(s,PerChunkCounter())); history.push_back(HistoryEntry(s,PerChunkCounter()));
debug_trace.push_back("PUSH " + s); debug_trace.push_back("PUSH " + s);
@ -244,10 +244,10 @@ private:
const char* last = history.back().first.c_str(); const char* last = history.back().first.c_str();
std::string pad; std::string pad;
for(ChunkHistory::reverse_iterator rev = ++history.rbegin(), for(ChunkHistory::reverse_iterator rev = history.rbegin(),
end = history.rend(); rev < end; ++rev, pad += " ") end = history.rend(); rev != end; ++rev, pad += " ")
{ {
ss << pad << (*rev).first << "(Index: " << (*rev).second[last]-1 << ")" << std::endl; ss << pad << (*rev).first << "(Index: " << (*rev).second[last] << ")" << std::endl;
last = (*rev).first.c_str(); last = (*rev).first.c_str();
} }