|
LLDB mainline
|
#include "lldb/Expression/DWARFExpression.h"#include <cinttypes>#include <limits>#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/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/LanguageRuntime.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/DWARFExpressionUnit.h"#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"#include "llvm/Support/ErrorExtras.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 std::optional< Value > | EvaluateEntryValueInLanguageRuntime (EvalContext &eval_ctx, llvm::ArrayRef< uint8_t > entry_value, llvm::ArrayRef< uint8_t > &following) |
Asks the language runtime of the current function to evaluate DW_OP_entry_value(entry_value), possibly together with some of the following operations, which it consumes. | |
| static llvm::Error | Evaluate_DW_OP_entry_value (EvalContext &eval_ctx, llvm::ArrayRef< uint8_t > subexpr) |
| static void | UpdateValueTypeFromLocationDescription (EvalContext &eval_ctx, LocationDescriptionKind kind, Value *value=nullptr) |
| Adjust value's ValueType according to the kind of location description. | |
| static llvm::Expected< lldb::addr_t > | ResolveLoadAddress (EvalContext &eval_ctx, 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 load sized data from a uint8_t buffer. | |
| static llvm::Error | Evaluate_DW_OP_deref (EvalContext &eval_ctx, LocationAtom opcode, unsigned size, size_t size_addr_bytes) |
| static std::optional< uint64_t > | BitsToBytes (uint64_t bit_size) |
| static uint8_t | GetBitMask (uint64_t bit_offset, lldb::ByteOrder byte_order) |
| static llvm::Error | AppendPieceToComposite (EvalContext &eval_ctx, const Value &piece, uint64_t piece_bit_size) |
| Appends an eagerly materialized piece at the next composite bit offset. | |
| static llvm::Error | Evaluate_DW_OP_piece (EvalContext &eval_ctx, uint64_t piece_byte_size) |
| static llvm::Error | Evaluate_DW_OP_convert (EvalContext &eval_ctx, uint64_t relative_die_offset) |
| static llvm::Error | Evaluate_DW_OP_form_tls_address (EvalContext &eval_ctx, LocationAtom opcode) |
| static llvm::Error | Evaluate_DW_OP_fbreg (EvalContext &eval_ctx, int64_t fbreg_offset) |
| static llvm::Error | Evaluate_DW_OP_call_frame_cfa (EvalContext &eval_ctx) |
| static llvm::Error | CheckScalarOperandsHaveSameType (const Scalar &lhs, const Scalar &rhs, LocationAtom opcode, size_t address_size) |
| static bool | IsPotentiallyGenericIntegerOperand (const Scalar &operand, size_t address_size) |
|
static |
Appends an eagerly materialized piece at the next composite bit offset.
Definition at line 1153 of file DWARFExpression.cpp.
References bit, BitsToBytes(), lldb::eByteOrderBig, lldb::eByteOrderLittle, error(), lldb_private::Value::FileAddress, lldb_private::Scalar::GetAsMemoryData(), GetBitMask(), lldb_private::Value::GetBuffer(), lldb_private::WritableDataBuffer::GetBytes(), lldb_private::DataBufferHeap::GetByteSize(), lldb_private::Value::GetScalar(), lldb_private::Value::GetValueType(), lldb_private::Value::HostAddress, lldb_private::Value::Invalid, lldb_private::Value::LoadAddress, lldb_private::Value::ResizeData(), and lldb_private::Value::Scalar.
Referenced by lldb_private::DWARFExpression::Evaluate(), and Evaluate_DW_OP_piece().
|
static |
Definition at line 1139 of file DWARFExpression.cpp.
Referenced by AppendPieceToComposite().
|
static |
Definition at line 1526 of file DWARFExpression.cpp.
References DW_OP_value_to_name(), lldb_private::Scalar::e_int, lldb_private::Scalar::GetByteSize(), lldb_private::Scalar::GetType(), and lldb_private::Scalar::IsSigned().
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Helper function to load sized data from a uint8_t buffer.
| addr_bytes | The buffer containing raw data. |
| size_addr_bytes | How large is the underlying raw data. |
| byte_order | What is the byte order of the underlying data. |
| size | How much of the underlying data we want to use. |
Definition at line 977 of file DWARFExpression.cpp.
References lldb_private::DataExtractor::GetAddress(), and lldb_private::DataExtractor::GetMaxU64().
Referenced by Evaluate_DW_OP_deref().
|
static |
Definition at line 460 of file DWARFExpression.cpp.
Referenced by CheckScalarOperandsHaveSameType(), lldb_private::DWARFExpression::Evaluate(), Evaluate_DW_OP_deref(), and lldb_private::DWARFExpression::GetLocation_DW_OP_addr().
|
static |
Definition at line 1505 of file DWARFExpression.cpp.
References lldb_private::StackFrame::GetStackID(), LLDB_INVALID_ADDRESS, and lldb_private::Value::LoadAddress.
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Definition at line 1381 of file DWARFExpression.cpp.
References lldb_private::Scalar::e_float, lldb_private::Scalar::FloatPromote(), lldb_private::Scalar::GetAPFloat(), lldb_private::DWARFExpression::Delegate::GetDIEBitSizeAndEncoding(), lldb_private::Scalar::GetType(), and lldb_private::Scalar::TruncOrExtendTo().
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Definition at line 988 of file DWARFExpression.cpp.
References DerefSizeExtractDataHelper(), DW_OP_value_to_name(), error(), lldb_private::Value::FileAddress, lldb_private::ObjectFile::GetByteOrder(), lldb_private::Process::GetByteOrder(), lldb_private::Value::HostAddress, lldb_private::Value::Invalid, lldb_private::Address::IsSectionOffset(), LLDB_INVALID_ADDRESS, lldb_private::Value::LoadAddress, lldb_private::Memory, lldb_private::Process::ReadMemory(), lldb_private::Target::ReadMemory(), ResolveLoadAddress(), lldb_private::Value::Scalar, and lldb_private::Scalar::TruncOrExtendTo().
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Definition at line 716 of file DWARFExpression.cpp.
References lldb_private::DataExtractor::BytesLeft(), lldb_private::DWARFExpressionList::Evaluate(), lldb_private::Expressions, lldb_private::SymbolContext::function, lldb_private::Function::GetCallEdgeForReturnAddress(), lldb_private::CallEdge::GetCallee(), lldb_private::CallEdge::GetCallSiteParameters(), lldb_private::DataExtractor::GetData(), lldb_private::StackFrame::GetFrameIndex(), lldb_private::ExecutionContext::GetFramePtr(), lldb_private::Target::GetImages(), lldb_private::GetLog(), lldb_private::Function::GetName(), lldb_private::StackFrame::GetSymbolContext(), lldb_private::Function::GetTailCallingEdges(), lldb_private::ExecutionContext::GetTargetRef(), lldb_private::ExecutionContext::GetThreadPtr(), lldb_private::ExecutionContext::HasTargetScope(), LLDB_INVALID_ADDRESS, LLDB_LOG, lldb_private::CallSiteParameter::LocationInCaller, and lldb_private::ExecutionContext::SetFrameSP().
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Definition at line 1488 of file DWARFExpression.cpp.
References lldb_private::StackFrame::GetFrameBaseValue(), and lldb_private::Value::LoadAddress.
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Definition at line 1458 of file DWARFExpression.cpp.
References lldb_private::ExecutionContext::GetThreadPtr(), LLDB_INVALID_ADDRESS, and lldb_private::Value::LoadAddress.
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Definition at line 1256 of file DWARFExpression.cpp.
References AppendPieceToComposite(), lldb_private::Value::ConvertToLoadAddress(), error(), lldb_private::Scalar::ExtractBitfield(), lldb_private::Value::FileAddress, lldb_private::Value::GetBuffer(), lldb_private::WritableDataBuffer::GetBytes(), lldb_private::DataBufferHeap::GetByteSize(), lldb_private::Scalar::GetByteSize(), lldb_private::Value::GetScalar(), lldb_private::Value::GetValueType(), lldb_private::Value::HostAddress, lldb_private::Value::Invalid, LLDB_INVALID_ADDRESS, lldb_private::Value::LoadAddress, lldb_private::Memory, lldb_private::Target::ReadMemory(), lldb_private::Value::ResizeData(), lldb_private::Value::Scalar, lldb_private::Scalar::TruncOrExtendTo(), lldb_private::Scalar::ULongLong(), and UpdateValueTypeFromLocationDescription().
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Asks the language runtime of the current function to evaluate DW_OP_entry_value(entry_value), possibly together with some of the following operations, which it consumes.
Definition at line 692 of file DWARFExpression.cpp.
References lldb_private::LanguageRuntime::EvaluateEntryValue(), lldb_private::SymbolContext::function, lldb_private::Function::GetLanguage(), lldb_private::Process::GetLanguageRuntime(), and lldb_private::StackFrame::GetSymbolContext().
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Definition at line 1145 of file DWARFExpression.cpp.
References lldb::eByteOrderBig.
Referenced by AppendPieceToComposite().
|
static |
Return the length in bytes of the set of operands for op.
No guarantees are made on the state of data after this call.
Definition at line 197 of file DWARFExpression.cpp.
References lldb_private::DataExtractor::GetAddressByteSize(), lldb_private::DWARFExpression::Delegate::GetAddressByteSize(), lldb_private::DataExtractor::GetU8(), lldb_private::DataExtractor::GetULEB128(), lldb_private::DWARFExpression::Delegate::GetVendorDWARFOpcodeSize(), LLDB_INVALID_OFFSET, and lldb_private::DataExtractor::Skip_LEB128().
Referenced by lldb_private::DWARFExpression::ContainsThreadLocalStorage(), lldb_private::DWARFExpression::GetLocation_DW_OP_addr(), lldb_private::DWARFExpression::IsImplicit(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), and lldb_private::DWARFExpression::Update_DW_OP_addr().
Definition at line 1578 of file DWARFExpression.cpp.
References lldb_private::Scalar::e_int, lldb_private::Scalar::GetByteSize(), and lldb_private::Scalar::GetType().
Referenced by lldb_private::DWARFExpression::Evaluate().
|
static |
Helper function to move common code used to resolve a file address and turn into a load address.
| eval_ctx | Evaluation context (provides exe_ctx and module_sp). |
| dw_op_type | C-style string used to vary the error output |
| file_addr | the file address we are trying to resolve and turn into a load address |
| so_addr | out parameter, will be set to load address or section offset |
| check_sectionoffset | bool which determines if having a section offset but not a load address is considerd a success |
Definition at line 951 of file DWARFExpression.cpp.
References lldb_private::Address::GetLoadAddress(), lldb_private::Address::IsSectionOffset(), and LLDB_INVALID_ADDRESS.
Referenced by ProcessMachCore::DoGetMemoryRegionInfo(), and Evaluate_DW_OP_deref().
|
static |
Adjust value's ValueType according to the kind of location description.
Definition at line 902 of file DWARFExpression.cpp.
References Empty, lldb_private::Expressions, lldb_private::GetLog(), lldb_private::DWARFExpression::Delegate::GetVersion(), LLDB_LOGF, lldb_private::Value::LoadAddress, lldb_private::Memory, and lldb_private::Value::Scalar.
Referenced by lldb_private::DWARFExpression::Evaluate(), and Evaluate_DW_OP_piece().