Issue 166441
Summary yaml2obj lacks dwarf5 .debug_line support
Labels new issue
Assignees
Reporter rjmansfield
    yaml2obj does not support DWARF5's structured directory and file table format in `.debug_line` sections. It appears to only support dwarf4 format with simple string arrays.

For example, in `llvm/include/llvm/ObjectYAML/DWARFYAML.h`

```cpp
struct LineTable {
 dwarf::DwarfFormat Format;
  std::optional<uint64_t> Length;
  uint16_t Version;
  std::optional<uint64_t> PrologueLength;
  uint8_t MinInstLength;
  uint8_t MaxOpsPerInst;
  uint8_t DefaultIsStmt;
  uint8_t LineBase;
  uint8_t LineRange;
  std::optional<uint8_t> OpcodeBase;
 std::optional<std::vector<uint8_t>> StandardOpcodeLengths;
 std::vector<StringRef> IncludeDirs;  // DWARF4: simple strings
 std::vector<File> Files;              // DWARF4: simple file entries
 std::vector<LineTableOpcode> Opcodes;
};
```

When attempting to write yaml for dwarf5 debug_line


```yaml
--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_EXEC
DWARF:
  debug_line:
 - Version:         5
      AddressSize:     8
      SegSelectorSize: 0
 MinInstLength:   1
      MaxOpsPerInst:   1
      DefaultIsStmt:   1
 LineBase:        251
      LineRange:       14
      OpcodeBase: 13
      StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
 IncludeDirs:
        - '/usr/include'
      Files:
        - Name: 'test.c'
          DirIdx: 0
...
```

```
YAML:21:11: error: missing required key 'ModTime'
        - Name: 'test.c'
          ^
yaml2obj: error: failed to parse YAML input: Invalid argument
```

It looks like all of the existing dwarf5 .debug_line tests work around this by doing `Sections:`  with raw hex `Content:`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to