[llvm] 0bd48c3 - [DebugInfo] Support file-level include directories when generating DWARFv5 LineTable prologues.
    David Blaikie via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Feb 10 12:32:33 PST 2020
    
    
  
Author: Sterling Augustine
Date: 2020-02-10T12:24:46-08:00
New Revision: 0bd48c3d4ee1a94ea3d3b9d89201b23fd83c94d0
URL: https://github.com/llvm/llvm-project/commit/0bd48c3d4ee1a94ea3d3b9d89201b23fd83c94d0
DIFF: https://github.com/llvm/llvm-project/commit/0bd48c3d4ee1a94ea3d3b9d89201b23fd83c94d0.diff
LOG: [DebugInfo] Support file-level include directories when generating DWARFv5 LineTable prologues.
Differential Revision: https://reviews.llvm.org/D74249
Added: 
    
Modified: 
    llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
    llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
index 428f48ef08b9..5d037463b636 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -180,7 +180,7 @@ void checkDefaultPrologue(uint16_t Version, DwarfFormat Format,
     UnitLength = PrologueLength + 2;
     break;
   case 5:
-    PrologueLength = 39;
+    PrologueLength = 42;
     UnitLength = PrologueLength + 4;
     EXPECT_EQ(Prologue.getAddressSize(), 8u);
     EXPECT_EQ(Prologue.SegSelectorSize, 0u);
@@ -204,6 +204,7 @@ void checkDefaultPrologue(uint16_t Version, DwarfFormat Format,
   EXPECT_STREQ(*Prologue.IncludeDirectories[0].getAsCString(), "a dir");
   ASSERT_EQ(Prologue.FileNames.size(), 1u);
   ASSERT_EQ(Prologue.FileNames[0].Name.getForm(), DW_FORM_string);
+  ASSERT_EQ(Prologue.FileNames[0].DirIdx, 0u);
   EXPECT_STREQ(*Prologue.FileNames[0].Name.getAsCString(), "a file");
 }
 
diff  --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
index f11e7c3a8407..e8662a59bf89 100644
--- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
@@ -164,8 +164,8 @@ DWARFDebugLine::Prologue dwarfgen::LineTable::createBasicPrologue() const {
     P.PrologueLength = 36;
     break;
   case 5:
-    P.TotalLength = 47;
-    P.PrologueLength = 39;
+    P.TotalLength = 50;
+    P.PrologueLength = 42;
     P.FormParams.AddrSize = AddrSize;
     break;
   default:
@@ -343,13 +343,16 @@ static void writeV5IncludeAndFileTable(const DWARFDebugLine::Prologue &Prologue,
     writeCString(*Include.getAsCString(), Asm);
   }
 
-  Asm.emitInt8(1); // file_name_entry_format_count.
+  Asm.emitInt8(2); // file_name_entry_format_count.
   Asm.EmitULEB128(DW_LNCT_path);
   Asm.EmitULEB128(DW_FORM_string);
+  Asm.EmitULEB128(DW_LNCT_directory_index);
+  Asm.EmitULEB128(DW_FORM_data1);
   Asm.EmitULEB128(Prologue.FileNames.size());
   for (auto File : Prologue.FileNames) {
     assert(File.Name.getAsCString() && "expected a string form for file name");
     writeCString(*File.Name.getAsCString(), Asm);
+    Asm.emitInt8(File.DirIdx);
   }
 }
 
        
    
    
More information about the llvm-commits
mailing list