When DIE is extracted manually, the DieArray is empty. When dump is invoked on aforementioned DIE it tries to extract child, even if Dump options say otherwise. Resulting in crash.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I am not sure how to test it. I think only way to trigger it is to manually extract DIE with children like done here: https://github.com/facebookincubator/BOLT/blob/68abc968b706b55585b1b8be315aef5d3bf90b1c/bolt/src/DWARFRewriter.cpp#L129
Then invoke dump() on it.
I guess one way would be to add this method of an extraction to an API, @maksfb or I were thinking of doing it, and modify one of the tools to use it.
Another write a small program that does it and have it as part of the test suite.
My understanding it's done that way vs using current APIs is to keep memory footprint down.
Ah missed it.
Are those YAML tests manually constructed? I tried obj2yaml and copied just debug parts.
- parsing failed
- Syntax is different then what is in the tests.
- Name: .debug_info Type: SHT_PROGBITS AddressAlign: 0x1 Content: A6000000040000000000080100000000210086000000000000008F000000700540000000000044000000027005400000000000120000000156D5000000E100000001028C0000000302917CF200000001028C00000000049005400000000000240000000156ED00000001068C00000003029178F600000001068C00000003029170FB0000000106930000000005E900000005040698000000069D00000007A20000000500010000060100
Sorry, I don't know too much about the yaml2obj/obj2yaml stuff - not sure what state it's in @jhenderson and @labath might have more context on the current state.
but there are also pure unit tests that use LLVM APIs to build DWARF and then test that - perhaps one of those would be suitable here?
and copied just debug parts.
- parsing failed
- Syntax is different then what is in the tests.
- Name: .debug_info Type: SHT_PROGBITS AddressAlign: 0x1 Content: A6000000040000000000080100000000210086000000000000008F000000700540000000000044000000027005400000000000120000000156D5000000E100000001028C0000000302917CF200000001028C00000000049005400000000000240000000156ED00000001068C00000003029178F600000001068C00000003029170FB0000000106930000000005E900000005040698000000069D00000007A20000000500010000060100
Added a test using APIs, moved getHeaderSize from protected to public. Aligns with other get APIs that are already public.
llvm/unittests/DebugInfo/DWARF/DWARFDieManualExtractTest.cpp | ||
---|---|---|
69 | Pass in a str_ostream or the like, and validate that the dump does what the comment above says (dumping only the current DIE and not any children) |
Thanks for reviewing. Will ask teammates to commit once it passes all the tests. Looks like it failed clang tidy.
Pass in a str_ostream or the like, and validate that the dump does what the comment above says (dumping only the current DIE and not any children)