本文整理汇总了C++中ExecutionState::addressSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ ExecutionState::addressSpace方法的具体用法?C++ ExecutionState::addressSpace怎么用?C++ ExecutionState::addressSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExecutionState
的用法示例。
在下文中一共展示了ExecutionState::addressSpace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: callUnmodelledFunction
void Executor::callUnmodelledFunction(ExecutionState &state,
KInstruction *target,
llvm::Function *function,
std::vector<ref<Expr> > &arguments) {
if (NoExternals && !okExternals.count(function->getName())) {
std::cerr << "KLEE:ERROR: Calling not-OK external function : "
<< function->getName().str() << "\n";
terminateStateOnError(state, "externals disallowed", "user.err");
return;
}
// normal external function handling path
// allocate 128 bits for each argument (+return value) to support fp80's;
// we could iterate through all the arguments first and determine the exact
// size we need, but this is faster, and the memory usage isn't significant.
uint64_t *args = (uint64_t*) alloca(2*sizeof(*args) * (arguments.size() + 1));
memset(args, 0, 2 * sizeof(*args) * (arguments.size() + 1));
unsigned wordIndex = 2;
for (std::vector<ref<Expr> >::iterator ai = arguments.begin(),
ae = arguments.end(); ai!=ae; ++ai) {
if (AllowExternalSymCalls) { // don't bother checking uniqueness
ref<ConstantExpr> ce;
bool success = solver->getValue(data::EXTERNAL_CALL_CONCRETIZATION, state, *ai, ce);
assert(success && "FIXME: Unhandled solver failure");
(void) success;
ce->toMemory(&args[wordIndex]);
wordIndex += (ce->getWidth()+63)/64;
} else {
ref<Expr> arg = toUnique(state, *ai);
if (ConstantExpr *ce = dyn_cast<ConstantExpr>(arg)) {
// XXX kick toMemory functions from here
ce->toMemory(&args[wordIndex]);
wordIndex += (ce->getWidth()+63)/64;
} else {
terminateStateOnExecError(state,
"external call with symbolic argument: " +
function->getName());
return;
}
}
}
state.addressSpace().copyOutConcretes(&state.addressPool);
if (!SuppressExternalWarnings) {
std::ostringstream os;
os << state <<
" Calling external: " << function->getName().str() << "(";
for (unsigned i=0; i<arguments.size(); i++) {
os << arguments[i];
if (i != arguments.size()-1)
os << ", ";
}
os << ")";
VLOG(1) << os.str().c_str();
}
bool success = externalDispatcher->executeCall(function, target->inst, args);
if (!success) {
terminateStateOnError(state, "failed external call: " + function->getName(),
"external.err");
return;
}
if (!state.addressSpace().copyInConcretes(&state.addressPool)) {
terminateStateOnError(state, "external modified read-only object",
"external.err");
return;
}
Type *resultType = target->inst->getType();
if (resultType != Type::getVoidTy(getGlobalContext())) {
ref<Expr> e = ConstantExpr::fromMemory((void*) args,
getWidthForLLVMType(resultType));
bindLocal(target, state, e);
}
}