This patch makes x86AssemblyInspectionEngine to process zero value of the B field of the REX prefix in a correct way for PUSH and POP instructions. MSVC sometimes emits pushq %rbp instruction as 0x40 0x55, and it was not parsed correctly before.
Details
Diff Detail
- Repository
- rLLDB LLDB
Event Timeline
The change makes sense, but I'd just create a new test with the instructions you're interested in instead of modifying an existing one. The comment above the code claims this assembly was produced by clang, which is clearly not true after your modifications.
Looks good to me.
I don't expect Jason to have any problems with this, but it might be nice to wait a day or two to give him a chance to prove me wrong. :)
The change looks good to me, thanks for fixing this. I'm not sure you're testing what you meant to test in TestPopRBPWithREX because you're pushing/popping r13. You could get the unwind state at byte offset 2 (after the push r13 has executed) and see that you can GetRegisterInfo() r13, and the unwind state at byte offset 4 and verify that you can't GetRegisterInfo() r13. That's a good test to make sure we handle the B bit correctly.
unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp | ||
---|---|---|
1953 | These are pushing/popping r13 aren't they? 0x40 0x55 gives us register 5 (rbp), but 0x41 0x55 gives us register 13 (r13) if I'm reading the intel manuals right (volume 2a, section 2.2.1.2 "More on REX Prefix Fields"). |
These are pushing/popping r13 aren't they? 0x40 0x55 gives us register 5 (rbp), but 0x41 0x55 gives us register 13 (r13) if I'm reading the intel manuals right (volume 2a, section 2.2.1.2 "More on REX Prefix Fields").