1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

4 Commits

Author SHA1 Message Date
Xing GUO
b71d05baba [DWARFYAML][unittest] Refactor parseDWARFYAML().
In this change, `parseDWARFYAML()` is refactored to be able to parse
YAML decription into different data structures. We don't have to craft
the whole DWARF structure for a small test in the future.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D83220
2020-07-09 12:00:22 +08:00
Xing GUO
540bf09c85 [DWARFYAML][unittest] Use parseDWARFYAML() in unit test. NFC. 2020-07-03 22:36:00 +08:00
Xing GUO
120aef86f5 [DWARFYAML][debug_gnu_*] Add the missing context IsGNUStyle. NFC.
This patch helps add the missing context `IsGNUStyle`. Before this patch, yaml2obj cannot parse the YAML description of 'debug_gnu_pubnames' and 'debug_gnu_pubtypes' correctly due to the missing context.

In other words, if we have

```
DWARF:
  debug_gnu_pubtypes:
    Length:
      TotalLength: 0x1234
    Version:    2
    UnitOffset: 0x1234
    UnitSize:   0x4321
    Entries:
      - DieOffset:  0x12345678
        Name:       abc
        Descriptor: 0x00      ## Descriptor can never be mapped into Entry.Descriptor
```

yaml2obj will complain that "error: unknown key 'Descriptor'".

This patch helps resolve this problem.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D82435
2020-07-03 18:12:58 +08:00
Xing GUO
81f234a2c6 [ObjectYAML][DWARF] Collect diagnostic message when YAMLParser fails.
Before this patch, the diagnostic message is printed to `errs()` directly, which makes it difficult to use `FailedWithMessage()` in unit testing.
In this patch, we add a custom error handler for YAMLParser, which helps collect diagnostic messages and make it easy to use `FailedWithMessage()` to check error messages.

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D82630
2020-06-29 16:13:53 +08:00