================
@@ -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:

> 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 guess, if you define the "start of a block" as "the lowest address in the 
block". This definition is sort of what I have a problem with because we have 
also defined the "start of a function" as the "lowest address in the function", 
but then also used it as "the entry point of the function", and this was fine 
until it wasn't. I don't think we're going to have the same problem with blocks 
that we did with functions, but I don't think this is completely right either. 
I also don't really have an alternative proposal, and we already do have 
`Block::GetStartAddress`, which I have no intention of touching, so if you say 
this is okay, I'm happy to go along with it.

https://github.com/llvm/llvm-project/pull/123340
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to