本文整理汇总了C++中SymbolicExpression::setExpression方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolicExpression::setExpression方法的具体用法?C++ SymbolicExpression::setExpression怎么用?C++ SymbolicExpression::setExpression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolicExpression
的用法示例。
在下文中一共展示了SymbolicExpression::setExpression方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runtime_error
SymbolicVariable *SymbolicEngine::convertRegToSymVar(uint64 regId, uint64 symVarSize, std::string symVarComment) {
SymbolicVariable *symVar = nullptr;
SymbolicExpression *expression = nullptr;
uint64 regSymId = UNSET;
if (regId >= ID_LAST_ITEM)
throw std::runtime_error("SymbolicEngine::convertRegToSymVar() - Invalid register ID");
regSymId = this->getRegSymbolicID(regId);
if (regSymId == UNSET) {
symVar = this->addSymbolicVariable(SymVar::kind::REG, regId, symVarSize, symVarComment);
smt2lib::smtAstAbstractNode *tmp = smt2lib::variable(symVar->getSymVarName());
if (tmp == nullptr)
throw std::runtime_error("convertRegToSymVar can't create smtAstAbstractNode (nullptr)");
SymbolicExpression *se = this->newSymbolicExpression(tmp);
if (se == nullptr)
throw std::runtime_error("convertRegToSymVar can't create symbolic expression (nullptr)");
this->symbolicReg[regId] = se->getID();
}
else {
expression = this->getExpressionFromId(regSymId);
if (expression == nullptr)
return nullptr;
symVar = this->addSymbolicVariable(SymVar::kind::REG, regId, symVarSize, symVarComment);
expression->setExpression(smt2lib::variable(symVar->getSymVarName()));
}
return symVar;
}
示例2:
/*
* Converts an expression ID to a symbolic variable.
* e.g:
* #43 = (_ bv10 8)
* convertExprToSymVar(43, 8)
* #43 = SymVar_4
*/
SymbolicVariable *SymbolicEngine::convertExprToSymVar(uint64 exprId, uint64 symVarSize, std::string symVarComment) {
SymbolicVariable *symVar = nullptr;
SymbolicExpression *expression = this->getExpressionFromId(exprId);
if (expression == nullptr)
return nullptr;
symVar = this->addSymbolicVariable(SymVar::kind::UNDEF, 0, symVarSize, symVarComment);
expression->setExpression(smt2lib::variable(symVar->getSymVarName()));
return symVar;
}
示例3: runtime_error
SymbolicVariable *SymbolicEngine::convertMemToSymVar(uint64 memAddr, uint64 symVarSize, std::string symVarComment)
{
SymbolicVariable *symVar = nullptr;
SymbolicExpression *expression = nullptr;
uint64 memSymId = UNSET;
memSymId = this->getMemSymbolicID(memAddr);
if (memSymId == UNSET)
throw std::runtime_error("SymbolicEngine::convertMemToSymVar() - This memory address is UNSET");
expression = this->getExpressionFromId(memSymId);
if (expression == nullptr)
return nullptr;
symVar = this->addSymbolicVariable(SymVar::kind::MEM, memAddr, symVarSize, symVarComment);
expression->setExpression(smt2lib::variable(symVar->getSymVarName()));
return symVar;
}