From 45816d6b917c27a55230ba096067c64797ccbbe9 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Tue, 5 Dec 2017 02:34:05 +0000 Subject: [PATCH] Clean up stop hook output in case a hook restarts. I was warning about the fact that this will abort further stop hooks, but didn't check that there WAS a further stop hook. Also the warning was missing a newline. llvm-svn: 319730 --- lldb/source/Target/Target.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index bd60a7d98ff4..903f50887fec 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2679,6 +2679,10 @@ void Target::RunStopHooks() { if (!m_process_sp) return; + + // Somebody might have restarted the process: + if (m_process_sp->GetState() != eStateStopped) + return; // make sure we check that we are not stopped // because of us running a user expression @@ -2784,9 +2788,12 @@ void Target::RunStopHooks() { // running the stop hooks. if ((result.GetStatus() == eReturnStatusSuccessContinuingNoResult) || (result.GetStatus() == eReturnStatusSuccessContinuingResult)) { - result.AppendMessageWithFormat("Aborting stop hooks, hook %" PRIu64 - " set the program running.", - cur_hook_sp->GetID()); + // But only complain if there were more stop hooks to do: + StopHookCollection::iterator tmp = pos; + if (++tmp != end) + result.AppendMessageWithFormat("\nAborting stop hooks, hook %" PRIu64 + " set the program running.\n", + cur_hook_sp->GetID()); keep_going = false; } }