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

[DWARFYAML][debug_info] Make the 'Values' field optional.

This patch makes the 'Values' field optional. This is useful when we
handcraft the terminating entry of DIEs.

```
debug_info:
  - Version:  4
    ...
    Entries:
      - AbbrCode: 1
        Values:
          - Value: 0x1234
      - AbbrCode: 0 ## Termination
```

Reviewed By: jhenderson, grimar

Differential Revision: https://reviews.llvm.org/D85397
This commit is contained in:
Xing GUO 2020-08-06 20:41:12 +08:00
parent b507631f80
commit 0504b3725a
4 changed files with 33 additions and 9 deletions

View File

@ -156,7 +156,7 @@ void MappingTraits<DWARFYAML::Unit>::mapping(IO &IO, DWARFYAML::Unit &Unit) {
void MappingTraits<DWARFYAML::Entry>::mapping(IO &IO, DWARFYAML::Entry &Entry) {
IO.mapRequired("AbbrCode", Entry.AbbrCode);
IO.mapRequired("Values", Entry.Values);
IO.mapOptional("Values", Entry.Values);
}
void MappingTraits<DWARFYAML::FormValue>::mapping(

View File

@ -438,7 +438,6 @@ DWARF:
- Value: 0x0000000000000003
- Value: 0x0000000000000067
- AbbrCode: 0x00000000
Values:
- AbbrCode: 0x00000004
Values:
- Value: 0x0000000000000085
@ -456,7 +455,6 @@ DWARF:
- Value: 0x0000000000000006
- Value: 0x0000000000000001
- AbbrCode: 0x00000000
Values:
debug_line:
- Length: 65
Version: 2
@ -556,7 +554,6 @@ DWARF:
# DWARF32-NEXT: - Value: 0x0000000000000003
# DWARF32-NEXT: - Value: 0x0000000000000067
# DWARF32-NEXT: - AbbrCode: 0x00000000
# DWARF32-NEXT: Values:
# DWARF32-NEXT: - AbbrCode: 0x00000004
# DWARF32-NEXT: Values:
# DWARF32-NEXT: - Value: 0x0000000000000085
@ -574,7 +571,6 @@ DWARF:
# DWARF32-NEXT: - Value: 0x0000000000000006
# DWARF32-NEXT: - Value: 0x0000000000000001
# DWARF32-NEXT: - AbbrCode: 0x00000000
# DWARF32-NEXT: Values:
## b) Test that yaml2obj emits a correct unit header and obj2yaml is able to convert it back.

View File

@ -439,7 +439,6 @@ DWARF:
- Value: 0x0000000000000003
- Value: 0x0000000000000067
- AbbrCode: 0x00000000
Values:
- AbbrCode: 0x00000004
Values:
- Value: 0x0000000000000085
@ -457,7 +456,6 @@ DWARF:
- Value: 0x0000000000000006
- Value: 0x0000000000000001
- AbbrCode: 0x00000000
Values:
debug_line:
- Length: 65
Version: 2
@ -557,7 +555,6 @@ DWARF:
# DWARF32-NEXT: - Value: 0x0000000000000003
# DWARF32-NEXT: - Value: 0x0000000000000067
# DWARF32-NEXT: - AbbrCode: 0x00000000
# DWARF32-NEXT: Values:
# DWARF32-NEXT: - AbbrCode: 0x00000004
# DWARF32-NEXT: Values:
# DWARF32-NEXT: - Value: 0x0000000000000085
@ -575,7 +572,6 @@ DWARF:
# DWARF32-NEXT: - Value: 0x0000000000000006
# DWARF32-NEXT: - Value: 0x0000000000000001
# DWARF32-NEXT: - AbbrCode: 0x00000000
# DWARF32-NEXT: Values:
## b) Test that yaml2obj emits a correct unit header and obj2yaml is able to convert it back.

View File

@ -842,3 +842,35 @@ DWARF:
- Value: 0x1120 ## DW_AT_low_pc [DW_FORM_addr]
- Value: 0x06 ## DW_AT_high_pc [DW_FORM_data4]
- Value: 0x38 ## DW_AT_name [DW_FORM_strp]
## l) Test that if we don't specify the 'Values' key for an entry, yaml2obj will only emit the abbrev_code.
# RUN: yaml2obj --docnum=14 %s -o %t14.o
# RUN: llvm-readelf --hex-dump=.debug_info %t14.o | \
# RUN: FileCheck %s --check-prefix=NO-VALUES
# NO-VALUES: Hex dump of section '.debug_info':
# NO-VALUES-NEXT: 0x00000000 0a000000 04000000 00000801 0002 ..............
## ^------- unit_length (4-byte)
## ^--- version (2-byte)
## ^-------- debug_abbrev_offset (4-byte)
## ^- address_size (1-byte)
## ^- abbrev_code (ULEB128) 0x01
## ^- abbrev_code (ULEB128) 0x00
## ^- abbrev_code (ULEB128) 0x02
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
DWARF:
debug_info:
- Version: 4
AbbrOffset: 0x00
AddrSize: 0x08
Entries:
- AbbrCode: 1
- AbbrCode: 0
- AbbrCode: 2