ExprEngine: Clarify debug output a bit
This commit is contained in:
parent
ff7e99fd42
commit
a7fb946ab8
|
@ -159,22 +159,48 @@ namespace {
|
||||||
|
|
||||||
static std::string str(ExprEngine::ValuePtr val)
|
static std::string str(ExprEngine::ValuePtr val)
|
||||||
{
|
{
|
||||||
const char * const valueTypeStr[] = {
|
const char *typestr;
|
||||||
"UninitValue",
|
switch (val->type) {
|
||||||
"IntRange",
|
case ExprEngine::ValueType::AddressOfValue:
|
||||||
"FloatRange",
|
typestr = "AddressOfValue";
|
||||||
"ConditionalValue",
|
break;
|
||||||
"ArrayValue",
|
case ExprEngine::ValueType::ArrayValue:
|
||||||
"StringLiteralValue",
|
typestr = "ArrayValue";
|
||||||
"StructValue",
|
break;
|
||||||
"AddressOfValue",
|
case ExprEngine::ValueType::UninitValue:
|
||||||
"BinOpResult",
|
typestr = "UninitValue";
|
||||||
"IntegerTruncation",
|
break;
|
||||||
"BailoutValue"
|
case ExprEngine::ValueType::IntRange:
|
||||||
|
typestr = "IntRange";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::FloatRange:
|
||||||
|
typestr = "FloatRange";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::ConditionalValue:
|
||||||
|
typestr = "ConditionalValue";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::StringLiteralValue:
|
||||||
|
typestr = "StringLiteralValue";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::StructValue:
|
||||||
|
typestr = "StructValue";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::BinOpResult:
|
||||||
|
typestr = "BinOpResult";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::IntegerTruncation:
|
||||||
|
typestr = "IntegerTruncation";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::FunctionCallArgumentValues:
|
||||||
|
typestr = "FunctionCallArgumentValues";
|
||||||
|
break;
|
||||||
|
case ExprEngine::ValueType::BailoutValue:
|
||||||
|
typestr = "BailoutValue";
|
||||||
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostringstream ret;
|
std::ostringstream ret;
|
||||||
ret << val->name << "=" << valueTypeStr[(int)val->type] << "(" << val->getRange() << ")";
|
ret << val->name << "=" << typestr << "(" << val->getRange() << ")";
|
||||||
return ret.str();
|
return ret.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +273,7 @@ namespace {
|
||||||
if (mSymbols.find(symbolicExpression) != mSymbols.end())
|
if (mSymbols.find(symbolicExpression) != mSymbols.end())
|
||||||
return;
|
return;
|
||||||
mSymbols.insert(symbolicExpression);
|
mSymbols.insert(symbolicExpression);
|
||||||
mMap[tok].push_back(symbolicExpression + "=" + value->getRange());
|
mMap[tok].push_back(str(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void state(const Token *tok, const std::string &s) {
|
void state(const Token *tok, const std::string &s) {
|
||||||
|
@ -311,6 +337,11 @@ namespace {
|
||||||
const std::set<std::string> getMissingContracts() const {
|
const std::set<std::string> getMissingContracts() const {
|
||||||
return mMissingContracts;
|
return mMissingContracts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *getStatus(int linenr) const {
|
const char *getStatus(int linenr) const {
|
||||||
if (mErrors.find(linenr) != mErrors.end())
|
if (mErrors.find(linenr) != mErrors.end())
|
||||||
|
@ -684,6 +715,10 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ifSplit(const Token *tok, const Data& thenData, const Data& elseData) {
|
||||||
|
thenData.mTrackExecution->ifSplit(tok, thenData.mDataIndex, elseData.mDataIndex);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TrackExecution * const mTrackExecution;
|
TrackExecution * const mTrackExecution;
|
||||||
const int mDataIndex;
|
const int mDataIndex;
|
||||||
|
@ -2401,6 +2436,8 @@ static std::string execute(const Token *start, const Token *end, Data &data)
|
||||||
thenData.addConstraint(condValue, true);
|
thenData.addConstraint(condValue, true);
|
||||||
elseData.addConstraint(condValue, false);
|
elseData.addConstraint(condValue, false);
|
||||||
|
|
||||||
|
Data::ifSplit(tok, thenData, elseData);
|
||||||
|
|
||||||
const Token *thenStart = tok->linkAt(1)->next();
|
const Token *thenStart = tok->linkAt(1)->next();
|
||||||
const Token *thenEnd = thenStart->link();
|
const Token *thenEnd = thenStart->link();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue