Created
February 12, 2019 18:31
-
-
Save yurydelendik/12e95a8eb474cc72b6f57a5e23091416 to your computer and use it in GitHub Desktop.
Trust JIT unwind plan patch for lldb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | |
index 423b2e53c66..62dedbd75a6 100644 | |
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | |
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | |
@@ -829,6 +829,22 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() { | |
} | |
} | |
+ // The JIT generated module may generate their .eh_frame or .debug_frame | |
+ // sections. It makes sense to trust that unwind plan if it is valid. | |
+ if (pc_module_sp->GetFileSpec().GetFilename().GetStringRef().startswith("JIT(0x") && | |
+ process) { | |
+ m_fast_unwind_plan_sp.reset(); | |
+ UnwindPlanSP unwind_plan_sp = | |
+ func_unwinders_sp->GetEHFrameUnwindPlan(process->GetTarget(), m_current_offset_backed_up_one); | |
+ if (!unwind_plan_sp) { | |
+ unwind_plan_sp = | |
+ func_unwinders_sp->GetDebugFrameUnwindPlan(process->GetTarget(), m_current_offset_backed_up_one); | |
+ } | |
+ if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(m_current_pc)) { | |
+ return unwind_plan_sp; | |
+ } | |
+ } | |
+ | |
// Ask the DynamicLoader if the eh_frame CFI should be trusted in this frame | |
// even when it's frame zero This comes up if we have hand-written functions | |
// in a Module and hand-written eh_frame. The assembly instruction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment