LLDB mainline
Functions
DWARFExpression.cpp File Reference
#include "lldb/Expression/DWARFExpression.h"
#include <cinttypes>
#include <optional>
#include <vector>
#include "lldb/Core/Module.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Utility/DataEncoder.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/VMRange.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/Endian.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/StackID.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "Plugins/SymbolFile/DWARF/DWARFUnit.h"

Go to the source code of this file.

Functions

static llvm::Error ReadRegisterValueAsScalar (RegisterContext *reg_ctx, lldb::RegisterKind reg_kind, uint32_t reg_num, Value &value)
 
static offset_t GetOpcodeDataSize (const DataExtractor &data, const lldb::offset_t data_offset, const uint8_t op, const DWARFUnit *dwarf_cu)
 Return the length in bytes of the set of operands for op.
 
static llvm::Error Evaluate_DW_OP_entry_value (std::vector< Value > &stack, ExecutionContext *exe_ctx, RegisterContext *reg_ctx, const DataExtractor &opcodes, lldb::offset_t &opcode_offset, Log *log)
 
static llvm::Expected< lldb::addr_tResolveLoadAddress (ExecutionContext *exe_ctx, lldb::ModuleSP &module_sp, const char *dw_op_type, lldb::addr_t file_addr, Address &so_addr, bool check_sectionoffset=false)
 Helper function to move common code used to resolve a file address and turn into a load address.
 
static Scalar DerefSizeExtractDataHelper (uint8_t *addr_bytes, size_t size_addr_bytes, ByteOrder byte_order, size_t size)
 Helper function to move common code used to load sized data from a uint8_t buffer.
 

Function Documentation

◆ DerefSizeExtractDataHelper()

static Scalar DerefSizeExtractDataHelper ( uint8_t *  addr_bytes,
size_t  size_addr_bytes,
ByteOrder  byte_order,
size_t  size 
)
static

Helper function to move common code used to load sized data from a uint8_t buffer.

Parameters
addr_bytesuint8_t buffer containg raw data
size_addr_byteshow large is the underlying raw data
byte_orderwhat is the byter order of the underlyig data
sizeHow much of the underlying data we want to use
Returns
The underlying data converted into a Scalar

Definition at line 810 of file DWARFExpression.cpp.

References lldb_private::DataExtractor::GetAddress(), and lldb_private::DataExtractor::GetMaxU64().

Referenced by lldb_private::DWARFExpression::Evaluate().

◆ Evaluate_DW_OP_entry_value()

static llvm::Error Evaluate_DW_OP_entry_value ( std::vector< Value > &  stack,
ExecutionContext exe_ctx,
RegisterContext reg_ctx,
const DataExtractor opcodes,
lldb::offset_t opcode_offset,
Log log 
)
static

◆ GetOpcodeDataSize()

static offset_t GetOpcodeDataSize ( const DataExtractor data,
const lldb::offset_t  data_offset,
const uint8_t  op,
const DWARFUnit dwarf_cu 
)
static

◆ ReadRegisterValueAsScalar()

static llvm::Error ReadRegisterValueAsScalar ( RegisterContext reg_ctx,
lldb::RegisterKind  reg_kind,
uint32_t  reg_num,
Value value 
)
static

◆ ResolveLoadAddress()

static llvm::Expected< lldb::addr_t > ResolveLoadAddress ( ExecutionContext exe_ctx,
lldb::ModuleSP module_sp,
const char *  dw_op_type,
lldb::addr_t  file_addr,
Address so_addr,
bool  check_sectionoffset = false 
)
static

Helper function to move common code used to resolve a file address and turn into a load address.

Parameters
exe_ctxPointer to the execution context
module_spshared_ptr contains the module if we have one
dw_op_typeC-style string used to vary the error output
file_addrthe file address we are trying to resolve and turn into a load address
so_addrout parameter, will be set to load address or section offset
check_sectionoffsetbool which determines if having a section offset but not a load address is considerd a success
Returns
std::optional containing the load address if resolving and getting the load address succeed or an empty Optinal otherwise. If check_sectionoffset is true we consider LLDB_INVALID_ADDRESS a success if so_addr.IsSectionOffset() is true.

Definition at line 783 of file DWARFExpression.cpp.

References lldb_private::Address::GetLoadAddress(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::Address::IsSectionOffset(), and LLDB_INVALID_ADDRESS.

Referenced by lldb_private::DWARFExpression::Evaluate().