[Lldb-commits] [lldb] r319730 - Clean up stop hook output in case a hook restarts.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 4 18:34:05 PST 2017


Author: jingham
Date: Mon Dec  4 18:34:05 2017
New Revision: 319730

URL: http://llvm.org/viewvc/llvm-project?rev=319730&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=319730&r1=319729&r2=319730&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Dec  4 18:34:05 2017
@@ -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;
 
   // <rdar://problem/12027563> 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;
         }
       }




More information about the lldb-commits mailing list