[Lldb-commits] [lldb] [lldb] Add SymbolContext::GetAddress (PR #123340)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 21 09:53:05 PST 2025
================
@@ -370,6 +370,31 @@ bool SymbolContext::GetAddressRange(uint32_t scope, uint32_t range_idx,
return false;
}
+Address SymbolContext::GetAddress(uint32_t scope,
+ bool use_inline_block_range) const {
+ if ((scope & eSymbolContextLineEntry) && line_entry.IsValid())
+ return line_entry.range.GetBaseAddress();
+
+ if (scope & eSymbolContextBlock) {
+ Block *block_to_use = (block && use_inline_block_range)
+ ? block->GetContainingInlinedBlock()
+ : block;
+ if (block_to_use) {
+ Address addr;
+ block_to_use->GetStartAddress(addr);
+ return addr;
+ }
+ }
----------------
jimingham wrote:
Giving a single address to a block considered as a logical entity is problematic, but the address of the start of the block referenced by a SymbolContext doesn't have that problem. I think the confusing part is the fact that we call what is in the symbol context "Block" rather than "BlockElement" or something. We don't make a distinction between logical blocks and the address ranges that constitute them the way a Function is the logical entity that organizes the block(s) that constitute it.
But for instance, when the "step through range targeting function" wants to limit the stepping range to the extent of the block we're currently sitting in, getting the SymbolContext from the current address and using that block element is what you need to do. Note, in that case we use the end address rather than the start but the idea is still the same.
https://github.com/llvm/llvm-project/pull/123340
More information about the lldb-commits
mailing list