summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2019-06-03 22:34:12 +0000
committerJason Molenda <jmolenda@apple.com>2019-06-03 22:34:12 +0000
commitc3ea7c66fec021867e005ad1b02f3c7e80feaa85 (patch)
tree145deba4f8f55240dc4a665528f092530f1ee59a /lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
parent6dc8ce323e24bed62cf9938b60f7323464c0da38 (diff)
downloadbcm5719-llvm-c3ea7c66fec021867e005ad1b02f3c7e80feaa85.tar.gz
bcm5719-llvm-c3ea7c66fec021867e005ad1b02f3c7e80feaa85.zip
Add support for mid-function epilogues on x86 that end in a non-local jump.
The x86 assembly inspection engine has code to support detecting a mid-function epilogue that ends in a RET instruction; add support for recognizing an epilogue that ends in a JMP, and add a check that the unwind state has been restored to the original stack setup; reinstate the post-prologue unwind state after this JMP instruction. The assembly inspection engine used for other architectures, UnwindAssemblyInstEmulation, detects mid-function epilogues by tracking branch instructions within the function and "forwards" the current unwind state to the targets of the branches. If an epilogue unwinds the stack and exits, followed by a branch target, we get back to the correct unwind state. The x86 unwinder should move to this same algorithm, or possibly even look at implementing an x86 instruction emulation plugin and get UnwindAssemblyInstEmulation to work for x86 too. I added a branch instruction recognizier method that will be necessary if we want to switch the algorithm. Differential Revision: https://reviews.llvm.org/D62764 <rdar://problem/51074422> llvm-svn: 362456
Diffstat (limited to 'lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h')
-rw-r--r--lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
index 9a8f71f4ee1..680598abdef 100644
--- a/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
+++ b/lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.h
@@ -114,7 +114,19 @@ private:
bool call_next_insn_pattern_p();
bool mov_reg_to_local_stack_frame_p(int &regno, int &rbp_offset);
bool ret_pattern_p();
+ bool jmp_to_reg_p();
+ bool pc_rel_branch_or_jump_p (const int instruction_length, int &offset);
+ bool non_local_branch_p (const lldb::addr_t current_func_text_offset,
+ const lldb_private::AddressRange &func_range,
+ const int instruction_length);
+ bool local_branch_p (const lldb::addr_t current_func_text_offset,
+ const lldb_private::AddressRange &func_range,
+ const int instruction_length,
+ lldb::addr_t &target_insn_offset);
+ uint16_t extract_2(uint8_t *b);
+ int16_t extract_2_signed(uint8_t *b);
uint32_t extract_4(uint8_t *b);
+ int32_t extract_4_signed(uint8_t *b);
bool instruction_length(uint8_t *insn, int &length, uint32_t buffer_remaining_bytes);
OpenPOWER on IntegriCloud