[Lldb-commits] [lldb] [lldb] Add Function::GetAddress and redirect some uses (PR #115836)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 14 07:42:28 PST 2024


================
@@ -407,6 +406,15 @@ CompileUnit *Function::GetCompileUnit() { return m_comp_unit; }
 
 const CompileUnit *Function::GetCompileUnit() const { return m_comp_unit; }
 
+Address Function::GetAddress() const {
+  if (m_ranges.empty())
+    return Address();
+  // We're using a (DWARF-like) convention where the base address of the first
+  // interval denotes the entry point of the function. If that turns out to be
+  // insufficient, we can introduce a separate "entry point address" field.
+  return m_ranges[0].GetBaseAddress();
----------------
labath wrote:

Also having written this, I realized that this patch does make a functional change (for the better) -- lldb will now correctly return the entry point of the function in case its entry point is not its lowest address. I'm going to add a test case for that.

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


More information about the lldb-commits mailing list