fjricci created this revision. fjricci added reviewers: clayborg, jingham. fjricci added subscribers: lldb-commits, sas.
When we construct AppleObjCTrampolineHandler, if m_impl_fn_addr is invalid, we call CanJIT(). If the gdb remote process does not support allocating and deallocating memory, this call stack will include a call to the AppleObjCRuntime constructor. The AppleObjCRuntime constructor will then call the AppleObjCTrampolineHandler constructor, creating a recursive call loop that eventually overflows the stack and segfaults. Avoid this call loop by not constructing the AppleObjCTrampolineHandler within AppleObjCRuntime until we actually need to use it. http://reviews.llvm.org/D15978 Files: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -50,7 +50,6 @@ m_objc_trampoline_handler_ap (), m_Foundation_major() { - ReadObjCLibraryIfNeeded (process->GetTarget().GetImages()); } bool @@ -76,6 +75,7 @@ bool AppleObjCRuntime::GetObjectDescription (Stream &strm, Value &value, ExecutionContextScope *exe_scope) { + ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages()); if (!m_read_objc_library) return false; @@ -369,6 +369,7 @@ AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) { ThreadPlanSP thread_plan_sp; + ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages()); if (m_objc_trampoline_handler_ap.get()) thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others); return thread_plan_sp;
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -50,7 +50,6 @@ m_objc_trampoline_handler_ap (), m_Foundation_major() { - ReadObjCLibraryIfNeeded (process->GetTarget().GetImages()); } bool @@ -76,6 +75,7 @@ bool AppleObjCRuntime::GetObjectDescription (Stream &strm, Value &value, ExecutionContextScope *exe_scope) { + ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages()); if (!m_read_objc_library) return false; @@ -369,6 +369,7 @@ AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) { ThreadPlanSP thread_plan_sp; + ReadObjCLibraryIfNeeded (m_process->GetTarget().GetImages()); if (m_objc_trampoline_handler_ap.get()) thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others); return thread_plan_sp;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits