LLDB mainline
|
"lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location expression and interprets it. More...
#include <DWARFExpression.h>
Public Member Functions | |
DWARFExpression () | |
DWARFExpression (const DataExtractor &data) | |
Constructor. | |
~DWARFExpression () | |
Destructor. | |
bool | IsValid () const |
Return true if the location expression contains data. | |
llvm::Expected< lldb::addr_t > | GetLocation_DW_OP_addr (const plugin::dwarf::DWARFUnit *dwarf_cu) const |
Return the address specified by the first DW_OP_{addr, addrx, GNU_addr_index} in the operation stream. | |
bool | Update_DW_OP_addr (const plugin::dwarf::DWARFUnit *dwarf_cu, lldb::addr_t file_addr) |
void | UpdateValue (uint64_t const_value, lldb::offset_t const_value_byte_size, uint8_t addr_byte_size) |
bool | ContainsThreadLocalStorage (const plugin::dwarf::DWARFUnit *dwarf_cu) const |
bool | LinkThreadLocalStorage (const plugin::dwarf::DWARFUnit *dwarf_cu, std::function< lldb::addr_t(lldb::addr_t file_addr)> const &link_address_callback) |
lldb::RegisterKind | GetRegisterKind () const |
Return the call-frame-info style register kind. | |
void | SetRegisterKind (lldb::RegisterKind reg_kind) |
Set the call-frame-info style register kind. | |
bool | GetExpressionData (DataExtractor &data) const |
void | DumpLocation (Stream *s, lldb::DescriptionLevel level, ABI *abi) const |
bool | MatchesOperand (StackFrame &frame, const Instruction::Operand &op) const |
Static Public Member Functions | |
static llvm::Expected< Value > | Evaluate (ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::ModuleSP module_sp, const DataExtractor &opcodes, const plugin::dwarf::DWARFUnit *dwarf_cu, const lldb::RegisterKind reg_set, const Value *initial_value_ptr, const Value *object_address_ptr) |
Evaluate a DWARF location expression in a particular context. | |
static bool | ParseDWARFLocationList (const plugin::dwarf::DWARFUnit *dwarf_cu, const DataExtractor &data, DWARFExpressionList *loc_list) |
Private Attributes | |
DataExtractor | m_data |
A data extractor capable of reading opcode bytes. | |
lldb::RegisterKind | m_reg_kind = lldb::eRegisterKindDWARF |
One of the defines that starts with LLDB_REGKIND_. | |
"lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location expression and interprets it.
DWARF location expressions are used in two ways by LLDB. The first use is to find entities specified in the debug information, since their locations are specified in precisely this language. The second is to interpret expressions without having to run the target in cases where the overhead from copying JIT-compiled code into the target is too high or where the target cannot be run. This class encapsulates a single DWARF location expression or a location list and interprets it.
Definition at line 41 of file DWARFExpression.h.
DWARFExpression::DWARFExpression | ( | ) |
Definition at line 51 of file DWARFExpression.cpp.
Referenced by ParseDWARFLocationList().
DWARFExpression::DWARFExpression | ( | const DataExtractor & | data | ) |
Constructor.
[in] | data | A data extractor configured to read the DWARF location expression's bytecode. |
Definition at line 53 of file DWARFExpression.cpp.
|
default |
Destructor.
bool DWARFExpression::ContainsThreadLocalStorage | ( | const plugin::dwarf::DWARFUnit * | dwarf_cu | ) | const |
Definition at line 433 of file DWARFExpression.cpp.
References GetOpcodeDataSize(), lldb_private::DataExtractor::GetU8(), LLDB_INVALID_OFFSET, m_data, and lldb_private::DataExtractor::ValidOffset().
Referenced by lldb_private::DWARFExpressionList::ContainsThreadLocalStorage().
void DWARFExpression::DumpLocation | ( | Stream * | s, |
lldb::DescriptionLevel | level, | ||
ABI * | abi | ||
) | const |
Definition at line 72 of file DWARFExpression.cpp.
References lldb_private::Stream::AsRawOstream(), lldb_private::DataExtractor::GetAddressByteSize(), lldb_private::DataExtractor::GetAsLLVM(), lldb_private::ABI::GetMCRegisterInfo(), and m_data.
|
static |
Evaluate a DWARF location expression in a particular context.
[in] | exe_ctx | The execution context in which to evaluate the location expression. The location expression may access the target's memory, especially if it comes from the expression parser. |
[in] | opcode_ctx | The module which defined the expression. |
[in] | opcodes | This is a static method so the opcodes need to be provided explicitly. |
[in] | reg_ctx | An optional parameter which provides a RegisterContext for use when evaluating the expression (i.e. for fetching register values). Normally this will come from the ExecutionContext's StackFrame but in the case where an expression needs to be evaluated while building the stack frame list, this short-cut is available. |
[in] | reg_set | The call-frame-info style register kind. |
[in] | initial_value_ptr | A value to put on top of the interpreter stack before evaluating the expression, if the expression is parametrized. Can be NULL. |
[in] | result | A value into which the result of evaluating the expression is to be placed. |
[in] | error_ptr | If non-NULL, used to report errors in expression evaluation. |
Insertion point for evaluating multi-piece expression.
Definition at line 825 of file DWARFExpression.cpp.
References lldb_private::Value::AppendDataToHostBuffer(), lldb_private::Value::ClearContext(), lldb_private::Value::ConvertToLoadAddress(), DerefSizeExtractDataHelper(), lldb_private::plugin::dwarf::DW_OP_value_to_name(), lldb_private::ArchSpec::eCore_wasm32, error(), Evaluate_DW_OP_entry_value(), lldb_private::Expressions, lldb_private::Scalar::ExtractBitfield(), lldb_private::Value::FileAddress, lldb_private::Process::GetABI(), lldb_private::DataExtractor::GetAddress(), lldb_private::DataExtractor::GetAddressByteSize(), lldb_private::Target::GetArchitecture(), lldb_private::plugin::dwarf::DWARFBaseDIE::GetAttributeValueAsUnsigned(), lldb_private::Value::GetBuffer(), lldb_private::Process::GetByteOrder(), lldb_private::ObjectFile::GetByteOrder(), lldb_private::WritableDataBuffer::GetBytes(), lldb_private::DataExtractor::GetByteSize(), lldb_private::Scalar::GetByteSize(), lldb_private::DataBufferHeap::GetByteSize(), lldb_private::StackID::GetCallFrameAddress(), lldb_private::ArchSpec::GetCore(), lldb_private::StreamString::GetData(), lldb_private::DataExtractor::GetData(), lldb_private::StackFrame::GetFrameBaseValue(), lldb_private::ExecutionContext::GetFramePtr(), lldb_private::GetLog(), lldb_private::plugin::dwarf::DWARFUnit::GetOffset(), lldb_private::ExecutionContext::GetProcessPtr(), lldb_private::StackFrame::GetRegisterContext(), lldb_private::Value::GetScalar(), lldb_private::DataExtractor::GetSLEB128(), lldb_private::StackFrame::GetStackID(), lldb_private::plugin::dwarf::DWARFUnit::GetSymbolFileDWARF(), lldb_private::ExecutionContext::GetTargetPtr(), lldb_private::Thread::GetThreadLocalData(), lldb_private::ExecutionContext::GetThreadPtr(), lldb_private::DataExtractor::GetU16(), lldb_private::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU64(), lldb_private::DataExtractor::GetU8(), lldb_private::DataExtractor::GetULEB128(), lldb_private::Value::GetValueType(), lldb_private::Log::GetVerbose(), lldb_private::Value::HostAddress, lldb_private::Value::Invalid, lldb_private::Address::IsSectionOffset(), lldb_private::Scalar::IsZero(), LLDB_INVALID_ADDRESS, LLDB_LOG, LLDB_LOGF, lldb_private::Value::LoadAddress, lldb_private::Scalar::MakeSigned(), lldb_private::Memory, lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVendorDWARFOpcode(), lldb_private::Stream::Printf(), lldb_private::plugin::dwarf::DWARFUnit::ReadAddressFromDebugAddrSection(), lldb_private::Target::ReadMemory(), lldb_private::Process::ReadMemory(), lldb_private::Process::ReadPointerFromMemory(), ReadRegisterValueAsScalar(), lldb_private::Value::ResizeData(), ResolveLoadAddress(), lldb_private::Value::ResolveValue(), lldb_private::Value::Scalar, lldb_private::Scalar::TruncOrExtendTo(), lldb_private::Scalar::UInt128(), lldb_private::Scalar::ULongLong(), and lldb_private::DataExtractor::ValidOffset().
Referenced by lldb_private::DWARFExpressionList::Evaluate(), and ExtractDataMemberLocation().
|
inline |
Definition at line 143 of file DWARFExpression.h.
References lldb_private::DataExtractor::GetByteSize(), and m_data.
Referenced by lldb_private::DWARFExpressionList::Evaluate().
llvm::Expected< lldb::addr_t > DWARFExpression::GetLocation_DW_OP_addr | ( | const plugin::dwarf::DWARFUnit * | dwarf_cu | ) | const |
Return the address specified by the first DW_OP_{addr, addrx, GNU_addr_index} in the operation stream.
[in] | dwarf_cu | The dwarf unit this expression belongs to. Only required to resolve DW_OP{addrx, GNU_addr_index}. |
Definition at line 347 of file DWARFExpression.cpp.
References lldb_private::plugin::dwarf::DW_OP_value_to_name(), lldb_private::DataExtractor::GetAddress(), GetOpcodeDataSize(), lldb_private::DataExtractor::GetU8(), lldb_private::DataExtractor::GetULEB128(), LLDB_INVALID_ADDRESS, LLDB_INVALID_OFFSET, m_data, lldb_private::plugin::dwarf::DWARFUnit::ReadAddressFromDebugAddrSection(), and lldb_private::DataExtractor::ValidOffset().
RegisterKind DWARFExpression::GetRegisterKind | ( | ) | const |
Return the call-frame-info style register kind.
Definition at line 91 of file DWARFExpression.cpp.
References m_reg_kind.
Referenced by lldb_private::DWARFExpressionList::Evaluate().
bool DWARFExpression::IsValid | ( | ) | const |
Return true if the location expression contains data.
Definition at line 58 of file DWARFExpression.cpp.
References lldb_private::DataExtractor::GetByteSize(), and m_data.
bool DWARFExpression::LinkThreadLocalStorage | ( | const plugin::dwarf::DWARFUnit * | dwarf_cu, |
std::function< lldb::addr_t(lldb::addr_t file_addr)> const & | link_address_callback | ||
) |
Definition at line 449 of file DWARFExpression.cpp.
References lldb_private::DataExtractor::GetAddressByteSize(), lldb_private::DataExtractor::GetByteOrder(), lldb_private::DataExtractor::GetByteSize(), lldb_private::DataEncoder::GetDataBuffer(), lldb_private::DataExtractor::GetDataStart(), GetOpcodeDataSize(), lldb_private::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU64(), lldb_private::DataExtractor::GetU8(), LLDB_INVALID_ADDRESS, LLDB_INVALID_OFFSET, m_data, lldb_private::DataEncoder::PutUnsigned(), lldb_private::DataExtractor::SetData(), UINT32_MAX, and lldb_private::DataExtractor::ValidOffset().
Referenced by lldb_private::DWARFExpressionList::LinkThreadLocalStorage().
bool DWARFExpression::MatchesOperand | ( | StackFrame & | frame, |
const Instruction::Operand & | op | ||
) | const |
Definition at line 2342 of file DWARFExpression.cpp.
References lldb_private::Instruction::Operand::Dereference, lldb_private::StackFrame::GetFrameBaseExpression(), lldb_private::StackFrame::GetRegisterContext(), lldb_private::DataExtractor::GetSLEB128(), lldb_private::DataExtractor::GetU8(), lldb_private::DataExtractor::GetULEB128(), m_data, m_reg_kind, lldb_private::DWARFExpressionList::MatchesOperand(), and lldb_private::Instruction::Operand::Sum.
Referenced by lldb_private::DWARFExpressionList::MatchesOperand().
|
static |
Definition at line 2305 of file DWARFExpression.cpp.
References lldb_private::DWARFExpressionList::AddExpression(), lldb_private::DWARFExpressionList::Clear(), DWARFExpression(), error(), lldb_private::Expressions, lldb_private::DataExtractor::GetAddressByteSize(), lldb_private::plugin::dwarf::DWARFUnit::GetBaseAddress(), lldb_private::DataExtractor::GetByteOrder(), lldb_private::plugin::dwarf::DWARFUnit::GetLocationTable(), lldb_private::GetLog(), LLDB_INVALID_ADDRESS, LLDB_LOG_ERROR, lldb_private::plugin::dwarf::DWARFUnit::ReadAddressFromDebugAddrSection(), and lldb_private::DWARFExpressionList::Sort().
Referenced by lldb_private::plugin::dwarf::DWARFDebugInfoEntry::GetDIENamesAndRanges(), and GetExprListFromAtLocation().
void DWARFExpression::SetRegisterKind | ( | lldb::RegisterKind | reg_kind | ) |
Set the call-frame-info style register kind.
[in] | reg_kind | The register kind. |
Definition at line 93 of file DWARFExpression.cpp.
References m_reg_kind.
Referenced by ConvertPDBLocationToDWARFExpression(), CreateDWARFExpression(), MakeLocationExpressionInternal(), lldb_private::RegisterContextUnwind::ReadFrameAddress(), and lldb_private::RegisterContextUnwind::SavedLocationForRegister().
bool DWARFExpression::Update_DW_OP_addr | ( | const plugin::dwarf::DWARFUnit * | dwarf_cu, |
lldb::addr_t | file_addr | ||
) |
Definition at line 375 of file DWARFExpression.cpp.
References lldb_private::DataEncoder::AppendAddress(), lldb_private::DataEncoder::AppendData(), lldb_private::DataEncoder::AppendU8(), lldb_private::DataExtractor::GetAddressByteSize(), lldb_private::DataExtractor::GetByteOrder(), lldb_private::DataExtractor::GetByteSize(), lldb_private::DataExtractor::GetData(), lldb_private::DataEncoder::GetDataBuffer(), lldb_private::DataExtractor::GetDataStart(), GetOpcodeDataSize(), lldb_private::DataExtractor::GetU8(), lldb_private::DataExtractor::GetULEB128(), LLDB_INVALID_OFFSET, m_data, lldb_private::DataEncoder::PutAddress(), lldb_private::DataExtractor::SetData(), UINT32_MAX, and lldb_private::DataExtractor::ValidOffset().
Referenced by fixupExternalAddrZeroVariable(), and lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE().
void DWARFExpression::UpdateValue | ( | uint64_t | const_value, |
lldb::offset_t | const_value_byte_size, | ||
uint8_t | addr_byte_size | ||
) |
Definition at line 60 of file DWARFExpression.cpp.
References lldb_private::endian::InlHostByteOrder(), m_data, lldb_private::DataExtractor::SetAddressByteSize(), lldb_private::DataExtractor::SetByteOrder(), and lldb_private::DataExtractor::SetData().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARF::ParseVariableDIE().
|
private |
A data extractor capable of reading opcode bytes.
Definition at line 154 of file DWARFExpression.h.
Referenced by ContainsThreadLocalStorage(), DumpLocation(), GetExpressionData(), GetLocation_DW_OP_addr(), IsValid(), LinkThreadLocalStorage(), MatchesOperand(), Update_DW_OP_addr(), and UpdateValue().
|
private |
One of the defines that starts with LLDB_REGKIND_.
Definition at line 157 of file DWARFExpression.h.
Referenced by GetRegisterKind(), MatchesOperand(), and SetRegisterKind().