[Lldb-commits] [lldb] r221405 - Decouple ProcessWindows from the Windows debug driver thread.

Zachary Turner zturner at google.com
Wed Nov 5 14:16:28 PST 2014


Author: zturner
Date: Wed Nov  5 16:16:28 2014
New Revision: 221405

URL: http://llvm.org/viewvc/llvm-project?rev=221405&view=rev
Log:
Decouple ProcessWindows from the Windows debug driver thread.

In the llgs world, ProcessWindows will eventually go away and
we'll implement a different protocol.  This patch decouples
ProcessWindows from the core debug loop so that this transition
will not be more difficult than it needs to be.

Added:
    lldb/trunk/source/Plugins/Process/Windows/ForwardDecl.h
    lldb/trunk/source/Plugins/Process/Windows/IDebugDelegate.h
      - copied, changed from r221378, lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h
    lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.cpp
    lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h
Removed:
    lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h
Modified:
    lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h
    lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h
    lldb/trunk/source/Host/windows/HostProcessWindows.cpp
    lldb/trunk/source/Host/windows/HostThreadWindows.cpp
    lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt
    lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.cpp
    lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.h
    lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.cpp
    lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.h
    lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.cpp
    lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.h
    lldb/trunk/source/Plugins/Process/Windows/DriverMessageResults.h
    lldb/trunk/source/Plugins/Process/Windows/DriverMessages.cpp
    lldb/trunk/source/Plugins/Process/Windows/DriverMessages.h
    lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h

Modified: lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/HostProcessWindows.h Wed Nov  5 16:16:28 2014
@@ -25,6 +25,8 @@ class HostProcessWindows : public HostNa
     explicit HostProcessWindows(lldb::process_t process);
     ~HostProcessWindows();
 
+    void SetOwnsHandle(bool owns);
+
     virtual Error Terminate();
     virtual Error GetMainModule(FileSpec &file_spec) const;
 
@@ -37,6 +39,8 @@ class HostProcessWindows : public HostNa
     static lldb::thread_result_t MonitorThread(void *thread_arg);
 
     void Close();
+
+    bool m_owns_handle;
 };
 }
 

Modified: lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/HostThreadWindows.h Wed Nov  5 16:16:28 2014
@@ -26,11 +26,16 @@ class HostThreadWindows : public HostNat
     HostThreadWindows(lldb::thread_t thread);
     virtual ~HostThreadWindows();
 
+    void SetOwnsHandle(bool owns);
+
     virtual Error Join(lldb::thread_result_t *result);
     virtual Error Cancel();
     virtual void Reset();
 
     lldb::tid_t GetThreadId() const;
+
+  private:
+    bool m_owns_handle;
 };
 }
 

Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Wed Nov  5 16:16:28 2014
@@ -31,11 +31,13 @@ struct MonitorInfo
 
 HostProcessWindows::HostProcessWindows()
     : HostNativeProcessBase()
+    , m_owns_handle(true)
 {
 }
 
 HostProcessWindows::HostProcessWindows(lldb::process_t process)
     : HostNativeProcessBase(process)
+    , m_owns_handle(true)
 {
 }
 
@@ -44,6 +46,12 @@ HostProcessWindows::~HostProcessWindows(
     Close();
 }
 
