================
@@ -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;
+ }
+ }
----------------
labath wrote:
Okay, everything you've said now makes sense to me, including the part about
the confusion between the function block and the function itself (it is as you
described, for the block we would return the lowest address).
I think we could fix that by changing Block::GetStartAddress for function
blocks. Basically to change this:
```
if (function) {
addr = function->GetAddress();
addr.Slide(m_ranges.GetEntryRef(0).GetRangeBase());
return true;
}
```
into something like this:
```
if (function) {
addr = function->GetAddress();
if (bool is_function_block = GetParent() == nullptr; !is_function_block)
addr.Slide(m_ranges.GetEntryRef(0).GetRangeBase());
return true;
}
```
Would that be acceptable?
The other option I see is to ditch the SymbolContextItem flags and rename the
function into something that makes it clear that it only considers functions
and symbols. The implementation of that should be easy, we only need to figure
out the name. I don't want it to be too obscure, as I think this is the thing
that a lot of callers will actually want to use, but it should also be clear
about what its doing. `GetFunctionOrSymbolAddress` is the best I can come up
with right now.
https://github.com/llvm/llvm-project/pull/123340
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits