1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[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.

llvm-svn: 324669
This commit is contained in:
Paul Robinson 2018-02-08 23:08:02 +00:00
parent 7aa4cb8630
commit 8d070bc9df
7 changed files with 20 additions and 17 deletions

View File

@ -93,9 +93,12 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS,
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

View File

@ -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"

View File

@ -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

View File

@ -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",@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

View File

@ -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

View File

@ -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

View File

@ -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]]: ""