blob: 9505eeb6c698161b731c60fb40f3a28601bd617a [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
Zachary Turner3985f892014-11-10 22:32:18 +000035 Error DebugLaunch(const ProcessLaunchInfo &launch_info);
36
37 HostProcess
38 GetProcess() const
39 {
40 return m_process;
41 }
42 HostThread
43 GetMainThread() const
44 {
45 return m_main_thread;
46 }
Zachary Turner02862bc2014-11-07 23:44:13 +000047
48 private:
49 void DebugLoop();
50 DWORD HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, DWORD thread_id);
51 DWORD HandleCreateThreadEvent(const CREATE_THREAD_DEBUG_INFO &info, DWORD thread_id);
52 DWORD HandleCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO &info, DWORD thread_id);
53 DWORD HandleExitThreadEvent(const EXIT_THREAD_DEBUG_INFO &info, DWORD thread_id);
54 DWORD HandleExitProcessEvent(const EXIT_PROCESS_DEBUG_INFO &info, DWORD thread_id);
55 DWORD HandleLoadDllEvent(const LOAD_DLL_DEBUG_INFO &info, DWORD thread_id);
56 DWORD HandleUnloadDllEvent(const UNLOAD_DLL_DEBUG_INFO &info, DWORD thread_id);
57 DWORD HandleODSEvent(const OUTPUT_DEBUG_STRING_INFO &info, DWORD thread_id);
58 DWORD HandleRipEvent(const RIP_INFO &info, DWORD thread_id);
59
60 DebugDelegateSP m_debug_delegate;
61
Zachary Turner02862bc2014-11-07 23:44:13 +000062 HostProcess m_process; // The process being debugged.
63 HostThread m_main_thread; // The main thread of the inferior.
64 HANDLE m_image_file; // The image file of the process being debugged.
65
66 static lldb::thread_result_t DebuggerThreadRoutine(void *data);
67 lldb::thread_result_t DebuggerThreadRoutine(const ProcessLaunchInfo &launch_info);
68};
69}
70
71#endif