+void
+HostProcessWindows::SetOwnsHandle(bool owns)
+{
+    m_owns_handle = owns;
+}
+
 Error HostProcessWindows::Terminate()
 {
     Error error;
@@ -123,7 +131,7 @@ HostProcessWindows::MonitorThread(void *
 
 void HostProcessWindows::Close()
 {
-    if (m_process != LLDB_INVALID_PROCESS)
+    if (m_owns_handle && m_process != LLDB_INVALID_PROCESS)
         ::CloseHandle(m_process);
     m_process = nullptr;
 }

Modified: lldb/trunk/source/Host/windows/HostThreadWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostThreadWindows.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostThreadWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostThreadWindows.cpp Wed Nov  5 16:16:28 2014
@@ -19,11 +19,13 @@ using namespace lldb_private;
 
 HostThreadWindows::HostThreadWindows()
     : HostNativeThreadBase()
+    , m_owns_handle(true)
 {
 }
 
 HostThreadWindows::HostThreadWindows(lldb::thread_t thread)
     : HostNativeThreadBase(thread)
+    , m_owns_handle(true)
 {
 }
 
@@ -32,6 +34,12 @@ HostThreadWindows::~HostThreadWindows()
     Reset();
 }
 
+void
+HostThreadWindows::SetOwnsHandle(bool owns)
+{
+    m_owns_handle = owns;
+}
+
 Error
 HostThreadWindows::Join(lldb::thread_result_t *result)
 {
@@ -75,7 +83,7 @@ HostThreadWindows::GetThreadId() const
 void
 HostThreadWindows::Reset()
 {
-    if (m_thread != LLDB_INVALID_HOST_THREAD)
+    if (m_owns_handle && m_thread != LLDB_INVALID_HOST_THREAD)
         ::CloseHandle(m_thread);
 
     HostNativeThreadBase::Reset();

Modified: lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp Wed Nov  5 16:16:28 2014
@@ -38,9 +38,13 @@ ProcessLauncherWindows::LaunchProcess(co
     startupinfo.hStdInput = stdin_handle;
     startupinfo.hStdOutput = stdout_handle;
 
+    DWORD flags = CREATE_NEW_CONSOLE;
+    if (launch_info.GetFlags().Test(eLaunchFlagDebug))
+        flags |= DEBUG_ONLY_THIS_PROCESS;
+
     executable = launch_info.GetExecutableFile().GetPath();
     launch_info.GetArguments().GetQuotedCommandString(commandLine);
-    BOOL result = ::CreateProcessA(executable.c_str(), const_cast<char *>(commandLine.c_str()), NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL,
+    BOOL result = ::CreateProcessA(executable.c_str(), const_cast<char *>(commandLine.c_str()), NULL, NULL, TRUE, flags, NULL,
                                    launch_info.GetWorkingDirectory(), &startupinfo, &pi);
     if (result)
     {

Modified: lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/Windows/CMakeLists.txt Wed Nov  5 16:16:28 2014
@@ -9,6 +9,7 @@ add_lldb_library(lldbPluginProcessWindow
   DebugOneProcessThread.cpp
   DebugProcessLauncher.cpp
   DebugDriverThread.cpp
+  LocalDebugDelegate.cpp
   ProcessWindows.cpp
   )
 

Modified: lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.cpp Wed Nov  5 16:16:28 2014
@@ -127,13 +127,15 @@ DebugDriverThread::HandleDriverMessage(c
     // Create a DebugOneProcessThread which will do the actual creation and enter a debug loop on
     // a background thread, only returning after the process has been created on the background
     // thread.
-    std::shared_ptr<DebugOneProcessThread> slave(new DebugOneProcessThread(m_driver_thread));
-    const DriverLaunchProcessMessageResult *result = slave->DebugLaunch(launch_message);
+    DebugMapEntry map_entry;
+    map_entry.m_delegate = launch_message->GetDebugDelegate();
+    map_entry.m_slave.reset(new DebugOneProcessThread(m_driver_thread));
+    const DriverLaunchProcessMessageResult *result = map_entry.m_slave->DebugLaunch(launch_message);
     if (result && result->GetError().Success())
     {
         if (log)
             log->Printf("DebugDriverThread launched process '%s' with PID %d.", exe, result->GetProcess().GetProcessId());
-        m_debugged_processes.insert(std::make_pair(result->GetProcess().GetProcessId(), slave));
+        m_debugged_processes.insert(std::make_pair(result->GetProcess().GetProcessId(), map_entry));
     }
     else
     {
@@ -153,9 +155,18 @@ DebugDriverThread::OnExitProcess(const P
 {
     lldb::pid_t pid = message.GetProcess().GetProcessId();
 
-    m_debugged_processes.erase(pid);
+    // We invoke the delegate on the DriverThread rather than on the DebugOneProcessThread
+    // so that invoking delegates is thread-safe amongst each other.  e.g. Two delegate invocations
+    // are guaranteed to happen from the same thread.  Additionally, this guarantees that the
+    // driver thread has a chance to clean up after itself before notifying processes of the debug
+    // events, guaranteeing that no races happen whereby a process tries to kick off a new action
+    // as a result of some event, but the request for that new action gets picked up by the driver
+    // thread before the driver thread gets notified of the state change.
+    auto iter = m_debugged_processes.find(pid);
+    if (iter != m_debugged_processes.end())
+        iter->second.m_delegate->OnExitProcess(message);
 
-    Process::SetProcessExitStatus(nullptr, pid, true, 0, message.GetExitCode());
+    m_debugged_processes.erase(iter);
 }
 
 void
@@ -199,7 +210,10 @@ DebugDriverThread::OnDebuggerError(const
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
 
     lldb::pid_t pid = message.GetProcess().GetProcessId();
-    m_debugged_processes.erase(pid);
+    auto iter = m_debugged_processes.find(pid);
+    if (iter != m_debugged_processes.end())
+        iter->second.m_delegate->OnDebuggerError(message);
+    m_debugged_processes.erase(iter);
 
     if (log)
     {

Modified: lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebugDriverThread.h Wed Nov  5 16:16:28 2014
@@ -10,7 +10,8 @@
 #ifndef liblldb_Plugins_Process_Windows_DebugDriverThread_H_
 #define liblldb_Plugins_Process_Windows_DebugDriverThread_H_
 
-#include "IDebugEventHandler.h"
+#include "ForwardDecl.h"
+#include "IDebugDelegate.h"
 
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/windows/windows.h"
@@ -18,16 +19,8 @@
 
 #include <map>
 
-class ProcessWindows;
-
 namespace lldb_private
 {
-class DriverMessage;
-class DriverMessageResult;
-class DriverLaunchProcessMessage;
-class DriverLaunchProcessMessageResult;
-
-class DebugOneProcessThread;
 
 //----------------------------------------------------------------------
 // DebugDriverThread
@@ -36,9 +29,14 @@ class DebugOneProcessThread;
 // debugger to do different things like launching processes, attaching to
 // processes, etc.
 //----------------------------------------------------------------------
-class DebugDriverThread : public IDebugEventHandler
+class DebugDriverThread : public IDebugDelegate
 {
     friend class DebugOneProcessThread;
+    struct DebugMapEntry
+    {
+        DebugDelegateSP m_delegate;
+        std::shared_ptr<DebugOneProcessThread> m_slave;
+    };
 
   public:
     virtual ~DebugDriverThread();
@@ -59,7 +57,7 @@ class DebugDriverThread : public IDebugE
     const DriverMessageResult *HandleDriverMessage(const DriverMessage *message);
     const DriverLaunchProcessMessageResult *HandleDriverMessage(const DriverLaunchProcessMessage *launch_message);
 
-    // Debug event handlers.  These are invoked on the driver thread by way of QueueUserAPC as
+    // Debug delegate handlers.  These are invoked on the driver thread by way of QueueUserAPC as
     // events happen in the inferiors.
     virtual void OnProcessLaunched(const ProcessMessageCreateProcess &message) override;
     virtual void OnExitProcess(const ProcessMessageExitProcess &message) override;
@@ -74,7 +72,7 @@ class DebugDriverThread : public IDebugE
 
     static DebugDriverThread *m_instance;
 
-    std::map<lldb::pid_t, std::shared_ptr<DebugOneProcessThread>> m_debugged_processes;
+    std::map<lldb::pid_t, DebugMapEntry> m_debugged_processes;
 
     HANDLE m_driver_message_event;
     HANDLE m_shutdown_event;

Modified: lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.cpp Wed Nov  5 16:16:28 2014
@@ -18,6 +18,7 @@
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/ThisThread.h"
 #include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Host/windows/HostProcessWindows.h"
 #include "lldb/Host/windows/HostThreadWindows.h"
 #include "lldb/Host/windows/ProcessLauncherWindows.h"
 
@@ -37,6 +38,8 @@ struct DebugLaunchContext
 
 DebugOneProcessThread::DebugOneProcessThread(HostThread driver_thread)
     : m_driver_thread(driver_thread)
+    , m_pending_create(nullptr)
+    , m_image_file(nullptr)
 {
     m_launch_predicate.SetValue(nullptr, eBroadcastNever);
 }
@@ -53,7 +56,6 @@ DebugOneProcessThread::DebugLaunch(const
     DebugLaunchContext context;
     context.instance = this;
     context.launch = message;
-
     HostThread slave_thread(ThreadLauncher::LaunchThread("lldb.plugin.process-windows.slave[?]", DebugLaunchThread, &context, &error));
     if (error.Success())
         m_launch_predicate.WaitForValueNotEqualTo(nullptr, result);
@@ -79,24 +81,25 @@ DebugOneProcessThread::DebugLaunchThread
 
     Error error;
     ProcessLauncherWindows launcher;
-
-    m_process_plugin = message->GetProcessPlugin();
-    m_process = launcher.LaunchProcess(message->GetLaunchInfo(), error);
-
-    std::string thread_name;
-    llvm::raw_string_ostream name_stream(thread_name);
-    name_stream << "lldb.plugin.process-windows.slave[" << m_process.GetProcessId() << "]";
-    name_stream.flush();
-    ThisThread::SetName(thread_name.c_str());
-
-    DriverLaunchProcessMessageResult *result = DriverLaunchProcessMessageResult::Create(message);
-    result->SetError(error);
-    result->SetProcess(m_process);
-    m_launch_predicate.SetValue(result, eBroadcastAlways);
-
-    DebugLoop();
-    if (log)
-        log->Printf("Debug slave thread '%s' exiting.", thread_name.c_str());
+    HostProcess process(launcher.LaunchProcess(message->GetLaunchInfo(), error));
+    // If we couldn't create the process, return the result immediately.  Otherwise enter the debug
+    // loop and wait until we get the create process debug notification.  Note that if the process
+    // was created successfully, we can throw away the process handle we got from CreateProcess
+    // because Windows will give us another (potentially more useful?) handle when it sends us the
+    // CREATE_PROCESS_DEBUG_EVENT.
+    if (error.Success())
+    {
+        m_pending_create = message;
+        m_pending_create->Retain();
+        DebugLoop();
+    }
+    else
+    {
+        DriverLaunchProcessMessageResult *result = DriverLaunchProcessMessageResult::Create(m_pending_create);
+        result->SetError(error);
+        result->SetProcess(process);
+        m_launch_predicate.SetValue(result, eBroadcastAlways);
+    }
 
     return 0;
 }
@@ -162,6 +165,28 @@ DebugOneProcessThread::HandleCreateThrea
 DWORD
 DebugOneProcessThread::HandleCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO &info, DWORD thread_id)
 {
+    std::string thread_name;
+    llvm::raw_string_ostream name_stream(thread_name);
+    name_stream << "lldb.plugin.process-windows.slave[" << m_process.GetProcessId() << "]";
+    name_stream.flush();
+    ThisThread::SetName(thread_name.c_str());
+
+    // info.hProcess and info.hThread are closed automatically by Windows when
+    // EXIT_PROCESS_DEBUG_EVENT is received.
+    m_process = HostProcess(info.hProcess);
+    ((HostProcessWindows &)m_process.GetNativeProcess()).SetOwnsHandle(false);
+    m_main_thread = HostThread(info.hThread);
+    ((HostThreadWindows &)m_main_thread.GetNativeThread()).SetOwnsHandle(false);
+    m_image_file = info.hFile;
+
+    DriverLaunchProcessMessageResult *result = DriverLaunchProcessMessageResult::Create(m_pending_create);
+    result->SetError(Error());
+    result->SetProcess(m_process);
+    m_launch_predicate.SetValue(result, eBroadcastAlways);
+
+    m_pending_create->Release();
+    m_pending_create = nullptr;
+
     return DBG_CONTINUE;
 }
 
@@ -178,12 +203,19 @@ DebugOneProcessThread::HandleExitProcess
     ProcessMessageExitProcess *message = new ProcessMessageExitProcess(m_process, info.dwExitCode);
 
     QueueUserAPC(NotifySlaveProcessExited, driver, reinterpret_cast<ULONG_PTR>(message));
+
+    m_process = HostProcess();
+    m_main_thread = HostThread();
+    ::CloseHandle(m_image_file);
+    m_image_file = nullptr;
     return DBG_CONTINUE;
 }
 
 DWORD
 DebugOneProcessThread::HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info, DWORD thread_id)
 {
+    // Windows does not automatically close info.hFile when the DLL is unloaded.
+    ::CloseHandle(info.hFile);
     return DBG_CONTINUE;
 }
 
@@ -207,6 +239,7 @@ DebugOneProcessThread::HandleRipEvent(co
     ProcessMessageDebuggerError *message = new ProcessMessageDebuggerError(m_process, error, info.dwType);
 
     QueueUserAPC(NotifySlaveRipEvent, driver, reinterpret_cast<ULONG_PTR>(message));
+
     return DBG_CONTINUE;
 }
 

Modified: lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebugOneProcessThread.h Wed Nov  5 16:16:28 2014
@@ -10,15 +10,16 @@
 #ifndef liblldb_Plugins_Process_Windows_DebugOneProcessThread_H_
 #define liblldb_Plugins_Process_Windows_DebugOneProcessThread_H_
 
+#include "ForwardDecl.h"
 #include "lldb/Host/HostProcess.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/windows/windows.h"
 
+#include <memory>
+
 namespace lldb_private
 {
-class DriverLaunchProcessMessage;
-class DriverLaunchProcessMessageResult;
 
 //----------------------------------------------------------------------
 // DebugOneProcessThread
@@ -50,10 +51,17 @@ class DebugOneProcessThread : public std
     static void __stdcall NotifySlaveRipEvent(ULONG_PTR message);
 
     // The main debug driver thread which is controlling this slave.
-    lldb_private::HostThread m_driver_thread;
+    HostThread m_driver_thread;
+
+    HostProcess m_process;    // The process being debugged.
+    HostThread m_main_thread; // The main thread of the inferior.
+    HANDLE m_image_file;      // The image file of the process being debugged.
+
+    // After we've called CreateProcess, this signals that we're still waiting for the system
+    // debug event telling us the process has been created.
+    const DriverLaunchProcessMessage *m_pending_create;
+
     Predicate<const DriverLaunchProcessMessageResult *> m_launch_predicate;
-    lldb::ProcessSP m_process_plugin;
-    HostProcess m_process;
 
     static lldb::thread_result_t DebugLaunchThread(void *data);
     lldb::thread_result_t DebugLaunchThread(const DriverLaunchProcessMessage *message);

Modified: lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.cpp Wed Nov  5 16:16:28 2014
@@ -19,15 +19,15 @@
 using namespace lldb;
 using namespace lldb_private;
 
-DebugProcessLauncher::DebugProcessLauncher(lldb::ProcessSP process_plugin)
-    : m_process_plugin(process_plugin)
+DebugProcessLauncher::DebugProcessLauncher(DebugDelegateSP debug_delegate)
+    : m_debug_delegate(debug_delegate)
 {
 }
 
 HostProcess
 DebugProcessLauncher::LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error)
 {
-    DriverLaunchProcessMessage *message = DriverLaunchProcessMessage::Create(launch_info, m_process_plugin);
+    DriverLaunchProcessMessage *message = DriverLaunchProcessMessage::Create(launch_info, m_debug_delegate);
     DebugDriverThread::GetInstance().PostDebugMessage(message);
     const DriverLaunchProcessMessageResult *result = static_cast<const DriverLaunchProcessMessageResult *>(message->WaitForCompletion());
     error = result->GetError();

Modified: lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DebugProcessLauncher.h Wed Nov  5 16:16:28 2014
@@ -10,6 +10,8 @@
 #ifndef liblldb_Plugins_Process_Windows_DebugProcessLauncher_H_
 #define liblldb_Plugins_Process_Windows_DebugProcessLauncher_H_
 
+#include "ForwardDecl.h"
+
 #include "lldb/Host/ProcessLauncher.h"
 #include "lldb/lldb-forward.h"
 
@@ -29,11 +31,11 @@ namespace lldb_private
 class DebugProcessLauncher : public ProcessLauncher
 {
   public:
-    explicit DebugProcessLauncher(lldb::ProcessSP process_plugin);
+    explicit DebugProcessLauncher(DebugDelegateSP debug_delegate);
     virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error);
 
   private:
-    lldb::ProcessSP m_process_plugin;
+    DebugDelegateSP m_debug_delegate;
 };
 }
 

Modified: lldb/trunk/source/Plugins/Process/Windows/DriverMessageResults.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DriverMessageResults.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DriverMessageResults.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DriverMessageResults.h Wed Nov  5 16:16:28 2014
@@ -10,6 +10,8 @@
 #ifndef liblldb_Plugins_Process_Windows_DriverMessageResults_H_
 #define liblldb_Plugins_Process_Windows_DriverMessageResults_H_
 
+#include "ForwardDecl.h"
+
 #include "lldb/Core/Error.h"
 #include "lldb/Host/HostProcess.h"
 
@@ -18,10 +20,6 @@
 namespace lldb_private
 {
 
-class DriverMessage;
-class DriverMessageResult;
-class DriverLaunchProcessMessage;
-
 class DriverMessageResult : public llvm::ThreadSafeRefCountedBase<DriverMessageResult>
 {
   public:

Modified: lldb/trunk/source/Plugins/Process/Windows/DriverMessages.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DriverMessages.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DriverMessages.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DriverMessages.cpp Wed Nov  5 16:16:28 2014
@@ -48,15 +48,15 @@ DriverMessage::CompleteMessage(const Dri
     m_completion_predicate.SetValue(result, eBroadcastAlways);
 }
 
-DriverLaunchProcessMessage::DriverLaunchProcessMessage(const ProcessLaunchInfo &launch_info, lldb::ProcessSP process_plugin)
+DriverLaunchProcessMessage::DriverLaunchProcessMessage(const ProcessLaunchInfo &launch_info, DebugDelegateSP debug_delegate)
     : DriverMessage(DriverMessageType::eLaunchProcess)
     , m_launch_info(launch_info)
-    , m_process_plugin(process_plugin)
+    , m_debug_delegate(debug_delegate)
 {
 }
 
 DriverLaunchProcessMessage *
-DriverLaunchProcessMessage::Create(const ProcessLaunchInfo &launch_info, lldb::ProcessSP process_plugin)
+DriverLaunchProcessMessage::Create(const ProcessLaunchInfo &launch_info, DebugDelegateSP debug_delegate)
 {
-    return new DriverLaunchProcessMessage(launch_info, process_plugin);
+    return new DriverLaunchProcessMessage(launch_info, debug_delegate);
 }

Modified: lldb/trunk/source/Plugins/Process/Windows/DriverMessages.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/DriverMessages.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/DriverMessages.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/DriverMessages.h Wed Nov  5 16:16:28 2014
@@ -10,6 +10,8 @@
 #ifndef liblldb_Plugins_Process_Windows_DriverMessages_H_
 #define liblldb_Plugins_Process_Windows_DriverMessages_H_
 
+#include "ForwardDecl.h"
+
 #include "lldb/Host/Predicate.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Host/windows/windows.h"
@@ -17,15 +19,9 @@
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 
-#include <map>
-#include <memory>
-
-class ProcessWindows;
-
 namespace lldb_private
 {
-class DriverMessage;
-class DriverMessageResult;
+
 class ProcessLaunchInfo;
 
 enum class DriverMessageType
@@ -62,7 +58,7 @@ class DriverMessage : public llvm::Threa
 class DriverLaunchProcessMessage : public DriverMessage
 {
   public:
-    static DriverLaunchProcessMessage *Create(const ProcessLaunchInfo &launch_info, lldb::ProcessSP m_process_plugin);
+    static DriverLaunchProcessMessage *Create(const ProcessLaunchInfo &launch_info, DebugDelegateSP debug_delegate);
 
     const ProcessLaunchInfo &
     GetLaunchInfo() const
@@ -70,17 +66,17 @@ class DriverLaunchProcessMessage : publi
         return m_launch_info;
     }
 
-    lldb::ProcessSP
-    GetProcessPlugin() const
+    DebugDelegateSP
+    GetDebugDelegate() const
     {
-        return m_process_plugin;
+        return m_debug_delegate;
     }
 
   private:
-    DriverLaunchProcessMessage(const ProcessLaunchInfo &launch_info, lldb::ProcessSP m_process_plugin);
+    DriverLaunchProcessMessage(const ProcessLaunchInfo &launch_info, DebugDelegateSP debug_delegate);
 
     const ProcessLaunchInfo &m_launch_info;
-    lldb::ProcessSP m_process_plugin;
+    DebugDelegateSP m_debug_delegate;
 };
 }
 

Added: lldb/trunk/source/Plugins/Process/Windows/ForwardDecl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ForwardDecl.h?rev=221405&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ForwardDecl.h (added)
+++ lldb/trunk/source/Plugins/Process/Windows/ForwardDecl.h Wed Nov  5 16:16:28 2014
@@ -0,0 +1,45 @@
+//===-- ForwardDecl.h -------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Plugins_Process_Windows_ForwardDecl_H_
+#define liblldb_Plugins_Process_Windows_ForwardDecl_H_
+
+class ProcessWindows;
+
+#include <memory>
+
+namespace lldb_private
+{
+// Driver message forward declarations
+class DriverMessage;
+class DriverLaunchProcessMessage;
+
+// Driver message result forward declarations
+class DriverMessageResult;
+class DriverLaunchProcessMessageResult;
+
+class IDebugDelegate;
+
+// Process message forward declarations.
+class ProcessMessageBase;
+class ProcessMessageCreateProcess;
+class ProcessMessageExitProcess;
+class ProcessMessageDebuggerConnected;
+class ProcessMessageException;
+class ProcessMessageCreateThread;
+class ProcessMessageExitThread;
+class ProcessMessageLoadDll;
+class ProcessMessageUnloadDll;
+class ProcessMessageDebugString;
+class ProcessMessageDebuggerError;
+
+typedef std::shared_ptr<IDebugDelegate> DebugDelegateSP;
+}
+
+#endif
\ No newline at end of file

Copied: lldb/trunk/source/Plugins/Process/Windows/IDebugDelegate.h (from r221378, lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/IDebugDelegate.h?p2=lldb/trunk/source/Plugins/Process/Windows/IDebugDelegate.h&p1=lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h&r1=221378&r2=221405&rev=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/IDebugDelegate.h Wed Nov  5 16:16:28 2014
@@ -1,4 +1,4 @@
-//===-- IDebugEventHandler.h ------------------------------------*- C++ -*-===//
+//===-- IDebugDelegate.h ----------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef liblldb_Plugins_Process_Windows_IDebugEventHandler_H_
-#define liblldb_Plugins_Process_Windows_IDebugEventHandler_H_
+#ifndef liblldb_Plugins_Process_Windows_IDebugDelegate_H_
+#define liblldb_Plugins_Process_Windows_IDebugDelegate_H_
 
 namespace lldb_private
 {
@@ -25,15 +25,15 @@ class ProcessMessageDebugString;
 class ProcessMessageDebuggerError;
 
 //----------------------------------------------------------------------
-// IDebugEventHandler
+// IDebugDelegate
 //
-// IDebugEventHandler defines an interface which allows implementors to receive
+// IDebugDelegate defines an interface which allows implementors to receive
 // notification of events that happen in a debugged process.
 //----------------------------------------------------------------------
-class IDebugEventHandler
+class IDebugDelegate
 {
   public:
-    virtual ~IDebugEventHandler() {}
+    virtual ~IDebugDelegate() {}
 
     virtual void OnProcessLaunched(const ProcessMessageCreateProcess &message) = 0;
     virtual void OnExitProcess(const ProcessMessageExitProcess &message) = 0;

Removed: lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h?rev=221404&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/IDebugEventHandler.h (removed)
@@ -1,51 +0,0 @@
-//===-- IDebugEventHandler.h ------------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_Plugins_Process_Windows_IDebugEventHandler_H_
-#define liblldb_Plugins_Process_Windows_IDebugEventHandler_H_
-
-namespace lldb_private
-{
-
-class ProcessMessageCreateProcess;
-class ProcessMessageExitProcess;
-class ProcessMessageDebuggerConnected;
-class ProcessMessageException;
-class ProcessMessageCreateThread;
-class ProcessMessageExitThread;
-class ProcessMessageLoadDll;
-class ProcessMessageUnloadDll;
-class ProcessMessageDebugString;
-class ProcessMessageDebuggerError;
-
-//----------------------------------------------------------------------
-// IDebugEventHandler
-//
-// IDebugEventHandler defines an interface which allows implementors to receive
-// notification of events that happen in a debugged process.
-//----------------------------------------------------------------------
-class IDebugEventHandler
-{
-  public:
-    virtual ~IDebugEventHandler() {}
-
-    virtual void OnProcessLaunched(const ProcessMessageCreateProcess &message) = 0;
-    virtual void OnExitProcess(const ProcessMessageExitProcess &message) = 0;
-    virtual void OnDebuggerConnected(const ProcessMessageDebuggerConnected &message) = 0;
-    virtual void OnDebugException(const ProcessMessageException &message) = 0;
-    virtual void OnCreateThread(const ProcessMessageCreateThread &message) = 0;
-    virtual void OnExitThread(const ProcessMessageExitThread &message) = 0;
-    virtual void OnLoadDll(const ProcessMessageLoadDll &message) = 0;
-    virtual void OnUnloadDll(const ProcessMessageUnloadDll &message) = 0;
-    virtual void OnDebugString(const ProcessMessageDebugString &message) = 0;
-    virtual void OnDebuggerError(const ProcessMessageDebuggerError &message) = 0;
-};
-}
-
-#endif

Added: lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.cpp?rev=221405&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.cpp (added)
+++ lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.cpp Wed Nov  5 16:16:28 2014
@@ -0,0 +1,79 @@
+//===-- LocalDebugDelegate.cpp ----------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "LocalDebugDelegate.h"
+#include "ProcessWindows.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+LocalDebugDelegate::LocalDebugDelegate(ProcessSP process)
+    : m_process(process)
+{
+}
+
+void
+LocalDebugDelegate::OnProcessLaunched(const ProcessMessageCreateProcess &message)
+{
+    ((ProcessWindows &)*m_process).OnProcessLaunched(message);
+}
+
+void
+LocalDebugDelegate::OnExitProcess(const ProcessMessageExitProcess &message)
+{
+    ((ProcessWindows &)*m_process).OnExitProcess(message);
+}
+
+void
+LocalDebugDelegate::OnDebuggerConnected(const ProcessMessageDebuggerConnected &message)
+{
+    ((ProcessWindows &)*m_process).OnDebuggerConnected(message);
+}
+
+void
+LocalDebugDelegate::OnDebugException(const ProcessMessageException &message)
+{
+    ((ProcessWindows &)*m_process).OnDebugException(message);
+}
+
+void
+LocalDebugDelegate::OnCreateThread(const ProcessMessageCreateThread &message)
+{
+    ((ProcessWindows &)*m_process).OnCreateThread(message);
+}
+
+void
+LocalDebugDelegate::OnExitThread(const ProcessMessageExitThread &message)
+{
+    ((ProcessWindows &)*m_process).OnExitThread(message);
+}
+
+void
+LocalDebugDelegate::OnLoadDll(const ProcessMessageLoadDll &message)
+{
+    ((ProcessWindows &)*m_process).OnLoadDll(message);
+}
+
+void
+LocalDebugDelegate::OnUnloadDll(const ProcessMessageUnloadDll &message)
+{
+    ((ProcessWindows &)*m_process).OnUnloadDll(message);
+}
+
+void
+LocalDebugDelegate::OnDebugString(const ProcessMessageDebugString &message)
+{
+    ((ProcessWindows &)*m_process).OnDebugString(message);
+}
+
+void
+LocalDebugDelegate::OnDebuggerError(const ProcessMessageDebuggerError &message)
+{
+    ((ProcessWindows &)*m_process).OnDebuggerError(message);
+}

Added: lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h?rev=221405&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h (added)
+++ lldb/trunk/source/Plugins/Process/Windows/LocalDebugDelegate.h Wed Nov  5 16:16:28 2014
@@ -0,0 +1,61 @@
+//===-- LocalDebugDelegate.h ------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Plugins_Process_Windows_LocalDebugDelegate_H_
+#define liblldb_Plugins_Process_Windows_LocalDebugDelegate_H_
+
+#include "IDebugDelegate.h"
+#include "lldb/lldb-forward.h"
+
+class ProcessWindows;
+
+namespace lldb_private
+{
+//----------------------------------------------------------------------
+// LocalDebugDelegate
+//
+// LocalDebugDelegate creates a connection between a ProcessWindows and the
+// debug driver.  This serves to decouple ProcessWindows from the debug driver.
+// It would be possible to get a similar decoupling by just having
+// ProcessWindows implement this interface directly.  There are two reasons why
+// we don't do this:
+//
+// 1) In the future when we add support for local debugging through LLGS, and we
+//    go through the Native*Protocol interface, it is likely we will need the
+//    additional flexibility provided by this sort of adapter pattern.
+// 2) LLDB holds a shared_ptr to the ProcessWindows, and our driver thread also
+//    also needs access to it as well.  To avoid a race condition, we want to
+//    make sure that we're also holding onto a shared_ptr.
+//    lldb_private::Process supports enable_shared_from_this, but that gives us
+//    a ProcessSP (which is exactly what we are trying to decouple from the
+//    driver), so this adapter serves as a way to transparently hold the
+//    ProcessSP while still keeping it decoupled from the driver.
+//----------------------------------------------------------------------
+class LocalDebugDelegate : public IDebugDelegate
+{
+  public:
+    explicit LocalDebugDelegate::LocalDebugDelegate(lldb::ProcessSP process);
+
+    void OnProcessLaunched(const ProcessMessageCreateProcess &message);
+    void OnExitProcess(const ProcessMessageExitProcess &message);
+    void OnDebuggerConnected(const ProcessMessageDebuggerConnected &message);
+    void OnDebugException(const ProcessMessageException &message);
+    void OnCreateThread(const ProcessMessageCreateThread &message);
+    void OnExitThread(const ProcessMessageExitThread &message);
+    void OnLoadDll(const ProcessMessageLoadDll &message);
+    void OnUnloadDll(const ProcessMessageUnloadDll &message);
+    void OnDebugString(const ProcessMessageDebugString &message);
+    void OnDebuggerError(const ProcessMessageDebuggerError &message);
+
+  private:
+    lldb::ProcessSP m_process;
+};
+}
+
+#endif

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp Wed Nov  5 16:16:28 2014
@@ -29,6 +29,8 @@
 
 #include "DebugDriverThread.h"
 #include "DebugProcessLauncher.h"
+#include "LocalDebugDelegate.h"
+#include "ProcessMessages.h"
 #include "ProcessWindows.h"
 
 using namespace lldb;
@@ -109,7 +111,8 @@ ProcessWindows::DoLaunch(Module *exe_mod
         // If we're trying to debug this process, we need to use a
         // DebugProcessLauncher so that we can enter a WaitForDebugEvent loop
         // on the same thread that does the CreateProcess.
-        DebugProcessLauncher launcher(shared_from_this());
+        DebugDelegateSP delegate(new LocalDebugDelegate(shared_from_this()));
+        DebugProcessLauncher launcher(delegate);
         process = launcher.LaunchProcess(launch_info, result);
     }
     else
@@ -199,7 +202,6 @@ ProcessWindows::DoReadMemory(lldb::addr_
     return 0;
 }
 
-
 bool
 ProcessWindows::CanDebug(Target &target, bool plugin_specified_by_name)
 {
@@ -212,3 +214,54 @@ ProcessWindows::CanDebug(Target &target,
         return exe_module_sp->GetFileSpec().Exists();
     return false;
 }
+
+void
+ProcessWindows::OnProcessLaunched(const ProcessMessageCreateProcess &message)
+{
+}
+
+void
+ProcessWindows::OnExitProcess(const ProcessMessageExitProcess &message)
+{
+    SetProcessExitStatus(nullptr, GetID(), true, 0, message.GetExitCode());
+}
+
+void
+ProcessWindows::OnDebuggerConnected(const ProcessMessageDebuggerConnected &message)
+{
+}
+
+void
+ProcessWindows::OnDebugException(const ProcessMessageException &message)
+{
+}
+
+void
+ProcessWindows::OnCreateThread(const ProcessMessageCreateThread &message)
+{
+}
+
+void
+ProcessWindows::OnExitThread(const ProcessMessageExitThread &message)
+{
+}
+
+void
+ProcessWindows::OnLoadDll(const ProcessMessageLoadDll &message)
+{
+}
+
+void
+ProcessWindows::OnUnloadDll(const ProcessMessageUnloadDll &message)
+{
+}
+
+void
+ProcessWindows::OnDebugString(const ProcessMessageDebugString &message)
+{
+}
+
+void
+ProcessWindows::OnDebuggerError(const ProcessMessageDebuggerError &message)
+{
+}

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h?rev=221405&r1=221404&r2=221405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.h Wed Nov  5 16:16:28 2014
@@ -17,6 +17,8 @@
 #include <queue>
 
 // Other libraries and framework includes
+#include "ForwardDecl.h"
+#include "IDebugDelegate.h"
 #include "lldb/Host/HostThread.h"
 #include "lldb/Target/Process.h"
 
@@ -27,8 +29,7 @@ namespace lldb_private
 class HostProcess;
 }
 
-class ProcessWindows :
-    public lldb_private::Process
+class ProcessWindows : public lldb_private::Process, public lldb_private::IDebugDelegate
 {
 public:
     //------------------------------------------------------------------
@@ -109,6 +110,18 @@ public:
     IsAlive ();
 
     virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, lldb_private::Error &error);
+
+    // IDebugDelegate overrides.
+    virtual void OnProcessLaunched(const lldb_private::ProcessMessageCreateProcess &message) override;
+    virtual void OnExitProcess(const lldb_private::ProcessMessageExitProcess &message) override;
+    virtual void OnDebuggerConnected(const lldb_private::ProcessMessageDebuggerConnected &message) override;
+    virtual void OnDebugException(const lldb_private::ProcessMessageException &message) override;
+    virtual void OnCreateThread(const lldb_private::ProcessMessageCreateThread &message) override;
+    virtual void OnExitThread(const lldb_private::ProcessMessageExitThread &message) override;
+    virtual void OnLoadDll(const lldb_private::ProcessMessageLoadDll &message) override;
+    virtual void OnUnloadDll(const lldb_private::ProcessMessageUnloadDll &message) override;
+    virtual void OnDebugString(const lldb_private::ProcessMessageDebugString &message) override;
+    virtual void OnDebuggerError(const lldb_private::ProcessMessageDebuggerError &message) override;
 };
 
 #endif  // liblldb_Plugins_Process_Windows_ProcessWindows_H_





More information about the lldb-commits mailing list