14#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
20static llvm::FormattedNumber
FormatAddress(uint64_t addr, uint32_t addr_size) {
23 return llvm::format_hex(addr, 2 + 2 * addr_size);
33 const auto *expr =
m_exprs.GetEntryAtIndex(0);
52 return expr->GetExpressionData(data);
63std::optional<DWARFExpressionList::DWARFExpressionEntry>
75 if (load_addr < func_load_addr)
85 if (
const auto *entry =
m_exprs.FindEntryThatContains(file_pc)) {
87 entry->GetRangeEnd() - entry->GetRangeBase());
103 uint32_t index =
m_exprs.FindEntryIndexThatContains(addr);
106 return &
m_exprs.GetEntryAtIndex(index)->data;
113 return &
m_exprs.GetMutableEntryAtIndex(0)->data;
117 uint32_t index =
m_exprs.FindEntryIndexThatContains(addr);
120 return &
m_exprs.GetMutableEntryAtIndex(index)->data;
137 &link_address_callback) {
161 expr = &
m_exprs.GetEntryAtIndex(0)->data;
184 llvm::ListSeparator separator;
186 expr->DumpLocation(s, level, abi);
189 for (
const Entry &entry : *
this) {
193 (file_addr < load_base || file_addr >= load_end))
195 const auto &expr = entry.
data;
197 expr.GetExpressionData(data);
206 expr.DumpLocation(s, level, abi);
218 m_exprs.Back()->data.DumpLocation(s, level, abi);
221 os << llvm::format(
"0x%8.8" PRIx64
": ", 0);
222 for (
const Entry &entry : *
this) {
223 const auto &expr = entry.
data;
225 expr.GetExpressionData(data);
234 expr.DumpLocation(s, level, abi);
238llvm::Expected<const DWARFExpression *>
251 return llvm::createStringError(
"no frame");
254 return llvm::createStringError(
"no register context");
255 reg_ctx_sp->GetPCForSymbolication(
pc);
259 return llvm::createStringError(
"invalid PC in frame");
265 return llvm::createStringError(
"variable not available");
272 const Value *object_address_ptr)
const {
273 llvm::Expected<const DWARFExpression *> expr =
276 return expr.takeError();
280 (*expr)->GetExpressionData(data);
290 llvm::Expected<const DWARFExpression *> expr =
294 llvm::consumeError(expr.takeError());
static llvm::FormattedNumber FormatAddress(uint64_t addr, uint32_t addr_size)
Format addr as a zero-padded hex address of addr_size bytes.
A section + offset based address range class.
A section + offset based address class.
lldb::addr_t GetFileAddress() const
Get the file address.
bool IsAlwaysValidSingleExpr() const
llvm::Expected< const DWARFExpression * > GetExpressionAtPC(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr) const
Return the expression in scope at the current PC, or an error if no location is in scope.
bool AddExpression(lldb::addr_t base, lldb::addr_t end, DWARFExpression expr)
const DWARFExpression * GetExpressionAtAddress(lldb::addr_t func_load_addr, lldb::addr_t load_addr) const
const DWARFExpression::Delegate * m_dwarf_cu
The DWARF compile unit this expression belongs to.
void GetDescription(Stream *s, lldb::DescriptionLevel level, ABI *abi) const
Dump all locaitons with each separated by new line.
bool IsImplicit(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr) const
Return true if the expression in scope at the current PC produces an implicit location,...
bool MatchesOperand(StackFrame &frame, const Instruction::Operand &operand) const
const_iterator end() const
llvm::Expected< Value > Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr) const
bool ContainsThreadLocalStorage() const
const DWARFExpression * GetAlwaysValidExpr() const
lldb::addr_t m_func_file_addr
lldb::ModuleWP m_module_wp
Module which defined this expression.
bool GetExpressionData(DataExtractor &data, lldb::addr_t func_load_addr=LLDB_INVALID_ADDRESS, lldb::addr_t file_addr=0) const
Get the expression data at the file address.
std::optional< DWARFExpressionEntry > GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, lldb::addr_t load_addr) const
Returns a DWARFExpressionEntry whose file_range contains the given loadâaddress.
bool DumpLocations(Stream *s, lldb::DescriptionLevel level, lldb::addr_t func_load_addr, lldb::addr_t file_addr, ABI *abi) const
Dump locations that contains file_addr if it's valid.
bool LinkThreadLocalStorage(lldb::ModuleSP new_module_sp, std::function< lldb::addr_t(lldb::addr_t file_addr)> const &link_address_callback)
bool ContainsAddress(lldb::addr_t func_load_addr, lldb::addr_t addr) const
Search for a load address in the dwarf location list.
DWARFExpression * GetMutableExpressionAtAddress(lldb::addr_t func_load_addr=LLDB_INVALID_ADDRESS, lldb::addr_t load_addr=0)
"lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location expression and interprets it.
static llvm::Expected< Value > Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::ModuleSP module_sp, const DataExtractor &opcodes, const Delegate *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.
bool ContainsThreadLocalStorage(const Delegate *dwarf_cu) const
bool LinkThreadLocalStorage(const Delegate *dwarf_cu, std::function< lldb::addr_t(lldb::addr_t file_addr)> const &link_address_callback)
bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op) const
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
const Address & GetAddress() const
Return the address of the function (its entry point).
bool GetPCForSymbolication(Address &address)
Get an address suitable for symbolication.
This base class provides an interface to stack frames.
virtual lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
virtual Address GetFrameCodeAddressForSymbolication()
Get the current code Address suitable for symbolication, may not be the same as GetFrameCodeAddress()...
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
unsigned GetIndentLevel() const
Get the current indentation level.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
std::shared_ptr< lldb_private::Module > ModuleSP
RegisterKind
Register numbering types.
Represents an entry in the DWARFExpressionList with all needed metadata.
BaseType GetRangeBase() const
BaseType GetRangeEnd() const