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

[DWARFYAML] Make the include_directories, file_names and opcodes fields of the line table optional.

This patch makes the include_directories, file_names and opcodes fields
of the line table optional. This helps us simplify some tests.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D87878
This commit is contained in:
Xing GUO 2020-09-18 20:20:58 +08:00
parent 2a69cdbaed
commit 3c2809fd0d
10 changed files with 42 additions and 28 deletions

View File

@ -246,9 +246,9 @@ void MappingTraits<DWARFYAML::LineTable>::mapping(
IO.mapRequired("LineRange", LineTable.LineRange); IO.mapRequired("LineRange", LineTable.LineRange);
IO.mapRequired("OpcodeBase", LineTable.OpcodeBase); IO.mapRequired("OpcodeBase", LineTable.OpcodeBase);
IO.mapRequired("StandardOpcodeLengths", LineTable.StandardOpcodeLengths); IO.mapRequired("StandardOpcodeLengths", LineTable.StandardOpcodeLengths);
IO.mapRequired("IncludeDirs", LineTable.IncludeDirs); IO.mapOptional("IncludeDirs", LineTable.IncludeDirs);
IO.mapRequired("Files", LineTable.Files); IO.mapOptional("Files", LineTable.Files);
IO.mapRequired("Opcodes", LineTable.Opcodes); IO.mapOptional("Opcodes", LineTable.Opcodes);
} }
void MappingTraits<DWARFYAML::SegAddrPair>::mapping( void MappingTraits<DWARFYAML::SegAddrPair>::mapping(

View File

@ -478,7 +478,6 @@ DWARF:
- 0 - 0
- 0 - 0
- 1 - 1
IncludeDirs:
Files: Files:
- Name: hello_world.c - Name: hello_world.c
DirIdx: 0 DirIdx: 0

View File

@ -499,7 +499,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
IncludeDirs:
Files: Files:
- Name: hello_world.c - Name: hello_world.c
DirIdx: 0 DirIdx: 0
@ -540,7 +539,6 @@ DWARF:
# CHECK-NEXT: LineRange: 14 # CHECK-NEXT: LineRange: 14
# CHECK-NEXT: OpcodeBase: 13 # CHECK-NEXT: OpcodeBase: 13
# CHECK-NEXT: StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] # CHECK-NEXT: StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
# CHECK-NEXT: IncludeDirs:
# CHECK-NEXT: Files: # CHECK-NEXT: Files:
# CHECK-NEXT: - Name: hello_world.c # CHECK-NEXT: - Name: hello_world.c
# CHECK-NEXT: DirIdx: 0 # CHECK-NEXT: DirIdx: 0

View File

@ -479,7 +479,6 @@ DWARF:
- 0 - 0
- 0 - 0
- 1 - 1
IncludeDirs:
Files: Files:
- Name: hello_world.c - Name: hello_world.c
DirIdx: 0 DirIdx: 0

View File

@ -118,5 +118,4 @@ DWARF:
DirIdx: 1 DirIdx: 1
ModTime: 0 ModTime: 0
Length: 0 Length: 0
Opcodes: []
... ...

View File

@ -113,6 +113,4 @@ DWARF:
StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
IncludeDirs: IncludeDirs:
- '/tmp' - '/tmp'
Files:
Opcodes: []
... ...

View File

@ -472,7 +472,6 @@ Slices:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
IncludeDirs: []
Files: Files:
- Name: main.cpp - Name: main.cpp
DirIdx: 0 DirIdx: 0
@ -941,7 +940,6 @@ Slices:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
IncludeDirs: []
Files: Files:
- Name: main.cpp - Name: main.cpp
DirIdx: 0 DirIdx: 0

View File

@ -688,7 +688,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
IncludeDirs: []
Files: Files:
- Name: main.cpp - Name: main.cpp
DirIdx: 0 DirIdx: 0

View File

@ -469,7 +469,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ] StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
IncludeDirs: []
Files: Files:
- Name: strip-test.c - Name: strip-test.c
DirIdx: 0 DirIdx: 0

View File

@ -92,7 +92,6 @@ DWARF:
DirIdx: 2 DirIdx: 2
ModTime: 3 ModTime: 3
Length: 4 Length: 4
Opcodes: []
## Generate and verify a big endian DWARF32 .debug_line section. ## Generate and verify a big endian DWARF32 .debug_line section.
@ -211,9 +210,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [] StandardOpcodeLengths: []
IncludeDirs: []
Files: []
Opcodes: []
## e) Test that yaml2obj emits an error message when both the "Content" and the ## e) Test that yaml2obj emits an error message when both the "Content" and the
## "debug_line" entry are specified at the same time. ## "debug_line" entry are specified at the same time.
@ -240,9 +236,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [] StandardOpcodeLengths: []
IncludeDirs: []
Files: []
Opcodes: []
## f) Test that all the properties can be overridden by the section header when ## f) Test that all the properties can be overridden by the section header when
## the "debug_line" entry doesn't exist. ## the "debug_line" entry doesn't exist.
@ -307,9 +300,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [] StandardOpcodeLengths: []
IncludeDirs: []
Files: []
Opcodes: []
## h) Test that the address size is inferred from the target machine. ## h) Test that the address size is inferred from the target machine.
@ -355,8 +345,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [] StandardOpcodeLengths: []
IncludeDirs: []
Files: []
Opcodes: Opcodes:
- Opcode: DW_LNS_extended_op - Opcode: DW_LNS_extended_op
ExtLen: 9 ExtLen: 9
@ -439,8 +427,6 @@ DWARF:
LineRange: 14 LineRange: 14
OpcodeBase: 13 OpcodeBase: 13
StandardOpcodeLengths: [] StandardOpcodeLengths: []
IncludeDirs: []
Files: []
Opcodes: Opcodes:
- Opcode: DW_LNS_copy - Opcode: DW_LNS_copy
- Opcode: DW_LNS_advance_pc - Opcode: DW_LNS_advance_pc
@ -591,3 +577,42 @@ DWARF:
- Opcode: DW_LNS_extended_op - Opcode: DW_LNS_extended_op
ExtLen: 1 ExtLen: 1
SubOpcode: DW_LNE_end_sequence SubOpcode: DW_LNE_end_sequence
## k) Test that we can omit the include_directories, file_names and opcodes
## fields of the line table.
# RUN: yaml2obj --docnum=11 %s -o %t11.o
# RUN: llvm-readelf --hex-dump=.debug_line %t11.o | \
# RUN: FileCheck %s --check-prefix=OMIT-FIELDS
# OMIT-FIELDS: Hex dump of section '.debug_line':
# OMIT-FIELDS-NEXT: 0x00000000 11000000 04000b00 00000101 01fb0e04 ................
## ^------- unit_length (4-byte)
## ^--- version (2-byte)
## ^-------- header_length (4-byte)
## ^- minimum_instruction_length (1-byte)
## ^- maximum_operations_per_instruction (1-byte)
## ^- default_is_stmt (1-byte)
## ^- line_base (1-byte) -5
## ^- line_range (1-byte)
## ^- opcode_base (1-byte)
# OMIT-FIELDS-NEXT: 0x00000010 00010100 00 .....
## ^----- standard_opcode_lengths (3-byte)
## ^- include_directories null byte (1-byte)
## ^- file_names null byte (1-byte)
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
DWARF:
debug_line:
- Version: 4
MinInstLength: 1
MaxOpsPerInst: 1
DefaultIsStmt: 1
LineBase: 251
LineRange: 14
OpcodeBase: 4
StandardOpcodeLengths: [ 0, 1, 1 ]