From 8f21174700c32a9e743a463317cbb7c9f7c230fd Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 4 Nov 2014 00:00:12 +0000 Subject: Implement a framework for live debugging on Windows. When processes are launched for debugging on Windows now, LLDB will detect changes such as DLL loads and unloads, breakpoints, thread creation and deletion, etc. These notifications are not yet propagated to LLDB in a way that LLDB understands what is happening with the process. This only picks up the notifications from the OS in a way that they can be sent to LLDB with subsequent patches. Reviewed by: Scott Graham Differential Revision: http://reviews.llvm.org/D6037 llvm-svn: 221207 --- .../Plugins/Process/Windows/ProcessWindows.cpp | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'lldb/source/Plugins/Process/Windows/ProcessWindows.cpp') diff --git a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp index 50ee9f60217..e71c25f83a5 100644 --- a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp @@ -11,18 +11,24 @@ #include "lldb/Host/windows/windows.h" // C++ Includes +#include + // Other libraries and framework includes #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/State.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostProcess.h" +#include "lldb/Host/MonitoringProcessLauncher.h" +#include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/windows/ProcessLauncherWindows.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/FileAction.h" #include "lldb/Target/Target.h" +#include "DebugDriverThread.h" +#include "DebugProcessLauncher.h" #include "ProcessWindows.h" using namespace lldb; @@ -48,6 +54,7 @@ ProcessWindows::Initialize() PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); + DebugDriverThread::Initialize(); } } @@ -59,9 +66,14 @@ ProcessWindows::ProcessWindows(Target& target, Listener &listener) { } +ProcessWindows::~ProcessWindows() +{ +} + void ProcessWindows::Terminate() { + DebugDriverThread::Teardown(); } lldb_private::ConstString @@ -89,7 +101,26 @@ Error ProcessWindows::DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { - return Host::LaunchProcess(launch_info); + Error result; + HostProcess process; + SetPrivateState(eStateLaunching); + if (launch_info.GetFlags().Test(eLaunchFlagDebug)) + { + // 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()); + process = launcher.LaunchProcess(launch_info, result); + } + else + return Host::LaunchProcess(launch_info); + + if (!result.Success()) + return result; + + launch_info.SetProcessID(process.GetProcessId()); + SetID(process.GetProcessId()); + return result; } Error @@ -181,4 +212,3 @@ ProcessWindows::CanDebug(Target &target, bool plugin_specified_by_name) return exe_module_sp->GetFileSpec().Exists(); return false; } - -- cgit v1.2.3