At least ntdll is using the undocumented version 2 unwind info, and opcode 6, which is already defined as UOP_Epilog.
Using llvm-objdump --unwind with ntdll would previously result in unreachable assertions because this code was missing from getNumUsedSlots and getUnwindCodeTypeName.
The slots of these codes comes from https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/coreclr/inc/win64unwind.h#L51-L52 which I would assume is a good authoritative source.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This needs a test. Under /tools/llvm-objdump/COFF, you may use obj2yaml Inputs/win64-unwind.exe.coff-x86_64.exe to convert the precanned binary test file to a yaml test file.
Edit the accompanying .asm file to add new unwind code, and then test it.
Please bear with me a bit, I’m completely new to llvm codebase and test infra.
I’m unsure how converting this to yaml would help me? On the other hand, the asm seems to be the source for the obj/exe fixtures. How would I go about regenerating those from the source?
Also, I’m not quite sure how to actually put an epilog code in there via asm. I found this snippet here: https://searchfox.org/mozilla-central/rev/d3683dbb252506400c71256ef3994cdbdfb71ada/toolkit/crashreporter/test/win64UnwindInfoTests.asm#346-363
But that seems to be a different asm flavor?
Can someone help me unblock this? To be honest, I have way too little experience with the llvm testing infrastructure. It would probably take me ages to figure out all on my own how to conjure up an appropriate COFF file out of thin air.
@MaskRay, could you help with the testing here? Unfortunately, disassembly and COFF are both somewhat outside my realm of expertise, so I can't really help out myself.
We have some test gap but that may be fine, as there are a few other unwind opcodes which are untested.
Still be good to add the coverage. You can run obj2yaml llvm/test/tools/llvm-objdump/COFF/Inputs/win64-unwind.exe.coff-x86_64.exe to get a YAML, clean it a bit, and create a # RUN: yaml2obj %s -o %t test.
llvm/tools/llvm-objdump/COFFDump.cpp | ||
---|---|---|
197 | Add a space after : |
Rebased the patch and fixed the formatting. I will try to create a testcase with obj2yaml next, lets see how successful that will be ;-)
@MaskRay I tried playing with obj2yaml, but it would would require me to mess with the raw byte stream of the unwind ops, which I think would be rather fragile.
So this is good to go from my end.
Add a space after :