From 2e96cc932d0bc7f24ed491e7b6e2c56879d9a139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 12 Dec 2020 21:23:38 +0100 Subject: [PATCH] ExprEngine; Improved debug output, show constraints. --- lib/exprengine.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/exprengine.cpp b/lib/exprengine.cpp index 639284d20..300fe693d 100644 --- a/lib/exprengine.cpp +++ b/lib/exprengine.cpp @@ -339,7 +339,7 @@ namespace { } void ifSplit(const Token *tok, unsigned int thenIndex, unsigned int elseIndex) { - mMap[tok].push_back("Split. Then:" + std::to_string(thenIndex) + " Else:" + std::to_string(elseIndex)); + mMap[tok].push_back(std::to_string(thenIndex) + ": Split. Then:" + std::to_string(thenIndex) + " Else:" + std::to_string(elseIndex)); } private: @@ -534,13 +534,17 @@ namespace { return; const SymbolDatabase * const symbolDatabase = tokenizer->getSymbolDatabase(); std::ostringstream s; - s << mDataIndex << ":" << "{"; + s << mDataIndex << ":" << "memory:{"; + bool first = true; for (auto mem : memory) { ExprEngine::ValuePtr value = mem.second; const Variable *var = symbolDatabase->getVariableFromVarId(mem.first); if (!var) continue; - s << " " << var->name() << "="; + if (!first) + s << " "; + first = false; + s << var->name() << "="; if (!value) s << "(null)"; else if (value->name[0] == '$' && value->getSymbolicExpression() != value->name) @@ -549,6 +553,18 @@ namespace { s << value->name; } s << "}"; + + if (!constraints.empty()) { + s << " constraints:{"; + first = true; + for (auto constraint: constraints) { + if (!first) + s << " "; + first = false; + s << constraint->getSymbolicExpression(); + } + s << "}"; + } mTrackExecution->state(tok, s.str()); }