summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-11-04 00:00:12 +0000
committerZachary Turner <zturner@google.com>2014-11-04 00:00:12 +0000
commit8f21174700c32a9e743a463317cbb7c9f7c230fd (patch)
tree2d68c8224fc404b98aa446b37d1b6ac8fd73627a /lldb/source/Plugins/Process/Windows/ProcessWindows.cpp
parent06ea7d6213e0be131137218977ec7873f638d8eb (diff)
downloadbcm5719-llvm-8f21174700c32a9e743a463317cbb7c9f7c230fd.tar.gz
bcm5719-llvm-8f21174700c32a9e743a463317cbb7c9f7c230fd.zip
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
Diffstat (limited to 'lldb/source/Plugins/Process/Windows/ProcessWindows.cpp')
-rw-r--r--lldb/source/Plugins/Process/Windows/ProcessWindows.cpp34
1 files changed, 32 insertions, 2 deletions
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 <vector>
+
// 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;
}
-
OpenPOWER on IntegriCloud