[Lldb-commits] [lldb] Fix a bug with cancelling "attach -w" after you have run a process previously (PR #65822)

via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 8 17:29:45 PDT 2023


================
@@ -3156,23 +3156,22 @@ Status Process::Halt(bool clear_thread_plans, bool use_run_lock) {
   // case it was already set and some thread plan logic calls halt on its own.
   m_clear_thread_plans_on_stop |= clear_thread_plans;
 
-  ListenerSP halt_listener_sp(
-      Listener::MakeListener("lldb.process.halt_listener"));
-  HijackProcessEvents(halt_listener_sp);
-
-  EventSP event_sp;
-
-  SendAsyncInterrupt();
-
   if (m_public_state.GetValue() == eStateAttaching) {
     // Don't hijack and eat the eStateExited as the code that was doing the
     // attach will be waiting for this event...
-    RestoreProcessEvents();
----------------
jimingham wrote:

If we find we're attaching we never actually hijack the process listener.  In that case in the old code we make a hijack listener, hijacked the process listener, then checked that we were attaching, and so needed not to have done all that.  RestoreProcessEvents is the call that undoes that unnecessary work.  So I moved making and hijacking the process to after this check, in which case RestoreProcessEvents is wrong, since it would remove a hijacker we didn't add.

That was an unrelated drive-by fix...

https://github.com/llvm/llvm-project/pull/65822


More information about the lldb-commits mailing list