33#include "llvm/IR/Constants.h"
34#include "llvm/IR/DataLayout.h"
35#include "llvm/IR/Function.h"
36#include "llvm/IR/Instructions.h"
37#include "llvm/IR/Intrinsics.h"
38#include "llvm/IR/LLVMContext.h"
39#include "llvm/IR/Module.h"
40#include "llvm/IR/Operator.h"
41#include "llvm/Support/raw_ostream.h"
48static std::string
PrintValue(
const Value *value,
bool truncate =
false) {
50 raw_string_ostream rso(s);
54 s.resize(s.length() - 1);
57 while ((offset = s.find(
'\n')) != s.npos)
59 while (s[0] ==
' ' || s[0] ==
'\t')
65static std::string
PrintType(
const Type *type,
bool truncate =
false) {
67 raw_string_ostream rso(s);
71 s.resize(s.length() - 1);
76 const llvm::Function *called_function = call->getCalledFunction();
81 if (called_function->isIntrinsic()) {
82 switch (called_function->getIntrinsicID()) {
85 case llvm::Intrinsic::dbg_declare:
86 case llvm::Intrinsic::dbg_value:
96 typedef std::map<const Value *, lldb::addr_t>
ValueMap;
101 const BasicBlock *
m_bb =
nullptr;
103 BasicBlock::const_iterator
m_ii;
104 BasicBlock::const_iterator
m_ie;
129 void Jump(
const BasicBlock *bb) {
141 ValueMap::iterator i =
m_values.find(value);
146 ss.
Printf(
" 0x%llx", (
unsigned long long)addr);
160 type_size = PowerOf2Ceil(type_size);
162 scalar = value.zextOrTrunc(type_size * 8);
168 const Constant *constant = dyn_cast<Constant>(value);
171 if (constant->getValueID() == Value::ConstantFPVal) {
172 if (
auto *cfp = dyn_cast<ConstantFP>(constant)) {
173 if (cfp->getType()->isDoubleTy())
174 scalar = cfp->getValueAPF().convertToDouble();
175 else if (cfp->getType()->isFloatTy())
176 scalar = cfp->getValueAPF().convertToFloat();
192 size_t value_size =
m_target_data.getTypeStoreSize(value->getType());
198 value_size, extract_error);
204 if (value_size <= 8) {
205 Type *ty = value->getType();
206 if (ty->isDoubleTy()) {
207 scalar = value_extractor.
GetDouble(&offset);
209 }
else if (ty->isFloatTy()) {
210 scalar = value_extractor.
GetFloat(&offset);
213 uint64_t u64value = value_extractor.
GetMaxU64(&offset, value_size);
230 Type *vty = value->getType();
231 if (vty->isFloatTy() || vty->isDoubleTy()) {
232 cast_scalar = scalar;
240 size_t value_byte_size =
m_target_data.getTypeStoreSize(value->getType());
259 switch (constant->getValueID()) {
262 case Value::FunctionVal:
263 if (
const Function *constant_func = dyn_cast<Function>(constant)) {
265 bool missing_weak =
false;
273 case Value::ConstantIntVal:
274 if (
const ConstantInt *constant_int = dyn_cast<ConstantInt>(constant)) {
275 value = constant_int->getValue();
279 case Value::ConstantFPVal:
280 if (
const ConstantFP *constant_fp = dyn_cast<ConstantFP>(constant)) {
281 value = constant_fp->getValueAPF().bitcastToAPInt();
285 case Value::ConstantExprVal:
286 if (
const ConstantExpr *constant_expr =
287 dyn_cast<ConstantExpr>(constant)) {
288 switch (constant_expr->getOpcode()) {
291 case Instruction::IntToPtr:
292 case Instruction::PtrToInt:
293 case Instruction::BitCast:
295 case Instruction::GetElementPtr: {
296 ConstantExpr::const_op_iterator op_cursor = constant_expr->op_begin();
297 ConstantExpr::const_op_iterator op_end = constant_expr->op_end();
299 Constant *base = dyn_cast<Constant>(*op_cursor);
309 if (op_cursor == op_end)
312 SmallVector<Value *, 8> indices(op_cursor, op_end);
314 cast<GEPOperator>(constant_expr)->getSourceElementType();
321 const bool is_signed =
true;
322 value += APInt(value.getBitWidth(), offset, is_signed);
329 case Value::ConstantPointerNullVal:
330 if (isa<ConstantPointerNull>(constant)) {
360 LLDB_LOGF(log,
"Made an allocation for argument %s",
362 LLDB_LOGF(log,
" Data region : %llx", (
unsigned long long)address);
364 (
unsigned long long)data_address);
371 APInt resolved_value;
376 size_t constant_size =
m_target_data.getTypeStoreSize(constant->getType());
382 resolved_value.zextOrTrunc(llvm::NextPowerOf2(constant_size) * 8));
399 ret -= (ret % byte_alignment);
425 return std::string(
"<couldn't read data>");
429 for (
size_t i = 0; i < length; i++) {
430 if ((!(i & 0xf)) && i)
440 ValueMap::iterator i =
m_values.find(value);
449 if (
const Constant *constant = dyn_cast<Constant>(value)) {
463 "Interpreter doesn't handle one of the expression's opcodes";
465 "Interpreter doesn't handle one of the expression's operands";
467 "Interpreter encountered an internal error";
469 "Interrupted while interpreting expression";
471 "Interpreter couldn't resolve a value during execution";
473 "Interpreter couldn't allocate memory";
477 "Reached timeout while interpreting expression";
479 "Interpreter doesn't handle modules with multiple function bodies.";
482 switch (constant->getValueID()) {
485 case Value::ConstantIntVal:
486 case Value::ConstantFPVal:
487 case Value::FunctionVal:
489 case Value::ConstantExprVal:
490 if (
const ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(constant)) {
491 switch (constant_expr->getOpcode()) {
494 case Instruction::IntToPtr:
495 case Instruction::PtrToInt:
496 case Instruction::BitCast:
498 case Instruction::GetElementPtr: {
500 ConstantExpr::const_op_iterator op_cursor = constant_expr->op_begin();
501 Constant *base = dyn_cast<Constant>(*op_cursor);
506 for (Value *op : make_range(constant_expr->op_begin() + 1,
507 constant_expr->op_end())) {
508 ConstantInt *constant_int = dyn_cast<ConstantInt>(op);
518 case Value::ConstantPointerNullVal:
525 const bool support_function_calls) {
528 bool saw_function_with_body =
false;
529 for (Function &f : module) {
530 if (f.begin() != f.end()) {
531 if (saw_function_with_body) {
532 LLDB_LOGF(log,
"More than one function in the module has a body");
533 error.SetErrorToGenericError();
537 saw_function_with_body =
true;
538 LLDB_LOGF(log,
"Saw function with body: %s", f.getName().str().c_str());
542 for (BasicBlock &bb : function) {
543 for (Instruction &ii : bb) {
544 switch (ii.getOpcode()) {
547 error.SetErrorToGenericError();
551 case Instruction::Add:
552 case Instruction::Alloca:
553 case Instruction::BitCast:
554 case Instruction::Br:
555 case Instruction::PHI:
557 case Instruction::Call: {
558 CallInst *call_inst = dyn_cast<CallInst>(&ii);
561 error.SetErrorToGenericError();
567 LLDB_LOGF(log,
"Unsupported instruction: %s",
569 error.SetErrorToGenericError();
574 case Instruction::GetElementPtr:
576 case Instruction::FCmp:
577 case Instruction::ICmp: {
578 CmpInst *cmp_inst = dyn_cast<CmpInst>(&ii);
581 error.SetErrorToGenericError();
586 switch (cmp_inst->getPredicate()) {
588 LLDB_LOGF(log,
"Unsupported ICmp predicate: %s",
591 error.SetErrorToGenericError();
595 case CmpInst::FCMP_OEQ:
596 case CmpInst::ICMP_EQ:
597 case CmpInst::FCMP_UNE:
598 case CmpInst::ICMP_NE:
599 case CmpInst::FCMP_OGT:
600 case CmpInst::ICMP_UGT:
601 case CmpInst::FCMP_OGE:
602 case CmpInst::ICMP_UGE:
603 case CmpInst::FCMP_OLT:
604 case CmpInst::ICMP_ULT:
605 case CmpInst::FCMP_OLE:
606 case CmpInst::ICMP_ULE:
607 case CmpInst::ICMP_SGT:
608 case CmpInst::ICMP_SGE:
609 case CmpInst::ICMP_SLT:
610 case CmpInst::ICMP_SLE:
614 case Instruction::And:
615 case Instruction::AShr:
616 case Instruction::IntToPtr:
617 case Instruction::PtrToInt:
618 case Instruction::Load:
619 case Instruction::LShr:
620 case Instruction::Mul:
621 case Instruction::Or:
622 case Instruction::Ret:
623 case Instruction::SDiv:
624 case Instruction::SExt:
625 case Instruction::Shl:
626 case Instruction::SRem:
627 case Instruction::Store:
628 case Instruction::Sub:
629 case Instruction::Trunc:
630 case Instruction::UDiv:
631 case Instruction::URem:
632 case Instruction::Xor:
633 case Instruction::ZExt:
635 case Instruction::FAdd:
636 case Instruction::FSub:
637 case Instruction::FMul:
638 case Instruction::FDiv:
642 for (
unsigned oi = 0, oe = ii.getNumOperands(); oi != oe; ++oi) {
643 Value *operand = ii.getOperand(oi);
644 Type *operand_type = operand->getType();
646 switch (operand_type->getTypeID()) {
649 case Type::FixedVectorTyID:
650 case Type::ScalableVectorTyID: {
651 LLDB_LOGF(log,
"Unsupported operand type: %s",
662 if (operand_type->getPrimitiveSizeInBits() > 64) {
663 LLDB_LOGF(log,
"Unsupported operand type: %s",
669 if (Constant *constant = llvm::dyn_cast<Constant>(operand)) {
671 LLDB_LOGF(log,
"Unsupported constant: %s",
685 llvm::ArrayRef<lldb::addr_t> args,
696 raw_string_ostream oss(s);
698 module.print(oss,
nullptr);
702 LLDB_LOGF(log,
"Module as passed in to IRInterpreter::Interpret: \n\"%s\"",
706 const DataLayout &data_layout = module.getDataLayout();
712 error.SetErrorString(
"Couldn't allocate stack frame");
717 for (llvm::Function::arg_iterator ai = function.arg_begin(),
718 ae = function.arg_end();
719 ai != ae; ++ai, ++arg_index) {
720 if (args.size() <=
static_cast<size_t>(arg_index)) {
721 error.SetErrorString(
"Not enough arguments passed in to function");
730 frame.
Jump(&function.front());
735 using clock = std::chrono::steady_clock;
738 std::optional<clock::time_point> end_time;
739 if (timeout && timeout->count() > 0)
740 end_time = clock::now() + *timeout;
744 if (end_time && clock::now() >= *end_time) {
745 error.SetErrorToGenericError();
753 "Interrupted in IR interpreting.")) {
754 error.SetErrorToGenericError();
760 const Instruction *inst = &*frame.
m_ii;
764 switch (inst->getOpcode()) {
768 case Instruction::Add:
769 case Instruction::Sub:
770 case Instruction::Mul:
771 case Instruction::SDiv:
772 case Instruction::UDiv:
773 case Instruction::SRem:
774 case Instruction::URem:
775 case Instruction::Shl:
776 case Instruction::LShr:
777 case Instruction::AShr:
778 case Instruction::And:
779 case Instruction::Or:
780 case Instruction::Xor:
781 case Instruction::FAdd:
782 case Instruction::FSub:
783 case Instruction::FMul:
784 case Instruction::FDiv: {
785 const BinaryOperator *bin_op = dyn_cast<BinaryOperator>(inst);
790 "getOpcode() returns %s, but instruction is not a BinaryOperator",
791 inst->getOpcodeName());
792 error.SetErrorToGenericError();
797 Value *lhs = inst->getOperand(0);
798 Value *rhs = inst->getOperand(1);
805 error.SetErrorToGenericError();
812 error.SetErrorToGenericError();
819 switch (inst->getOpcode()) {
822 case Instruction::Add:
823 case Instruction::FAdd:
826 case Instruction::Mul:
827 case Instruction::FMul:
830 case Instruction::Sub:
831 case Instruction::FSub:
834 case Instruction::SDiv:
839 case Instruction::UDiv:
844 case Instruction::FDiv:
847 case Instruction::SRem:
852 case Instruction::URem:
857 case Instruction::Shl:
860 case Instruction::AShr:
863 case Instruction::LShr:
867 case Instruction::And:
870 case Instruction::Or:
873 case Instruction::Xor:
881 LLDB_LOGF(log,
"Interpreted a %s", inst->getOpcodeName());
887 case Instruction::Alloca: {
888 const AllocaInst *alloca_inst = cast<AllocaInst>(inst);
890 if (alloca_inst->isArrayAllocation()) {
892 "AllocaInsts are not handled if isArrayAllocation() is true");
893 error.SetErrorToGenericError();
905 Type *T = alloca_inst->getAllocatedType();
906 Type *Tptr = alloca_inst->getType();
911 LLDB_LOGF(log,
"Couldn't allocate memory for an AllocaInst");
912 error.SetErrorToGenericError();
921 "Couldn't allocate the result pointer for an AllocaInst");
922 error.SetErrorToGenericError();
932 LLDB_LOGF(log,
"Couldn't write the result pointer for an AllocaInst");
933 error.SetErrorToGenericError();
936 execution_unit.
Free(P, free_error);
937 execution_unit.
Free(R, free_error);
944 LLDB_LOGF(log,
"Interpreted an AllocaInst");
949 case Instruction::BitCast:
950 case Instruction::ZExt: {
951 const CastInst *cast_inst = cast<CastInst>(inst);
953 Value *source = cast_inst->getOperand(0);
959 error.SetErrorToGenericError();
966 case Instruction::SExt: {
967 const CastInst *cast_inst = cast<CastInst>(inst);
969 Value *source = cast_inst->getOperand(0);
975 error.SetErrorToGenericError();
986 case Instruction::Br: {
987 const BranchInst *br_inst = cast<BranchInst>(inst);
989 if (br_inst->isConditional()) {
990 Value *condition = br_inst->getCondition();
996 error.SetErrorToGenericError();
1002 frame.
Jump(br_inst->getSuccessor(0));
1004 frame.
Jump(br_inst->getSuccessor(1));
1007 LLDB_LOGF(log,
"Interpreted a BrInst with a condition");
1012 frame.
Jump(br_inst->getSuccessor(0));
1015 LLDB_LOGF(log,
"Interpreted a BrInst with no condition");
1020 case Instruction::PHI: {
1021 const PHINode *phi_inst = cast<PHINode>(inst);
1024 "Encountered PHI node without having jumped from another "
1026 error.SetErrorToGenericError();
1031 Value *value = phi_inst->getIncomingValueForBlock(frame.
m_prev_bb);
1035 error.SetErrorToGenericError();
1042 LLDB_LOGF(log,
"Interpreted a %s", inst->getOpcodeName());
1047 case Instruction::GetElementPtr: {
1048 const GetElementPtrInst *gep_inst = cast<GetElementPtrInst>(inst);
1050 const Value *pointer_operand = gep_inst->getPointerOperand();
1051 Type *src_elem_ty = gep_inst->getSourceElementType();
1058 error.SetErrorToGenericError();
1063 typedef SmallVector<Value *, 8> IndexVector;
1064 typedef IndexVector::iterator IndexIterator;
1066 SmallVector<Value *, 8> indices(gep_inst->idx_begin(),
1067 gep_inst->idx_end());
1069 SmallVector<Value *, 8> const_indices;
1071 for (IndexIterator ii = indices.begin(), ie = indices.end(); ii != ie;
1073 ConstantInt *constant_index = dyn_cast<ConstantInt>(*ii);
1075 if (!constant_index) {
1080 error.SetErrorToGenericError();
1085 LLDB_LOGF(log,
"Evaluated constant index %s as %llu",
1088 constant_index = cast<ConstantInt>(ConstantInt::get(
1092 const_indices.push_back(constant_index);
1096 data_layout.getIndexedOffsetInType(src_elem_ty, const_indices);
1103 LLDB_LOGF(log,
"Interpreted a GetElementPtrInst");
1109 case Instruction::FCmp:
1110 case Instruction::ICmp: {
1111 const CmpInst *icmp_inst = cast<CmpInst>(inst);
1113 CmpInst::Predicate predicate = icmp_inst->getPredicate();
1115 Value *lhs = inst->getOperand(0);
1116 Value *rhs = inst->getOperand(1);
1123 error.SetErrorToGenericError();
1130 error.SetErrorToGenericError();
1137 switch (predicate) {
1140 case CmpInst::ICMP_EQ:
1141 case CmpInst::FCMP_OEQ:
1144 case CmpInst::ICMP_NE:
1145 case CmpInst::FCMP_UNE:
1148 case CmpInst::ICMP_UGT:
1153 case CmpInst::ICMP_UGE:
1158 case CmpInst::FCMP_OGE:
1161 case CmpInst::FCMP_OGT:
1164 case CmpInst::ICMP_ULT:
1169 case CmpInst::FCMP_OLT:
1172 case CmpInst::ICMP_ULE:
1177 case CmpInst::FCMP_OLE:
1180 case CmpInst::ICMP_SGT:
1185 case CmpInst::ICMP_SGE:
1190 case CmpInst::ICMP_SLT:
1195 case CmpInst::ICMP_SLE:
1205 LLDB_LOGF(log,
"Interpreted an ICmpInst");
1211 case Instruction::IntToPtr: {
1212 const IntToPtrInst *int_to_ptr_inst = cast<IntToPtrInst>(inst);
1214 Value *src_operand = int_to_ptr_inst->getOperand(0);
1220 error.SetErrorToGenericError();
1228 LLDB_LOGF(log,
"Interpreted an IntToPtr");
1233 case Instruction::PtrToInt: {
1234 const PtrToIntInst *ptr_to_int_inst = cast<PtrToIntInst>(inst);
1236 Value *src_operand = ptr_to_int_inst->getOperand(0);
1242 error.SetErrorToGenericError();
1250 LLDB_LOGF(log,
"Interpreted a PtrToInt");
1255 case Instruction::Trunc: {
1256 const TruncInst *trunc_inst = cast<TruncInst>(inst);
1258 Value *src_operand = trunc_inst->getOperand(0);
1264 error.SetErrorToGenericError();
1277 case Instruction::Load: {
1278 const LoadInst *load_inst = cast<LoadInst>(inst);
1286 const Value *pointer_operand = load_inst->getPointerOperand();
1292 LLDB_LOGF(log,
"LoadInst's value doesn't resolve to anything");
1293 error.SetErrorToGenericError();
1299 LLDB_LOGF(log,
"LoadInst's pointer doesn't resolve to anything");
1300 error.SetErrorToGenericError();
1310 LLDB_LOGF(log,
"Couldn't read the address to be loaded for a LoadInst");
1311 error.SetErrorToGenericError();
1316 Type *target_ty = load_inst->getType();
1317 size_t target_size = data_layout.getTypeStoreSize(target_ty);
1324 LLDB_LOGF(log,
"Couldn't read from a region on behalf of a LoadInst");
1325 error.SetErrorToGenericError();
1334 LLDB_LOGF(log,
"Couldn't write to a region on behalf of a LoadInst");
1335 error.SetErrorToGenericError();
1341 LLDB_LOGF(log,
"Interpreted a LoadInst");
1347 case Instruction::Ret: {
1350 case Instruction::Store: {
1351 const StoreInst *store_inst = cast<StoreInst>(inst);
1359 const Value *value_operand = store_inst->getValueOperand();
1360 const Value *pointer_operand = store_inst->getPointerOperand();
1366 LLDB_LOGF(log,
"StoreInst's value doesn't resolve to anything");
1367 error.SetErrorToGenericError();
1373 LLDB_LOGF(log,
"StoreInst's pointer doesn't resolve to anything");
1374 error.SetErrorToGenericError();
1384 LLDB_LOGF(log,
"Couldn't read the address to be loaded for a LoadInst");
1385 error.SetErrorToGenericError();
1390 Type *target_ty = value_operand->getType();
1391 size_t target_size = data_layout.getTypeStoreSize(target_ty);
1398 LLDB_LOGF(log,
"Couldn't read from a region on behalf of a StoreInst");
1399 error.SetErrorToGenericError();
1408 LLDB_LOGF(log,
"Couldn't write to a region on behalf of a StoreInst");
1409 error.SetErrorToGenericError();
1415 LLDB_LOGF(log,
"Interpreted a StoreInst");
1421 case Instruction::Call: {
1422 const CallInst *call_inst = cast<CallInst>(inst);
1428 llvm::Type *returnType = call_inst->getType();
1429 if (returnType ==
nullptr) {
1430 error.SetErrorToGenericError();
1431 error.SetErrorString(
"unable to access return type");
1436 if (!returnType->isVoidTy() && !returnType->isIntegerTy() &&
1437 !returnType->isPointerTy()) {
1438 error.SetErrorToGenericError();
1439 error.SetErrorString(
"return type is not supported");
1445 error.SetErrorToGenericError();
1446 error.SetErrorString(
"unable to acquire thread");
1452 error.SetErrorToGenericError();
1453 error.SetErrorString(
"unable to get the process");
1459 const llvm::Value *val = call_inst->getCalledOperand();
1462 error.SetErrorToGenericError();
1463 error.SetErrorString(
"unable to get address of function");
1471 llvm::FunctionType *prototype = call_inst->getFunctionType();
1474 const int numArgs = call_inst->arg_size();
1478 if (numArgs >= 16) {
1479 error.SetErrorToGenericError();
1480 error.SetErrorString(
"function takes too many arguments");
1486 for (
int i = 0; i < numArgs; i++) {
1488 llvm::Value *arg_op = call_inst->getArgOperand(i);
1489 llvm::Type *arg_ty = arg_op->getType();
1492 if (!arg_ty->isIntegerTy() && !arg_ty->isPointerTy()) {
1493 error.SetErrorToGenericError();
1494 error.SetErrorStringWithFormat(
"argument %d must be integer type", i);
1501 error.SetErrorToGenericError();
1502 error.SetErrorStringWithFormat(
"unable to evaluate argument %d", i);
1507 if (arg_ty->isPointerTy()) {
1509 size_t dataSize = 0;
1511 bool Success = execution_unit.
GetAllocSize(addr, dataSize);
1514 "unable to locate host data for transfer to device");
1516 rawArgs[i].
size = dataSize;
1517 rawArgs[i].
data_up.reset(
new uint8_t[dataSize + 1]);
1520 execution_unit.
ReadMemory(rawArgs[i].data_up.get(), addr, dataSize,
1522 assert(!
error.Fail() &&
1523 "we have failed to read the string from memory");
1526 rawArgs[i].
data_up[dataSize] =
'\0';
1532 rawArgs[i].
size = arg_ty->getIntegerBitWidth() / 8;
1539 llvm::ArrayRef<lldb_private::ABI::CallArgument> args(rawArgs, numArgs);
1544 exe_ctx.
GetThreadRef(), funcAddr, *prototype, *returnType, args,
1549 if (!call_plan_sp || !call_plan_sp->ValidatePlan(&ss)) {
1550 error.SetErrorToGenericError();
1551 error.SetErrorStringWithFormat(
1552 "unable to make ThreadPlanCallFunctionUsingABI for 0x%llx",
1561 process->
RunThreadPlan(exe_ctx, call_plan_sp, options, diagnostics);
1565 error.SetErrorToGenericError();
1566 error.SetErrorString(
"ThreadPlanCallFunctionUsingABI failed");
1573 if (returnType->isVoidTy()) {
1577 if (returnType->isIntegerTy() || returnType->isPointerTy()) {
1585 if (vobj ==
nullptr || !retVal) {
1586 error.SetErrorToGenericError();
1587 error.SetErrorString(
"unable to get the return value");
static llvm::raw_ostream & error(Stream &strm)
#define INTERRUPT_REQUESTED(debugger,...)
This handy define will keep you from having to generate a report for the interruption by hand.
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 * interrupt_error
static const char * unsupported_operand_error
static const char * timeout_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 CanInterpret(llvm::Module &module, llvm::Function &function, lldb_private::Status &error, const bool support_function_calls)
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, lldb_private::Timeout< std::micro > timeout)
lldb::addr_t ResolveValue(const Value *value, Module &module)
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)
const DataLayout & m_target_data
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
InterpreterStackFrame(const DataLayout &target_data, lldb_private::IRExecutionUnit &execution_unit, lldb::addr_t stack_frame_bottom, lldb::addr_t stack_frame_top)
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
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
Get the number of bytes in the data buffer.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
Target * GetTargetPtr() const
Returns a pointer to the target 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)
A plug-in interface definition class for debugging a process.
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
uint8_t * GetBytes()
Get a pointer to the data.
#define UNUSED_IF_ASSERT_DISABLED(x)
#define LLDB_INVALID_ADDRESS
std::shared_ptr< lldb_private::ThreadPlan > ThreadPlanSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
ExpressionResults
The results of expression evaluation.
ByteOrder
Byte ordering definitions.
std::unique_ptr< uint8_t[]> data_up