[llvm] r324669 - [DWARFv5] Fix dumper to show the file table starts at index 0.

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 15:08:02 PST 2018


Author: probinson
Date: Thu Feb  8 15:08:02 2018
New Revision: 324669

URL: http://llvm.org/viewvc/llvm-project?rev=324669&view=rev
Log:
[DWARFv5] Fix dumper to show the file table starts at index 0.

Emitting the correct (root of compilation) file at index 0 will be
posted for review later; I wanted to get this minor change out of the
way first.

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll
    llvm/trunk/test/DebugInfo/X86/dwarfdump-header-64.s
    llvm/trunk/test/DebugInfo/X86/dwarfdump-header.s
    llvm/trunk/test/DebugInfo/X86/dwarfdump-line-only.s
    llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s
    llvm/trunk/test/MC/ELF/debug-md5.s

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=324669&r1=324668&r2=324669&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Thu Feb  8 15:08:02 2018
@@ -93,9 +93,12 @@ void DWARFDebugLine::Prologue::dump(raw_
       OS << "                Dir  Mod Time   File Len   File Name\n"
          << "                ---- ---------- ---------- -----------"
             "----------------\n";
+    // DWARF v5 starts file indexes at 0.
+    uint32_t FileBase = getVersion() >= 5 ? 0 : 1;
     for (uint32_t I = 0; I != FileNames.size(); ++I) {
       const FileNameEntry &FileEntry = FileNames[I];
-      OS << format("file_names[%3u] %4" PRIu64 " ", I + 1, FileEntry.DirIdx);
+      OS << format("file_names[%3u] %4" PRIu64 " ", I + FileBase,
+                   FileEntry.DirIdx);
       if (HasMD5)
         OS << FileEntry.Checksum.digest();
       else

Modified: llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll?rev=324669&r1=324668&r2=324669&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/dwarf-md5.ll Thu Feb  8 15:08:02 2018
@@ -21,8 +21,8 @@
 ; OBJ-4: file_names[ 2] 1 0x00000000 0x00000000 "t2.h"
 
 ; OBJ-5: Dir MD5 Checksum File Name
-; OBJ-5: file_names[ 1] 1 11111111111111111111111111111111 "t1.h"
-; OBJ-5: file_names[ 2] 1 22222222222222222222222222222222 "t2.h"
+; OBJ-5: file_names[ 0] 1 11111111111111111111111111111111 "t1.h"
+; OBJ-5: file_names[ 1] 1 22222222222222222222222222222222 "t2.h"
 
 ; ModuleID = 't.c'
 source_filename = "t.c"

Modified: llvm/trunk/test/DebugInfo/X86/dwarfdump-header-64.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarfdump-header-64.s?rev=324669&r1=324668&r2=324669&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarfdump-header-64.s (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarfdump-header-64.s Thu Feb  8 15:08:02 2018
@@ -144,6 +144,6 @@ LH_5_end:
 # CHECK: include_directories[  0] = .debug_str[0x00000028] = "Directory5a"
 # CHECK: include_directories[  1] = .debug_str[0x00000034] = "Directory5b"
 # CHECK-NOT: include_directories
-# CHECK: file_names[  1]    0 0x00000051 0x00000052 "File5a"
-# CHECK: file_names[  2]    1 0x00000053 0x00000054 "File5b"
+# CHECK: file_names[  0]    0 0x00000051 0x00000052 "File5a"
+# CHECK: file_names[  1]    1 0x00000053 0x00000054 "File5b"
 # CHECK-NOT: file_names

Modified: llvm/trunk/test/DebugInfo/X86/dwarfdump-header.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarfdump-header.s?rev=324669&r1=324668&r2=324669&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarfdump-header.s (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarfdump-header.s Thu Feb  8 15:08:02 2018
@@ -330,8 +330,8 @@ LH_5_end:
 # CHECK: include_directories[  1] = .debug_str[0x00000051] = "Directory5b"
 # CHECK-NOT: include_directories
 # CHECK: MD5 Checksum
-# CHECK: file_names[  1]    0 00112233445566778899aabbccddeeff .debug_line_str[0x00000000] = "File5a"
-# CHECK: file_names[  2]    1 ffeeddccbbaa99887766554433221100 .debug_line_str[0x00000007] = "File5b"
+# CHECK: file_names[  0]    0 00112233445566778899aabbccddeeff .debug_line_str[0x00000000] = "File5a"
+# CHECK: file_names[  1]    1 ffeeddccbbaa99887766554433221100 .debug_line_str[0x00000007] = "File5b"
 # CHECK-NOT: file_names
 
         .section .debug_line_str,"MS", at progbits,1
@@ -410,6 +410,6 @@ dwo_LH_5_end:
 # CHECK: include_directories[  0] = .debug_str[0x0000003d] = "DWODirectory5a"
 # CHECK: include_directories[  1] = .debug_str[0x0000004c] = "DWODirectory5b"
 # CHECK-NOT: include_directories
-# CHECK: file_names[  1]    0 0x00000015 0x00000025 "DWOFile5a"
-# CHECK: file_names[  2]    1 0x00000035 0x00000045 "DWOFile5b"
+# CHECK: file_names[  0]    0 0x00000015 0x00000025 "DWOFile5a"
+# CHECK: file_names[  1]    1 0x00000035 0x00000045 "DWOFile5b"
 # CHECK-NOT: file_names

Modified: llvm/trunk/test/DebugInfo/X86/dwarfdump-line-only.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarfdump-line-only.s?rev=324669&r1=324668&r2=324669&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarfdump-line-only.s (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarfdump-line-only.s Thu Feb  8 15:08:02 2018
@@ -94,7 +94,7 @@ ls_F2:  .asciz "File2"
 # CHECK: include_directories[  0] = .debug_str[0x00000000] = "Directory1"
 # CHECK: include_directories[  1] = .debug_str[0x0000000b] = "Directory2"
 # CHECK-NOT: include_directories
-# CHECK: file_names[  1]    1 0x00000051 0x00000052 .debug_line_str[0x00000000] = "File1"
-# CHECK: file_names[  2]    0 0x00000053 0x00000054 .debug_line_str[0x00000006] = "File2"
+# CHECK: file_names[  0]    1 0x00000051 0x00000052 .debug_line_str[0x00000000] = "File1"
+# CHECK: file_names[  1]    0 0x00000053 0x00000054 .debug_line_str[0x00000006] = "File2"
 # CHECK-NOT: file_names
 # CHECK: 0x0000000000000000 {{.*}} is_stmt end_sequence

Modified: llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s?rev=324669&r1=324668&r2=324669&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s (original)
+++ llvm/trunk/test/MC/ARM/dwarf-asm-multiple-sections.s Thu Feb  8 15:08:02 2018
@@ -1,14 +1,14 @@
 // RUN: llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -dwarf-version 5 -fdebug-compilation-dir=/tmp
 // RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF -check-prefix DWARF45 %s
-// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -check-prefix DWARF-DL-5 -DDWVER=5 %s
+// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -check-prefix DWARF-DL-5 -DDWVER=5 -DDWFILE=0 %s
 // RUN: llvm-objdump -r %t | FileCheck -check-prefix RELOC -check-prefix RELOC5 %s
 // RUN: llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -fdebug-compilation-dir=/tmp
 // RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF -check-prefix DWARF45 %s
-// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -DDWVER=4 %s
+// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -DDWVER=4 -DDWFILE=1 %s
 // RUN: llvm-objdump -r %t | FileCheck -check-prefix RELOC -check-prefix RELOC4 %s
 // RUN: llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -dwarf-version 3 -fdebug-compilation-dir=/tmp
 // RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix DWARF -check-prefix DWARF3 %s
-// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -DDWVER=3 %s
+// RUN: llvm-dwarfdump --debug-line %t | FileCheck -check-prefix DWARF-DL -DDWVER=3 -DDWFILE=1 %s
 // RUN: llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -dwarf-version 2 2>&1 | FileCheck -check-prefix VERSION %s
 // RUN: not llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -dwarf-version 1 2>&1 | FileCheck -check-prefix DWARF1 %s
 // RUN: not llvm-mc < %s -triple=armv7-linux-gnueabi -filetype=obj -o %t -g -dwarf-version 6 2>&1 | FileCheck -check-prefix DWARF6 %s
@@ -55,7 +55,7 @@ b:
 // DWARF-DL: version: [[DWVER]]
 // DWARF-DL-5:    address_size: 4
 // DWARF-DL-5:    include_directories[  0] = ""
-// DWARF-DL:      file_names[  1] {{.*}} "<stdin>"
+// DWARF-DL:      file_names[  [[DWFILE]]] {{.*}} "<stdin>"
 // DWARF-DL:      0x0000000000000000     17      0      1   0   0  is_stmt
 // DWARF-DL-NEXT: 0x0000000000000004     17      0      1   0   0  is_stmt end_sequence
 // DWARF-DL-NEXT: 0x0000000000000000     21      0      1   0   0  is_stmt

Modified: llvm/trunk/test/MC/ELF/debug-md5.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/debug-md5.s?rev=324669&r1=324668&r2=324669&view=diff
==============================================================================
--- llvm/trunk/test/MC/ELF/debug-md5.s (original)
+++ llvm/trunk/test/MC/ELF/debug-md5.s Thu Feb  8 15:08:02 2018
@@ -14,8 +14,8 @@
 # CHECK: include_directories[ 2] = .debug_line_str[0x[[DIR2:[0-9a-f]+]]] = "dir2"
 # CHECK-NOT: include_directories
 # CHECK: Dir MD5 Checksum File Name
-# CHECK: file_names[ 1] 1 00112233445566778899aabbccddeeff .debug_line_str[0x[[FILE1:[0-9a-f]+]]] = "foo"
-# CHECK: file_names[ 2] 2 ffeeddccbbaa99887766554433221100 .debug_line_str[0x[[FILE2:[0-9a-f]+]]] = "bar"
+# CHECK: file_names[ 0] 1 00112233445566778899aabbccddeeff .debug_line_str[0x[[FILE1:[0-9a-f]+]]] = "foo"
+# CHECK: file_names[ 1] 2 ffeeddccbbaa99887766554433221100 .debug_line_str[0x[[FILE2:[0-9a-f]+]]] = "bar"
 
 # CHECK: .debug_line_str contents:
 # CHECK-NEXT: 0x[[DIR0]]: ""




More information about the llvm-commits mailing list