[Lldb-commits] [lldb] r247788 - Fix prologue end handling when code compiled by gcc

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 16 05:36:39 PDT 2015


Author: tberghammer
Date: Wed Sep 16 07:36:37 2015
New Revision: 247788

URL: http://llvm.org/viewvc/llvm-project?rev=247788&view=rev
Log:
Fix prologue end handling when code compiled by gcc

GCC don't use the is_prologue_end flag to mark the first instruction
after the prologue. Instead of it it is issuing a line table entry for
the first instruction of the prologue and one for the first instruction
after the prologue. If the size of the prologue is 0 instruction then
the 2 line entry will have the same file address.

We remove these duplicates entries as they are violating the dwarf spec
and can cause confusion in the debugger. To prevent the lost of
information about the end of prologue we should set the prologue end
flag for the line entries what are representing more then 1 entry.

Differential revision: http://reviews.llvm.org/D12757

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

Modified: lldb/trunk/source/Symbol/LineTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineTable.cpp?rev=247788&r1=247787&r2=247788&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LineTable.cpp (original)
+++ lldb/trunk/source/Symbol/LineTable.cpp Wed Sep 16 07:36:37 2015
@@ -104,7 +104,17 @@ LineTable::AppendLineEntryToSequence
     // here to avoid these kinds of inconsistencies. We will need tor revisit this if the DWARF line
     // tables are updated to allow multiple entries at the same address legally.
     if (!entries.empty() && entries.back().file_addr == file_addr)
+    {
+        // GCC don't use the is_prologue_end flag to mark the first instruction after the prologue.
+        // Instead of it it is issueing a line table entry for the first instruction of the prologue
+        // and one for the first instruction after the prologue. If the size of the prologue is 0
+        // instruction then the 2 line entry will have the same file address. Removing it will remove
+        // our ability to properly detect the location of the end of prologe so we set the prologue_end
+        // flag to preserve this information (setting the prologue_end flag for an entry what is after
+        // the prologue end don't have any effect)
+        entry.is_prologue_end = entry.file_idx == entries.back().file_idx;
         entries.back() = entry;
+    }
     else
         entries.push_back (entry);
 }




More information about the lldb-commits mailing list