1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[DWARFv5] Number the line-table's directory array correctly.

The compilation directory has always been #0, but as of DWARF v5 it is
explicitly listed in the line-table section instead of implicitly
being a reference to the compile_unit DIE's DW_AT_comp_dir attribute.
This means the dumper should number the dumped array starting with 0
or 1 depending on the DWARF version of the line table.

References in the generated DWARF are correct, it's just the dumper
that was wrong.  Also some assembler-coded tests were similarly
confused about directory numbers.

llvm-svn: 322884
This commit is contained in:
Paul Robinson 2018-01-18 20:33:35 +00:00
parent 60eadcb957
commit 56dfed1023
6 changed files with 33 additions and 30 deletions

View File

@ -73,10 +73,13 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS) const {
OS << format("standard_opcode_lengths[%s] = %u\n",
LNStandardString(I + 1).data(), StandardOpcodeLengths[I]);
if (!IncludeDirectories.empty())
if (!IncludeDirectories.empty()) {
// DWARF v5 starts directory indexes at 0.
uint32_t DirBase = getVersion() >= 5 ? 0 : 1;
for (uint32_t I = 0; I != IncludeDirectories.size(); ++I)
OS << format("include_directories[%3u] = '", I + 1)
OS << format("include_directories[%3u] = '", I + DirBase)
<< IncludeDirectories[I] << "'\n";
}
if (!FileNames.empty()) {
if (HasMD5)

View File

@ -122,11 +122,11 @@ LH_5_params:
# File table entries
.byte 2 # Two files
.asciz "File5a"
.byte 1
.byte 0
.byte 0x51
.byte 0x52
.asciz "File5b"
.byte 2
.byte 1
.byte 0x53
.byte 0x54
LH_5_header_end:
@ -141,9 +141,9 @@ LH_5_end:
# CHECK: seg_select_size: 0
# CHECK: prologue_length: 0x00000044
# CHECK: max_ops_per_inst: 1
# CHECK: include_directories[ 1] = 'Directory5a'
# CHECK: include_directories[ 2] = 'Directory5b'
# CHECK: include_directories[ 0] = 'Directory5a'
# CHECK: include_directories[ 1] = 'Directory5b'
# CHECK-NOT: include_directories
# CHECK: file_names[ 1] 1 0x00000051 0x00000052 File5a{{$}}
# CHECK: file_names[ 2] 2 0x00000053 0x00000054 File5b{{$}}
# CHECK: file_names[ 1] 0 0x00000051 0x00000052 File5a{{$}}
# CHECK: file_names[ 2] 1 0x00000053 0x00000054 File5b{{$}}
# CHECK-NOT: file_names

View File

@ -308,11 +308,11 @@ LH_5_params:
# File table entries
.byte 2 # Two files
.asciz "File5a"
.byte 1
.byte 0
.quad 0x7766554433221100
.quad 0xffeeddccbbaa9988
.asciz "File5b"
.byte 2
.byte 1
.quad 0x8899aabbccddeeff
.quad 0x0011223344556677
LH_5_header_end:
@ -324,12 +324,12 @@ LH_5_end:
# CHECK: address_size: 8
# CHECK: seg_select_size: 0
# CHECK: max_ops_per_inst: 1
# CHECK: include_directories[ 1] = 'Directory5a'
# CHECK: include_directories[ 2] = 'Directory5b'
# CHECK: include_directories[ 0] = 'Directory5a'
# CHECK: include_directories[ 1] = 'Directory5b'
# CHECK-NOT: include_directories
# CHECK: MD5 Checksum
# CHECK: file_names[ 1] 1 00112233445566778899aabbccddeeff File5a{{$}}
# CHECK: file_names[ 2] 2 ffeeddccbbaa99887766554433221100 File5b{{$}}
# CHECK: file_names[ 1] 0 00112233445566778899aabbccddeeff File5a{{$}}
# CHECK: file_names[ 2] 1 ffeeddccbbaa99887766554433221100 File5b{{$}}
# CHECK-NOT: file_names
.section .debug_line.dwo,"",@progbits
@ -383,11 +383,11 @@ dwo_LH_5_params:
# File table entries
.byte 2 # Two files
.asciz "DWOFile5a"
.byte 1
.byte 0
.byte 0x15
.byte 0x25
.asciz "DWOFile5b"
.byte 2
.byte 1
.byte 0x35
.byte 0x45
dwo_LH_5_header_end:
@ -399,9 +399,9 @@ dwo_LH_5_end:
# CHECK: address_size: 8
# CHECK: seg_select_size: 0
# CHECK: max_ops_per_inst: 1
# CHECK: include_directories[ 1] = 'DWODirectory5a'
# CHECK: include_directories[ 2] = 'DWODirectory5b'
# CHECK: include_directories[ 0] = 'DWODirectory5a'
# CHECK: include_directories[ 1] = 'DWODirectory5b'
# CHECK-NOT: include_directories
# CHECK: file_names[ 1] 1 0x00000015 0x00000025 DWOFile5a{{$}}
# CHECK: file_names[ 2] 2 0x00000035 0x00000045 DWOFile5b{{$}}
# CHECK: file_names[ 1] 0 0x00000015 0x00000025 DWOFile5a{{$}}
# CHECK: file_names[ 2] 1 0x00000035 0x00000045 DWOFile5b{{$}}
# CHECK-NOT: file_names

View File

@ -59,11 +59,11 @@ LH_5_params:
.byte 0x0f # DW_FORM_udata
# File table entries
.byte 2 # Two file entries
.byte 2
.byte 1
.asciz "File1"
.byte 0x51
.byte 0x52
.byte 1
.byte 0
.asciz "File2"
.byte 0x53
.byte 0x54
@ -84,10 +84,10 @@ LH_5_end:
# CHECK: address_size: 8
# CHECK: seg_select_size: 0
# CHECK: max_ops_per_inst: 1
# CHECK: include_directories[ 1] = 'Directory1'
# CHECK: include_directories[ 2] = 'Directory2'
# CHECK: include_directories[ 0] = 'Directory1'
# CHECK: include_directories[ 1] = 'Directory2'
# CHECK-NOT: include_directories
# CHECK: file_names[ 1] 2 0x00000051 0x00000052 File1{{$}}
# CHECK: file_names[ 2] 1 0x00000053 0x00000054 File2{{$}}
# CHECK: file_names[ 1] 1 0x00000051 0x00000052 File1{{$}}
# CHECK: file_names[ 2] 0 0x00000053 0x00000054 File2{{$}}
# CHECK-NOT: file_names
# CHECK: 0x0000000000000000 {{.*}} is_stmt end_sequence

View File

@ -54,7 +54,7 @@ b:
// DWARF-DL: .debug_line contents:
// DWARF-DL: version: [[DWVER]]
// DWARF-DL-5: address_size: 4
// DWARF-DL-5: include_directories[ 1] = ''
// DWARF-DL-5: include_directories[ 0] = ''
// DWARF-DL: file_names[ 1] {{.*}} <stdin>
// DWARF-DL: 0x0000000000000000 17 0 1 0 0 is_stmt
// DWARF-DL-NEXT: 0x0000000000000004 17 0 1 0 0 is_stmt end_sequence

View File

@ -9,9 +9,9 @@
# CHECK: debug_line[0x00000000]
# CHECK: version: 5
# CHECK: include_directories[ 1] = ''
# CHECK: include_directories[ 2] = 'dir1'
# CHECK: include_directories[ 3] = 'dir2'
# CHECK: include_directories[ 0] = ''
# CHECK: include_directories[ 1] = 'dir1'
# CHECK: include_directories[ 2] = 'dir2'
# CHECK-NOT: include_directories
# CHECK: Dir MD5 Checksum File Name
# CHECK: file_names[ 1] 1 00112233445566778899aabbccddeeff foo