[Lldb-commits] [lldb] [lldb] Add SymbolContext::GetFunctionOrSymbolAddress (PR #123340)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 24 01:32:00 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;
+    }
+  }
----------------
labath wrote:

Okay, please take a look at the new version. I had to inline the old implementation into one place (CommandObjectTarget, for `image lookup`), but generally, I think this looks better than what I expected.

https://github.com/llvm/llvm-project/pull/123340


More information about the lldb-commits mailing list