[PATCH] D85006: [DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 01:51:25 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml:674
+## u) Test that when the "OffsetEntryCount" is specified to be 0 and "Offsets" is not specified,
+## offsets will be omitted.
+
----------------



================
Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml:699
+  debug_rnglists:
+    - OffsetEntryCount: 0
+      Lists:
----------------
Rather than having three different YAML docs for these cases, you can use -D and default options. You might even be able to get rid of some of the other YAML using similar methods.

For example:

```
## Generate an object with default offset entries and entry count.
# RUN: yaml2obj %s -o %t1
## Generate an object with default offset entries but a non-default entry count
# RUN: yaml2obj %s -o %t2 -D OFFSETENTRIES=0
## Generate an object with non-default offset entries but a default entry count
# RUN: yaml2obj %s -o %t3 -D OFFSETS=[0, 1, 2]
## Generate an object with non-default of both.
# RUN: yaml2obj %s -o %t4 -D OFFSETENTRIES=42 -D OFFSETS=[]

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
DWARF:
  debug_rnglists:
    - OffsetEntryCount: [[OFFSETENTRIES=<none>]] # equivalent to not specifying the field at all, if -D OFFSETENTRIES not specified.
      Offsets: [[OFFSETS=<none>]]
      Lists:
        <etc>
```


================
Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml:709
+## v) Test that when the "Offsets" entry is specified to be empty and the "OffsetEntryCount" is not specified,
+## offsets will be omitted as well.
+
----------------



================
Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml:732-733
+
+## w) Test that if the "Offsets" is specified, offsets will be emitted accordingly, even when
+## the "OffsetEntryCount" is specified to be 0.
+
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85006/new/

https://reviews.llvm.org/D85006



More information about the llvm-commits mailing list