LLDB mainline
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/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/DWARFExpressionPrinter.h"
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"

Go to the source code of this file.

Functions

static lldb::offset_t GetOpcodeDataSize (const DataExtractor &data, const lldb::offset_t data_offset, const LocationAtom op, const DWARFExpression::Delegate *dwarf_cu)
 Return the length in bytes of the set of operands for op.
static const char * DW_OP_value_to_name (uint32_t val)
static llvm::Error Evaluate_DW_OP_entry_value (DWARFExpression::Stack &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 llvm::Error Evaluate_DW_OP_deref (DWARFExpression::Stack &stack, ExecutionContext *exe_ctx, lldb::ModuleSP module_sp, Process *process)
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()

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 930 of file DWARFExpression.cpp.

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

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

◆ DW_OP_value_to_name()

const char * DW_OP_value_to_name ( uint32_t val)
static

◆ Evaluate_DW_OP_deref()

◆ Evaluate_DW_OP_entry_value()

◆ GetOpcodeDataSize()

◆ ResolveLoadAddress()

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 845 of file DWARFExpression.cpp.

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

Referenced by ProcessMachCore::DoGetMemoryRegionInfo(), lldb_private::DWARFExpression::Evaluate(), and Evaluate_DW_OP_deref().