diff options
5 files changed, 34 insertions, 7 deletions
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 92ae7541e69..593c93b4ece 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -2631,6 +2631,20 @@ public: IsAlive () = 0; //------------------------------------------------------------------ + /// Before lldb detaches from a process, it warns the user that they are about to lose their debug session. + /// In some cases, this warning doesn't need to be emitted -- for instance, with core file debugging where + /// the user can reconstruct the "state" by simply re-running the debugger on the core file. + /// + /// @return + // true if the user should be warned about detaching from this process. + //------------------------------------------------------------------ + virtual bool + WarnBeforeDetach () const + { + return true; + } + + //------------------------------------------------------------------ /// Actually do the reading of memory from a process. /// /// Subclasses must override this function and can return fewer diff --git a/lldb/source/Commands/CommandObjectQuit.cpp b/lldb/source/Commands/CommandObjectQuit.cpp index c4c09e87b9b..d04ecdd9885 100644 --- a/lldb/source/Commands/CommandObjectQuit.cpp +++ b/lldb/source/Commands/CommandObjectQuit.cpp @@ -60,9 +60,10 @@ CommandObjectQuit::ShouldAskForConfirmation (bool& is_a_detach) if (!target_sp) continue; ProcessSP process_sp(target_sp->GetProcessSP()); - if (process_sp && - process_sp->IsValid() && - process_sp->IsAlive()) + if (process_sp + && process_sp->IsValid() + && process_sp->IsAlive() + && process_sp->WarnBeforeDetach()) { should_prompt = true; if (process_sp->GetShouldDetach() == false) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index 28508fdefe0..0b768e2a17d 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -661,9 +661,12 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process { // If we can't even find the ordinary get method implementation function, then we aren't going to be able to // step through any method dispatches. Warn to that effect and get out of here. - process_sp->GetTarget().GetDebugger().GetErrorStream().Printf("Could not find implementation lookup function \"%s\"" - " step in through ObjC method dispatch will not work.\n", - get_impl_name.AsCString()); + if (process_sp->CanJIT()) + { + process_sp->GetTarget().GetDebugger().GetErrorStream().Printf("Could not find implementation lookup function \"%s\"" + " step in through ObjC method dispatch will not work.\n", + get_impl_name.AsCString()); + } return; } else if (m_impl_stret_fn_addr == LLDB_INVALID_ADDRESS) diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index abf3b673e68..35d9beda4fd 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -366,6 +366,12 @@ ProcessMachCore::IsAlive () return true; } +bool +ProcessMachCore::WarnBeforeDetach () const +{ + return false; +} + //------------------------------------------------------------------ // Process Memory //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h index 5048a549f8c..a3882ff7268 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h @@ -94,7 +94,10 @@ public: //------------------------------------------------------------------ virtual bool IsAlive (); - + + virtual bool + WarnBeforeDetach () const; + //------------------------------------------------------------------ // Process Memory //------------------------------------------------------------------ |