32#include "llvm/IR/Constants.h"
33#include "llvm/IR/DataLayout.h"
34#include "llvm/IR/Function.h"
35#include "llvm/IR/Instructions.h"
36#include "llvm/IR/Intrinsics.h"
37#include "llvm/IR/LLVMContext.h"
38#include "llvm/IR/Module.h"
39#include "llvm/IR/Operator.h"
40#include "llvm/Support/raw_ostream.h"
47static std::string
PrintValue(
const Value *value,
bool truncate =
false) {
49 raw_string_ostream rso(s);
53 s.resize(s.length() - 1);
56 while ((offset = s.find(
'\n')) != s.npos)
58 while (s[0] ==
' ' || s[0] ==
'\t')
64static std::string
PrintType(
const Type *type,
bool truncate =
false) {
66 raw_string_ostream rso(s);
70 s.resize(s.length() - 1);
75 const llvm::Function *called_function = call->getCalledFunction();
80 if (called_function->isIntrinsic()) {
81 switch (called_function->getIntrinsicID()) {
84 case llvm::Intrinsic::dbg_declare:
85 case llvm::Intrinsic::dbg_value:
95 typedef std::map<const Value *, lldb::addr_t>
ValueMap;
100 const BasicBlock *
m_bb =
nullptr;
102 BasicBlock::const_iterator
m_ii;
103 BasicBlock::const_iterator
m_ie;
128 void Jump(
const BasicBlock *bb) {
140 ValueMap::iterator i =
m_values.find(value);
145 ss.
Printf(
" 0x%llx", (
unsigned long long)addr);
159 type_size = PowerOf2Ceil(type_size);
161 scalar = value.zextOrTrunc(type_size * 8);
167 const Constant *constant = dyn_cast<Constant>(value);
170 if (constant->getValueID() == Value::ConstantFPVal) {
171 if (
auto *cfp = dyn_cast<ConstantFP>(constant)) {
172 if (cfp->getType()->isDoubleTy())
173 scalar = cfp->getValueAPF().convertToDouble();
174 else if (cfp->getType()->isFloatTy())
175 scalar = cfp->getValueAPF().convertToFloat();
191 size_t value_size =
m_target_data.getTypeStoreSize(value->getType());
197 value_size, extract_error);
203 if (value_size <= 8) {
204 Type *ty = value->getType();
205 if (ty->isDoubleTy()) {
206 scalar = value_extractor.
GetDouble(&offset);
208 }
else if (ty->isFloatTy()) {
209 scalar = value_extractor.
GetFloat(&offset);
212 uint64_t u64value = value_extractor.
GetMaxU64(&offset, value_size);
229 Type *vty = value->getType();
230 if (vty->isFloatTy() || vty->isDoubleTy()) {
231 cast_scalar = scalar;
239 size_t value_byte_size =
m_target_data.getTypeStoreSize(value->getType());
258 switch (constant->getValueID()) {
261 case Value::FunctionVal:
262 if (
const Function *constant_func = dyn_cast<Function>(constant)) {
264 bool missing_weak =
false;
272 case Value::ConstantIntVal:
273 if (
const ConstantInt *constant_int = dyn_cast<ConstantInt>(constant)) {
274 value = constant_int->getValue();
278 case Value::ConstantFPVal:
279 if (
const ConstantFP *constant_fp = dyn_cast<ConstantFP>(constant)) {
280 value = constant_fp->getValueAPF().bitcastToAPInt();
284 case Value::ConstantExprVal:
285 if (
const ConstantExpr *constant_expr =
286 dyn_cast<ConstantExpr>(constant)) {
287 switch (constant_expr->getOpcode()) {
290 case Instruction::IntToPtr:
291 case Instruction::PtrToInt:
292 case Instruction::BitCast:
294 case Instruction::GetElementPtr: {
295 ConstantExpr::const_op_iterator op_cursor = constant_expr->op_begin();
296 ConstantExpr::const_op_iterator op_end = constant_expr->op_end();
298 Constant *base = dyn_cast<Constant>(*op_cursor);
308 if (op_cursor == op_end)
311 SmallVector<Value *, 8> indices(op_cursor, op_end);
313 cast<GEPOperator>(constant_expr)->getSourceElementType();
320 const bool is_signed =
true;
321 value += APInt(value.getBitWidth(), offset, is_signed);
328 case Value::ConstantPointerNullVal:
329 if (isa<ConstantPointerNull>(constant)) {
359 LLDB_LOGF(log,
"Made an allocation for argument %s",
361 LLDB_LOGF(log,
" Data region : %llx", (
unsigned long long)address);
363 (
unsigned long long)data_address);
370 APInt resolved_value;
375 size_t constant_size =
m_target_data.getTypeStoreSize(constant->getType());
381 resolved_value.zextOrTrunc(llvm::NextPowerOf2(constant_size) * 8));
398 ret -= (ret % byte_alignment);
424 return std::string(
"<couldn't read data>");
428 for (
size_t i = 0; i < length; i++) {
429 if ((!(i & 0xf)) && i)
430 ss.
Printf(
"%02hhx - ", buf.GetBytes()[i]);
432 ss.
Printf(
"%02hhx ", buf.GetBytes()[i]);
439 ValueMap::iterator i =
m_values.find(value);
448 if (
const Constant *constant = dyn_cast<Constant>(value)) {
462 "Interpreter doesn't handle one of the expression's opcodes";
464 "Interpreter doesn't handle one of the expression's operands";
466 "Interpreter encountered an internal error";
468 "Interpreter couldn't resolve a value during execution";
470 "Interpreter couldn't allocate memory";
475 "Interpreter doesn't handle modules with multiple function bodies.";
478 switch (constant->getValueID()) {
481 case Value::ConstantIntVal:
482 case Value::ConstantFPVal:
483 case Value::FunctionVal:
485 case Value::ConstantExprVal:
486 if (
const ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(constant)) {
487 switch (constant_expr->getOpcode()) {
490 case Instruction::IntToPtr:
491 case Instruction::PtrToInt:
492 case Instruction::BitCast:
494 case Instruction::GetElementPtr: {
496 ConstantExpr::const_op_iterator op_cursor = constant_expr->op_begin();
497 Constant *base = dyn_cast<Constant>(*op_cursor);
502 for (Value *op : make_range(constant_expr->op_begin() + 1,
503 constant_expr->op_end())) {
504 ConstantInt *constant_int = dyn_cast<ConstantInt>(op);
514 case Value::ConstantPointerNullVal:
521 const bool support_function_calls) {
524 bool saw_function_with_body =
false;
525 for (Function &f : module) {
526 if (f.begin() != f.end()) {
527 if (saw_function_with_body) {
528 LLDB_LOGF(log,
"More than one function in the module has a body");
529 error.SetErrorToGenericError();
533 saw_function_with_body =
true;
534 LLDB_LOGF(log,
"Saw function with body: %s", f.getName().str().c_str());
538 for (BasicBlock &bb : function) {
539 for (Instruction &ii : bb) {
540 switch (ii.getOpcode()) {
543 error.SetErrorToGenericError();
547 case Instruction::Add:
548 case Instruction::Alloca:
549 case Instruction::BitCast:
550 case Instruction::Br:
551 case Instruction::PHI:
553 case Instruction::Call: {
554 CallInst *call_inst = dyn_cast<CallInst>(&ii);
557 error.SetErrorToGenericError();
563 LLDB_LOGF(log,
"Unsupported instruction: %s",
565 error.SetErrorToGenericError();
570 case Instruction::GetElementPtr:
572 case Instruction::FCmp:
573 case Instruction::ICmp: {
574 CmpInst *cmp_inst = dyn_cast<CmpInst>(&ii);
577 error.SetErrorToGenericError();
582 switch (cmp_inst->getPredicate()) {
584 LLDB_LOGF(log,
"Unsupported ICmp predicate: %s",
587 error.SetErrorToGenericError();
591 case CmpInst::FCMP_OEQ:
592 case CmpInst::ICMP_EQ:
593 case CmpInst::FCMP_UNE:
594 case CmpInst::ICMP_NE:
595 case CmpInst::FCMP_OGT:
596 case CmpInst::ICMP_UGT:
597 case CmpInst::FCMP_OGE:
598 case CmpInst::ICMP_UGE:
599 case CmpInst::FCMP_OLT:
600 case CmpInst::ICMP_ULT:
601 case CmpInst::FCMP_OLE:
602 case CmpInst::ICMP_ULE:
603 case CmpInst::ICMP_SGT:
604 case CmpInst::ICMP_SGE:
605 case CmpInst::ICMP_SLT:
606 case CmpInst::ICMP_SLE:
610 case Instruction::And:
611 case Instruction::AShr:
612 case Instruction::IntToPtr:
613 case Instruction::PtrToInt:
614 case Instruction::Load:
615 case Instruction::LShr:
616 case Instruction::Mul:
617 case Instruction::Or:
618 case Instruction::Ret:
619 case Instruction::SDiv:
620 case Instruction::SExt:
621 case Instruction::Shl:
622 case Instruction::SRem:
623 case Instruction::Store:
624 case Instruction::Sub:
625 case Instruction::Trunc:
626 case Instruction::UDiv:
627 case Instruction::URem:
628 case Instruction::Xor:
629 case Instruction::ZExt:
631 case Instruction::FAdd:
632 case Instruction::FSub:
633 case Instruction::FMul:
634 case Instruction::FDiv:
638 for (
unsigned oi = 0, oe = ii.getNumOperands(); oi != oe; ++oi) {
639 Value *operand = ii.getOperand(oi);
640 Type *operand_type = operand->getType();
642 switch (operand_type->getTypeID()) {
645 case Type::FixedVectorTyID:
646 case Type::ScalableVectorTyID: {
647 LLDB_LOGF(log,
"Unsupported operand type: %s",
658 if (operand_type->getPrimitiveSizeInBits() > 64) {
659 LLDB_LOGF(log,
"Unsupported operand type: %s",
665 if (Constant *constant = llvm::dyn_cast<Constant>(operand)) {
667 LLDB_LOGF(log,
"Unsupported constant: %s",
681 llvm::ArrayRef<lldb::addr_t> args,
691 raw_string_ostream oss(s);
693 module.print(oss,
nullptr);
697 LLDB_LOGF(log,
"Module as passed in to IRInterpreter::Interpret: \n\"%s\"",
701 DataLayout data_layout(&module);
707 error.SetErrorString(
"Couldn't allocate stack frame");
712 for (llvm::Function::arg_iterator ai = function.arg_begin(),
713 ae = function.arg_end();
714 ai != ae; ++ai, ++arg_index) {
715 if (args.size() <=
static_cast<size_t>(arg_index)) {
716 error.SetErrorString(
"Not enough arguments passed in to function");
727 frame.
Jump(&function.front());
729 while (frame.
m_ii != frame.
m_ie && (++num_insts < 4096)) {
730 const Instruction *inst = &*frame.
m_ii;
734 switch (inst->getOpcode()) {
738 case Instruction::Add:
739 case Instruction::Sub:
740 case Instruction::Mul:
741 case Instruction::SDiv:
742 case Instruction::UDiv:
743 case Instruction::SRem:
744 case Instruction::URem:
745 case Instruction::Shl:
746 case Instruction::LShr:
747 case Instruction::AShr:
748 case Instruction::And:
749 case Instruction::Or:
750 case Instruction::Xor:
751 case Instruction::FAdd:
752 case Instruction::FSub:
753 case Instruction::FMul:
754 case Instruction::FDiv: {
755 const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
760 "getOpcode() returns %s, but instruction is not a BinaryOperator",
761 inst->getOpcodeName());
762 error.SetErrorToGenericError();
767 Value *lhs = inst->getOperand(0);
768 Value *rhs = inst->getOperand(1);
775 error.SetErrorToGenericError();
782 error.SetErrorToGenericError();
789 switch (inst->getOpcode()) {
792 case Instruction::Add:
793 case Instruction::FAdd:
796 case Instruction::Mul:
797 case Instruction::FMul:
800 case Instruction::Sub:
801 case Instruction::FSub:
804 case Instruction::SDiv:
809 case Instruction::UDiv:
814 case Instruction::FDiv:
817 case Instruction::SRem:
822 case Instruction::URem:
827 case Instruction::Shl:
830 case Instruction::AShr:
833 case Instruction::LShr:
837 case Instruction::And:
840 case Instruction::Or:
843 case Instruction::Xor:
851 LLDB_LOGF(log,
"Interpreted a %s", inst->getOpcodeName());
857 case Instruction::Alloca: {
858 const AllocaInst *alloca_inst = cast<AllocaInst>(inst);
860 if (alloca_inst->isArrayAllocation()) {
862 "AllocaInsts are not handled if isArrayAllocation() is true");
863 error.SetErrorToGenericError();
875 Type *T = alloca_inst->getAllocatedType();
876 Type *Tptr = alloca_inst->getType();
881 LLDB_LOGF(log,
"Couldn't allocate memory for an AllocaInst");
882 error.SetErrorToGenericError();
891 "Couldn't allocate the result pointer for an AllocaInst");
892 error.SetErrorToGenericError();
902 LLDB_LOGF(log,
"Couldn't write the result pointer for an AllocaInst");
903 error.SetErrorToGenericError();
906 execution_unit.
Free(P, free_error);
907 execution_unit.
Free(R, free_error);
914 LLDB_LOGF(log,
"Interpreted an AllocaInst");
919 case Instruction::BitCast:
920 case Instruction::ZExt: {
921 const CastInst *cast_inst = cast<CastInst>(inst);
923 Value *source = cast_inst->getOperand(0);
929 error.SetErrorToGenericError();
936 case Instruction::SExt: {
937 const CastInst *cast_inst = cast<CastInst>(inst);
939 Value *source = cast_inst->getOperand(0);
945 error.SetErrorToGenericError();
956 case Instruction::Br: {
957 const BranchInst *br_inst = cast<BranchInst>(inst);
959 if (br_inst->isConditional()) {
960 Value *condition = br_inst->getCondition();
966 error.SetErrorToGenericError();
972 frame.
Jump(br_inst->getSuccessor(0));
974 frame.
Jump(br_inst->getSuccessor(1));
977 LLDB_LOGF(log,
"Interpreted a BrInst with a condition");
982 frame.
Jump(br_inst->getSuccessor(0));
985 LLDB_LOGF(log,
"Interpreted a BrInst with no condition");
990 case Instruction::PHI: {
991 const PHINode *phi_inst = cast<PHINode>(inst);
994 "Encountered PHI node without having jumped from another "
996 error.SetErrorToGenericError();
1001 Value *value = phi_inst->getIncomingValueForBlock(frame.
m_prev_bb);
1005 error.SetErrorToGenericError();
1012 LLDB_LOGF(log,
"Interpreted a %s", inst->getOpcodeName());
1017 case Instruction::GetElementPtr: {
1018 const GetElementPtrInst *gep_inst = cast<GetElementPtrInst>(inst);
1020 const Value *pointer_operand = gep_inst->getPointerOperand();
1021 Type *src_elem_ty = gep_inst->getSourceElementType();
1028 error.SetErrorToGenericError();
1033 typedef SmallVector<Value *, 8> IndexVector;
1034 typedef IndexVector::iterator IndexIterator;
1036 SmallVector<Value *, 8> indices(gep_inst->idx_begin(),
1037 gep_inst->idx_end());
1039 SmallVector<Value *, 8> const_indices;
1041 for (IndexIterator ii = indices.begin(), ie = indices.end(); ii != ie;
1043 ConstantInt *constant_index = dyn_cast<ConstantInt>(*ii);
1045 if (!constant_index) {
1050 error.SetErrorToGenericError();
1055 LLDB_LOGF(log,
"Evaluated constant index %s as %llu",
1058 constant_index = cast<ConstantInt>(ConstantInt::get(
1062 const_indices.push_back(constant_index);
1066 data_layout.getIndexedOffsetInType(src_elem_ty, const_indices);
1073 LLDB_LOGF(log,
"Interpreted a GetElementPtrInst");
1079 case Instruction::FCmp:
1080 case Instruction::ICmp: {
1081 const CmpInst *icmp_inst = cast<CmpInst>(inst);
1083 CmpInst::Predicate predicate = icmp_inst->getPredicate();
1085 Value *lhs = inst->getOperand(0);
1086 Value *rhs = inst->getOperand(1);
1093 error.SetErrorToGenericError();
1100 error.SetErrorToGenericError();
1107 switch (predicate) {
1110 case CmpInst::ICMP_EQ:
1111 case CmpInst::FCMP_OEQ:
1114 case CmpInst::ICMP_NE:
1115 case CmpInst::FCMP_UNE:
1118 case CmpInst::ICMP_UGT:
1123 case CmpInst::ICMP_UGE:
1128 case CmpInst::FCMP_OGE:
1131 case CmpInst::FCMP_OGT:
1134 case CmpInst::ICMP_ULT:
1139 case CmpInst::FCMP_OLT:
1142 case CmpInst::ICMP_ULE:
1147 case CmpInst::FCMP_OLE:
1150 case CmpInst::ICMP_SGT:
1155 case CmpInst::ICMP_SGE:
1160 case CmpInst::ICMP_SLT:
1165 case CmpInst::ICMP_SLE:
1175 LLDB_LOGF(log,
"Interpreted an ICmpInst");
1181 case Instruction::IntToPtr: {
1182 const IntToPtrInst *int_to_ptr_inst = cast<IntToPtrInst>(inst);
1184 Value *src_operand = int_to_ptr_inst->getOperand(0);
1190 error.SetErrorToGenericError();
1198 LLDB_LOGF(log,
"Interpreted an IntToPtr");
1203 case Instruction::PtrToInt: {
1204 const PtrToIntInst *ptr_to_int_inst = cast<PtrToIntInst>(inst);
1206 Value *src_operand = ptr_to_int_inst->getOperand(0);
1212 error.SetErrorToGenericError();
1220 LLDB_LOGF(log,
"Interpreted a PtrToInt");
1225 case Instruction::Trunc: {
1226 const TruncInst *trunc_inst = cast<TruncInst>(inst);
1228 Value *src_operand = trunc_inst->getOperand(0);
1234 error.SetErrorToGenericError();
1247 case Instruction::Load: {
1248 const LoadInst *load_inst = cast<LoadInst>(inst);
1256 const Value *pointer_operand = load_inst->getPointerOperand();
1262 LLDB_LOGF(log,
"LoadInst's value doesn't resolve to anything");
1263 error.SetErrorToGenericError();
1269 LLDB_LOGF(log,
"LoadInst's pointer doesn't resolve to anything");
1270 error.SetErrorToGenericError();
1280 LLDB_LOGF(log,
"Couldn't read the address to be loaded for a LoadInst");
1281 error.SetErrorToGenericError();
1286 Type *target_ty = load_inst->getType();
1287 size_t target_size = data_layout.getTypeStoreSize(target_ty);
1294 LLDB_LOGF(log,
"Couldn't read from a region on behalf of a LoadInst");
1295 error.SetErrorToGenericError();
1304 LLDB_LOGF(log,
"Couldn't write to a region on behalf of a LoadInst");
1305 error.SetErrorToGenericError();
1311 LLDB_LOGF(log,
"Interpreted a LoadInst");
1317 case Instruction::Ret: {
1320 case Instruction::Store: {
1321 const StoreInst *store_inst = cast<StoreInst>(inst);
1329 const Value *value_operand = store_inst->getValueOperand();
1330 const Value *pointer_operand = store_inst->getPointerOperand();
1336 LLDB_LOGF(log,
"StoreInst's value doesn't resolve to anything");
1337 error.SetErrorToGenericError();
1343 LLDB_LOGF(log,
"StoreInst's pointer doesn't resolve to anything");
1344 error.SetErrorToGenericError();
1354 LLDB_LOGF(log,
"Couldn't read the address to be loaded for a LoadInst");
1355 error.SetErrorToGenericError();
1360 Type *target_ty = value_operand->getType();
1361 size_t target_size = data_layout.getTypeStoreSize(target_ty);
1368 LLDB_LOGF(log,
"Couldn't read from a region on behalf of a StoreInst");
1369 error.SetErrorToGenericError();
1378 LLDB_LOGF(log,
"Couldn't write to a region on behalf of a StoreInst");
1379 error.SetErrorToGenericError();
1385 LLDB_LOGF(log,
"Interpreted a StoreInst");
1391 case Instruction::Call: {
1392 const CallInst *call_inst = cast<CallInst>(inst);
1398 llvm::Type *returnType = call_inst->getType();
1399 if (returnType ==
nullptr) {
1400 error.SetErrorToGenericError();
1401 error.SetErrorString(
"unable to access return type");
1406 if (!returnType->isVoidTy() && !returnType->isIntegerTy() &&
1407 !returnType->isPointerTy()) {
1408 error.SetErrorToGenericError();
1409 error.SetErrorString(
"return type is not supported");
1415 error.SetErrorToGenericError();
1416 error.SetErrorString(
"unable to acquire thread");
1422 error.SetErrorToGenericError();
1423 error.SetErrorString(
"unable to get the process");
1429 const llvm::Value *val = call_inst->getCalledOperand();
1432 error.SetErrorToGenericError();
1433 error.SetErrorString(
"unable to get address of function");
1441 llvm::FunctionType *prototype = call_inst->getFunctionType();
1444 const int numArgs = call_inst->arg_size();
1448 if (numArgs >= 16) {
1449 error.SetErrorToGenericError();
1450 error.SetErrorString(
"function takes too many arguments");
1456 for (
int i = 0; i < numArgs; i++) {
1458 llvm::Value *arg_op = call_inst->getArgOperand(i);
1459 llvm::Type *arg_ty = arg_op->getType();
1462 if (!arg_ty->isIntegerTy() && !arg_ty->isPointerTy()) {
1463 error.SetErrorToGenericError();
1464 error.SetErrorStringWithFormat(
"argument %d must be integer type", i);
1471 error.SetErrorToGenericError();
1472 error.SetErrorStringWithFormat(
"unable to evaluate argument %d", i);
1477 if (arg_ty->isPointerTy()) {
1479 size_t dataSize = 0;
1481 bool Success = execution_unit.
GetAllocSize(addr, dataSize);
1484 "unable to locate host data for transfer to device");
1486 rawArgs[i].
size = dataSize;
1487 rawArgs[i].
data_up.reset(
new uint8_t[dataSize + 1]);
1490 execution_unit.
ReadMemory(rawArgs[i].data_up.get(), addr, dataSize,
1492 assert(!
error.Fail() &&
1493 "we have failed to read the string from memory");
1496 rawArgs[i].
data_up[dataSize] =
'\0';
1502 rawArgs[i].
size = arg_ty->getIntegerBitWidth() / 8;
1509 llvm::ArrayRef<lldb_private::ABI::CallArgument> args(rawArgs, numArgs);
1512 lldb::ThreadPlanSP call_plan_sp(
1514 exe_ctx.
GetThreadRef(), funcAddr, *prototype, *returnType, args,
1519 if (!call_plan_sp || !call_plan_sp->ValidatePlan(&ss)) {
1520 error.SetErrorToGenericError();
1521 error.SetErrorStringWithFormat(
1522 "unable to make ThreadPlanCallFunctionUsingABI for 0x%llx",
1531 exe_ctx, call_plan_sp, options, diagnostics);
1535 error.SetErrorToGenericError();
1536 error.SetErrorString(
"ThreadPlanCallFunctionUsingABI failed");
1543 if (returnType->isVoidTy()) {
1547 if (returnType->isIntegerTy() || returnType->isPointerTy()) {
1549 lldb::ValueObjectSP retVal = call_plan_sp.get()->GetReturnValueObject();
1555 if (vobj ==
nullptr || !retVal) {
1556 error.SetErrorToGenericError();
1557 error.SetErrorString(
"unable to get the return value");
1574 if (num_insts >= 4096) {
1575 error.SetErrorToGenericError();
static llvm::raw_ostream & error(Stream &strm)
static bool CanResolveConstant(llvm::Constant *constant)
static const char * memory_allocation_error
static const char * memory_read_error
static std::string PrintValue(const Value *value, bool truncate=false)
static const char * interpreter_internal_error
static std::string PrintType(const Type *type, bool truncate=false)
static const char * unsupported_operand_error
static const char * infinite_loop_error
static bool CanIgnoreCall(const CallInst *call)
static const char * memory_write_error
static const char * unsupported_opcode_error
static const char * bad_value_error
static const char * too_many_functions_error
#define LLDB_LOGF(log,...)
static bool Interpret(llvm::Module &module, llvm::Function &function, llvm::ArrayRef< lldb::addr_t > args, lldb_private::IRExecutionUnit &execution_unit, lldb_private::Status &error, lldb::addr_t stack_frame_bottom, lldb::addr_t stack_frame_top, lldb_private::ExecutionContext &exe_ctx)
static bool CanInterpret(llvm::Module &module, llvm::Function &function, lldb_private::Status &error, const bool support_function_calls)
lldb::addr_t ResolveValue(const Value *value, Module &module)
InterpreterStackFrame(DataLayout &target_data, lldb_private::IRExecutionUnit &execution_unit, lldb::addr_t stack_frame_bottom, lldb::addr_t stack_frame_top)
lldb::addr_t m_stack_pointer
std::string SummarizeValue(const Value *value)
bool ResolveConstantValue(APInt &value, const Constant *constant)
bool ResolveConstant(lldb::addr_t process_address, const Constant *constant)
lldb_private::IRExecutionUnit & m_execution_unit
bool MakeArgument(const Argument *value, uint64_t address)
lldb::addr_t Malloc(size_t size, uint8_t byte_alignment)
const BasicBlock * m_prev_bb
BasicBlock::const_iterator m_ie
lldb::addr_t Malloc(llvm::Type *type)
bool AssignToMatchType(lldb_private::Scalar &scalar, llvm::APInt value, Type *type)
~InterpreterStackFrame()=default
void Jump(const BasicBlock *bb)
std::string PrintData(lldb::addr_t addr, llvm::Type *type)
std::map< const Value *, lldb::addr_t > ValueMap
BasicBlock::const_iterator m_ii
lldb::ByteOrder m_byte_order
bool EvaluateValue(lldb_private::Scalar &scalar, const Value *value, Module &module)
bool AssignValue(const Value *value, lldb_private::Scalar scalar, Module &module)
lldb::addr_t m_frame_process_address
DataLayout & m_target_data
A section + offset based address class.
A uniqued constant string class.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Process & GetProcessRef() const
Returns a reference to the process object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
Thread & GetThreadRef() const
Returns a reference to the thread object.
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
"lldb/Expression/IRExecutionUnit.h" Contains the IR and, optionally, JIT- compiled code for a module.
lldb::addr_t FindSymbol(ConstString name, bool &missing_weak)
void Free(lldb::addr_t process_address, Status &error)
void ReadPointerFromMemory(lldb::addr_t *address, lldb::addr_t process_address, Status &error)
void GetMemoryData(DataExtractor &extractor, lldb::addr_t process_address, size_t size, Status &error)
void WritePointerToMemory(lldb::addr_t process_address, lldb::addr_t address, Status &error)
bool GetAllocSize(lldb::addr_t address, size_t &size)
void WriteMemory(lldb::addr_t process_address, const uint8_t *bytes, size_t size, Status &error)
void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size, Status &error)
lldb::ExpressionResults RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager)
void SetRunningUserExpression(bool on)
unsigned long long ULongLong(unsigned long long fail_value=0) const
size_t GetAsMemoryData(void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
long long SLongLong(long long fail_value=0) const
bool ShiftRightLogical(const Scalar &rhs)
llvm::APInt UInt128(const llvm::APInt &fail_value) const
void Clear()
Clear the object state.
bool Success() const
Test for success condition.
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
const Value & GetValue() const
const Scalar & GetScalar() const
#define LLDB_INVALID_ADDRESS
ExpressionResults
The results of expression evaluation.
ByteOrder
Byte ordering definitions.
std::unique_ptr< uint8_t[]> data_up