[Lldb-commits] [lldb] r118830 - /lldb/trunk/source/Symbol/Function.cpp

Greg Clayton gclayton at apple.com
Thu Nov 11 12:13:30 PST 2010


Author: gclayton
Date: Thu Nov 11 14:13:30 2010
New Revision: 118830

URL: http://llvm.org/viewvc/llvm-project?rev=118830&view=rev
Log:
Fixed an issue with Function::GetPrologueByteSize() where if a function's first line table entry didn't have the same address as the start address of the function itself, we could end up returning and incorrect value.

Modified:
    lldb/trunk/source/Symbol/Function.cpp

Modified: lldb/trunk/source/Symbol/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Function.cpp?rev=118830&r1=118829&r2=118830&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Function.cpp (original)
+++ lldb/trunk/source/Symbol/Function.cpp Thu Nov 11 14:13:30 2010
@@ -500,7 +500,16 @@
         {
             LineEntry line_entry;
             if (line_table->FindLineEntryByAddress(GetAddressRange().GetBaseAddress(), line_entry))
-                m_prologue_byte_size = line_entry.range.GetByteSize();
+            {
+                // We need to take the delta of the end of the first line entry
+                // as a file address and the start file address of the function
+                // in case the first line entry doesn't start at the beginning 
+                // of the function.
+                const addr_t func_start_file_addr = m_range.GetBaseAddress().GetFileAddress();
+                const addr_t line_entry_end_file_addr = line_entry.range.GetBaseAddress().GetFileAddress() + line_entry.range.GetByteSize();
+                if (line_entry_end_file_addr > func_start_file_addr)
+                    m_prologue_byte_size = line_entry_end_file_addr - func_start_file_addr;
+            }
         }
     }
     return m_prologue_byte_size;





More information about the lldb-commits mailing list