This patch makes the opcode_base and the standard_opcode_lengths fields
of the line table optional. When both of them are not specified,
yaml2obj emits them according to the line table's version.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
1,200 ms | linux > libarcher.parallel::parallel-nosuppression.c |
Event Timeline
To summarise my inline suggestions, I think the behaviour should be:
- Neither field specified: values are derived from the version. If the version is unsupported, return max(? - maybe v4 instead, to stop test behaviour changing in the future unexpectedly) supported version values.
- Both fields specified: do as requested.
- Just opcode_base specified, same as 1, except truncate the standard opcode lengths vector to the right length. If 0, use an empty standard opcode lengths vector.
- Just standard opcode lengths specified: use length of specified lengths vector to derive opcode_base.
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
556–560 | You don't use the Version parameter, it looks like? I think you should - define the values based on the specified version, perhaps defaulting to v4 if the version is unknown (actually, I'd probably default to whatever the latest is, but that's academic, as v4 and v5 have the same standard opcodes). | |
557–558 | I actually think the logic should be to truncate whatever the default vector is, rather than specifying a zero-filled vector. | |
llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml | ||
716 | ||
729 |
- Make getStandardOpcodeLengths() return the standard_opcode_lengths according to the latest DWARF spec by default.
- Add one test case where the opcode_base is greater than 13.
- Address some inline comments.
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
556–560 | I like the latter approach. When I generate the DWARFv2 line table using clang -gdwarf-2 a.c, the opcode_base field of the generated line table is 13 as well. I think making getStandardOpcodeLengths return the standard_opcode_lengths according to the latest DWARF spec is fine here. |
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
557–564 | I think you either misunderstood my comment or something else. You're still not using the Version parameter, and I think you should use that in determining what the standard opcode lengths should be if otherwise unspecified. See my previous out-of-line commentary, in particular point 1. |
llvm/lib/ObjectYAML/DWARFEmitter.cpp | ||
---|---|---|
561–562 | This probably deserves a comment saying something like "DWARF v2 uses the same first 9 standard opcodes as v3-5." | |
llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml | ||
785–786 | I suggest you do this for each of the other versions too, assuming the test is straightforward to write using FileCheck and yaml2obj -D options. |
- Test the default opcode_base field and the standard_opcode_lengths array of DWARFv2-DWARFv4 (DWARFv5 isn't supported yet).
- Add missing comment.
LGTM.
llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml | ||
---|---|---|
706 | I'm rather surprised that works, if I'm honest! |
llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml | ||
---|---|---|
706 | Yeah, the preprocessor of yaml2obj simply replaces strings that quoted by [[]]. |
I actually think the logic should be to truncate whatever the default vector is, rather than specifying a zero-filled vector.