blob: 98b554dae2a2a911e0bc03e70e7004ecb366f7c8 [file] [log] [blame]
Zachary Turner02862bc2014-11-07 23:44:13 +00001//===-- DebuggerThread.h ----------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_Plugins_Process_Windows_DebuggerThread_H_
11#define liblldb_Plugins_Process_Windows_DebuggerThread_H_
12
13#include "ForwardDecl.h"
14#include "lldb/Host/HostProcess.h"
15#include "lldb/Host/HostThread.h"
16#include "lldb/Host/windows/windows.h"
17
18#include <memory>
19
20namespace lldb_private
21{
22
23//----------------------------------------------------------------------
24// DebuggerThread
25//
26// Debugs a single process, notifying listeners as appropriate when interesting
27// things occur.
28//----------------------------------------------------------------------
29class DebuggerThread : public std::enable_shared_from_this<DebuggerThread>
30{
31 public:
32 DebuggerThread(DebugDelegateSP debug_delegate);
33 virtual ~DebuggerThread();
34
35 HostProcess DebugLaunch(const ProcessLaunchInfo &launch_info);
36
37 private:
38 void DebugLoop();
39 DWORD HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, DWORD thread_id);
40 DWORD HandleCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO &info, DWORD thread_id);
41 DWORD HandleCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO &info, DWORD thread_id);
42 DWORD HandleExitThreadEvent(const EXIT_THREAD_DEBUG_INFO &info, DWORD thread_id);
43 DWORD HandleExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO &info, DWORD thread_id);
44 DWORD HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info, DWORD thread_id);
45 DWORD HandleUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO &info, DWORD thread_id);
46 DWORD HandleODSEvent(const OUTPUT_DEBUG_STRING_INFO &info, DWORD thread_id);
47 DWORD HandleRipEvent(const RIP_INFO &info, DWORD thread_id);
48
49 DebugDelegateSP m_debug_delegate;
50
51 HANDLE m_launched_event; // Signalled when the process is finished launching, either
52 // successfully or with an error.
53
54 HostProcess m_process; // The process being debugged.
55 HostThread m_main_thread; // The main thread of the inferior.
56 HANDLE m_image_file; // The image file of the process being debugged.
57
58 static lldb::thread_result_t DebuggerThreadRoutine(void *data);
59 lldb::thread_result_t DebuggerThreadRoutine(const ProcessLaunchInfo &launch_info);
60};
61}
62
63#endif