Files
clang-p2996/lldb/source/Plugins/Process/Windows/DebugDriverThread.h
Zachary Turner 8f21174700 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
2014-11-04 00:00:12 +00:00

80 lines
2.3 KiB
C++

//===-- DebugDriverThread.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_DebugDriverThread_H_
#define liblldb_Plugins_Process_Windows_DebugDriverThread_H_
#include "lldb/Host/HostThread.h"
#include "lldb/Host/windows/windows.h"
#include "lldb/lldb-types.h"
#include <map>
class ProcessWindows;
namespace lldb_private
{
class DebugMonitorMessage;
class DebugMonitorMessageResult;
class DebugOneProcessThread;
class LaunchProcessMessage;
class LaunchProcessMessageResult;
class SlaveMessageProcessExited;
class SlaveMessageRipEvent;
//----------------------------------------------------------------------
// DebugDriverThread
//
// Runs a background thread that pumps a queue from the application to tell the
// debugger to do different things like launching processes, attaching to
// processes, etc.
//----------------------------------------------------------------------
class DebugDriverThread
{
friend class DebugOneProcessThread;
public:
virtual ~DebugDriverThread();
static void Initialize();
static void Teardown();
static DebugDriverThread &GetInstance();
void PostDebugMessage(const DebugMonitorMessage *message);
private:
DebugDriverThread();
void Shutdown();
bool ProcessMonitorMessages();
const DebugMonitorMessageResult *HandleMonitorMessage(const DebugMonitorMessage *message);
const LaunchProcessMessageResult *HandleMonitorMessage(const LaunchProcessMessage *launch_message);
// Slave message handlers. These are invoked by the
void HandleSlaveEvent(const SlaveMessageProcessExited &message);
void HandleSlaveEvent(const SlaveMessageRipEvent &message);
static DebugDriverThread *m_instance;
std::map<lldb::pid_t, std::shared_ptr<DebugOneProcessThread>> m_debugged_processes;
HANDLE m_monitor_event;
HANDLE m_shutdown_event;
HANDLE m_monitor_pipe_read;
HANDLE m_monitor_pipe_write;
lldb_private::HostThread m_monitor_thread;
static lldb::thread_result_t MonitorThread(void *data);
};
}
#endif