Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Trust JIT unwind plan patch for lldb
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
You can’t perform that action at this time.