[Lldb-commits] [lldb] [lldb] Fix prologue size calculation for discontinuous functions (PR #131597)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 19 04:36:06 PDT 2025


================
@@ -662,10 +662,12 @@ uint32_t Function::GetPrologueByteSize() {
           }
         }
 
-        const addr_t func_start_file_addr =
-            m_range.GetBaseAddress().GetFileAddress();
-        const addr_t func_end_file_addr =
-            func_start_file_addr + m_range.GetByteSize();
+        AddressRange entry_range;
+        m_block.GetRangeContainingAddress(m_address, entry_range);
+        const addr_t range_start_file_addr = m_address.GetFileAddress();
+        const addr_t range_end_file_addr =
+            entry_range.GetBaseAddress().GetFileAddress() +
+            entry_range.GetByteSize();
----------------
labath wrote:

Yes, because in the most general case, the entry point may not be at the start of any particular range (either because of a perverse compiler or because the linker placed two of the ranges next to each other and we have merged them into one).

I'm going to add a comment about that.

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


More information about the lldb-commits mailing list