[Lldb-commits] [lldb] 8266b7e - [lldb/Target] Fix event handling during process launch

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 12 04:34:54 PDT 2021


Author: Med Ismail Bennani
Date: 2021-07-12T12:34:26+01:00
New Revision: 8266b7ea7dac95b60843a1fdde31b42475687fe5

URL: https://github.com/llvm/llvm-project/commit/8266b7ea7dac95b60843a1fdde31b42475687fe5
DIFF: https://github.com/llvm/llvm-project/commit/8266b7ea7dac95b60843a1fdde31b42475687fe5.diff

LOG: [lldb/Target] Fix event handling during process launch

This patch fixes process event handling when the events are broadcasted
at launch. To do so, the patch introduces a new listener to fetch events
by hand off the event queue and then resending them ensure the event ordering.

Differental Revision: https://reviews.llvm.org/D105698

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>

Added: 
    

Modified: 
    lldb/source/Target/Process.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index c6411f6c2244..40ae5ab4568a 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -10,6 +10,7 @@
 #include <memory>
 #include <mutex>
 
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/Threading.h"
 
@@ -2473,6 +2474,11 @@ Status Process::Launch(ProcessLaunchInfo &launch_info) {
     if (error.Fail())
       return error;
 
+    // Listen and queue events that are broadcasted during the process launch.
+    ListenerSP listener_sp(Listener::MakeListener("LaunchEventHijack"));
+    HijackProcessEvents(listener_sp);
+    auto on_exit = llvm::make_scope_exit([this]() { RestoreProcessEvents(); });
+
     if (PrivateStateThreadIsValid())
       PausePrivateStateThread();
 


        


More information about the lldb-commits mailing list