[Lldb-commits] [PATCH] D62764: Detect x86 mid-function epilogues that end in a jump
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 31 19:05:50 PDT 2019
jasonmolenda created this revision.
jasonmolenda added a project: LLDB.
Herald added a subscriber: abidh.
This patch adds a few new instruction recognizers to the x86 assembly inspection engine to recognize relative branches & jumps, adds support for recognizing a mid-function epilogue that ends in a jump instruction, and tests this.
The x86 unwinder still uses the initial algorithm for detecting mid-function epilogues: recognizing the end of an epilogue (relatively easy on x86 when it's usually a RET), we re-instate the unwind state from the end of the prologue. This patch adds recognition of a jump outside the function as a final epilogue instruction.
The second attempt at recognizing mid-function epilogues is implemented in UnwindAssemblyInstEmulation and is a much better approach -- it recognizes branch instructions and forwards the unwind state to the target instruction. This means that a branch over a mid-function epilogue will forward the unwind state past the epilogue; no detection of prologues or epilogues is needed.
I've added more instruction recognition machinery than is technically necessary for the bug I needed to fix - but it'll be needed for the better algorithm to be implemented in the x86 inspection engine. I didn't want to take on that larger bit of work right now, but it's something that should be done - this current algorithm is always going to be more fragile.
A more ambitious way to fix this would be to add an InstEmulation plugin for x86 and update UnwindAssemblyInstEmulation to handle all of the x86 features needed for unwinding, retire the x86AssemblyInspectionEngine.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 17461 bytes
Desc: not available
More information about the lldb-commits