LLDB  mainline
Functions
DWARFExpression.cpp File Reference
#include "lldb/Expression/DWARFExpression.h"
#include <cinttypes>
#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"
Include dependency graph for DWARFExpression.cpp:

Go to the source code of this file.

Functions

static bool ReadRegisterValueAsScalar (RegisterContext *reg_ctx, lldb::RegisterKind reg_kind, uint32_t reg_num, Status *error_ptr, 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. More...
 
static bool Evaluate_DW_OP_entry_value (std::vector< Value > &stack, ExecutionContext *exe_ctx, RegisterContext *reg_ctx, const DataExtractor &opcodes, lldb::offset_t &opcode_offset, Status *error_ptr, Log *log)
 
static llvm::Optional< lldb::addr_tResolveLoadAddress (ExecutionContext *exe_ctx, lldb::ModuleSP &module_sp, Status *error_ptr, 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. More...
 
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. More...
 

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 831 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 bool Evaluate_DW_OP_entry_value ( std::vector< Value > &  stack,
ExecutionContext exe_ctx,
RegisterContext reg_ctx,
const DataExtractor opcodes,
lldb::offset_t opcode_offset,
Status error_ptr,
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 bool ReadRegisterValueAsScalar ( RegisterContext reg_ctx,
lldb::RegisterKind  reg_kind,
uint32_t  reg_num,
Status error_ptr,
Value value 
)
static

◆ ResolveLoadAddress()

static llvm::Optional<lldb::addr_t> ResolveLoadAddress ( ExecutionContext exe_ctx,
lldb::ModuleSP &  module_sp,
Status error_ptr,
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
error_ptrpointer to Status object 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
llvm::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 794 of file DWARFExpression.cpp.

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

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