blob: 050539331df4cab00e55b06071cb7a1e58c0cbb8 [file] [log] [blame]
Zachary Turner35ed1322014-07-28 16:45:18 +00001//===-- ProcessWindows.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_ProcessWindows_H_
11#define liblldb_Plugins_Process_Windows_ProcessWindows_H_
12
13// C Includes
14
15// C++ Includes
Zachary Turner8f211742014-11-04 00:00:12 +000016#include <map>
Zachary Turner3985f892014-11-10 22:32:18 +000017#include <memory>
Zachary Turner35ed1322014-07-28 16:45:18 +000018#include <queue>
19
20// Other libraries and framework includes
Zachary Turner742346a2014-11-05 22:16:28 +000021#include "ForwardDecl.h"
22#include "IDebugDelegate.h"
Zachary Turnera32d2ce2014-11-12 19:31:56 +000023#include "lldb/lldb-forward.h"
Zachary Turner3985f892014-11-10 22:32:18 +000024#include "lldb/Core/Error.h"
Zachary Turner8f211742014-11-04 00:00:12 +000025#include "lldb/Host/HostThread.h"
Zachary Turner35ed1322014-07-28 16:45:18 +000026#include "lldb/Target/Process.h"
27
28class ProcessMonitor;
29
Zachary Turner8f211742014-11-04 00:00:12 +000030namespace lldb_private
31{
Zachary Turner3985f892014-11-10 22:32:18 +000032class ProcessWindowsData;
Zachary Turner8f211742014-11-04 00:00:12 +000033}
34
Zachary Turner742346a2014-11-05 22:16:28 +000035class ProcessWindows : public lldb_private::Process, public lldb_private::IDebugDelegate
Zachary Turner35ed1322014-07-28 16:45:18 +000036{
37public:
38 //------------------------------------------------------------------
39 // Static functions.
40 //------------------------------------------------------------------
41 static lldb::ProcessSP
42 CreateInstance(lldb_private::Target& target,
43 lldb_private::Listener &listener,
44 const lldb_private::FileSpec *);
45
46 static void
47 Initialize();
48
49 static void
50 Terminate();
51
52 static lldb_private::ConstString
53 GetPluginNameStatic();
54
55 static const char *
56 GetPluginDescriptionStatic();
57
58 //------------------------------------------------------------------
59 // Constructors and destructors
60 //------------------------------------------------------------------
61 ProcessWindows(lldb_private::Target& target,
62 lldb_private::Listener &listener);
63
Zachary Turner8f211742014-11-04 00:00:12 +000064 ~ProcessWindows();
65
Zachary Turner35ed1322014-07-28 16:45:18 +000066 virtual lldb_private::Error
67 DoDetach(bool keep_stopped);
68
69 virtual bool
70 DetachRequiresHalt() { return true; }
71
72 virtual bool
73 UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list);
74
75 virtual lldb_private::Error
76 DoLaunch (lldb_private::Module *exe_module,
77 lldb_private::ProcessLaunchInfo &launch_info);
78
79 virtual lldb_private::Error
80 DoResume ();
81
82 //------------------------------------------------------------------
83 // PluginInterface protocol
84 //------------------------------------------------------------------
85 virtual lldb_private::ConstString
86 GetPluginName();
87
88 virtual uint32_t
89 GetPluginVersion();
90
91 virtual void
92 GetPluginCommandHelp(const char *command, lldb_private::Stream *strm);
93
94 virtual lldb_private::Error
95 ExecutePluginCommand(lldb_private::Args &command,
96 lldb_private::Stream *strm);
97
98 virtual lldb_private::Log *
99 EnablePluginLogging(lldb_private::Stream *strm,
100 lldb_private::Args &command);
101
102
103 virtual bool
104 CanDebug(lldb_private::Target &target, bool plugin_specified_by_name);
105
106 virtual lldb_private::Error
107 DoDestroy ();
108
109 virtual void
110 RefreshStateAfterStop ();
111
112 virtual bool
113 IsAlive ();
114
Zachary Turner8f211742014-11-04 00:00:12 +0000115 virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, lldb_private::Error &error);
Zachary Turner742346a2014-11-05 22:16:28 +0000116
117 // IDebugDelegate overrides.
Zachary Turnerd6a7b632014-11-12 19:31:39 +0000118 virtual void OnExitProcess(uint32_t exit_code) override;
Zachary Turnera32d2ce2014-11-12 19:31:56 +0000119 virtual void OnDebuggerConnected(lldb::addr_t image_base) override;
Zachary Turnerd6a7b632014-11-12 19:31:39 +0000120 virtual ExceptionResult OnDebugException(bool first_chance, const lldb_private::ExceptionRecord &record) override;
121 virtual void OnCreateThread(const lldb_private::HostThread &thread) override;
122 virtual void OnExitThread(const lldb_private::HostThread &thread) override;
Zachary Turnera32d2ce2014-11-12 19:31:56 +0000123 virtual void OnLoadDll(const lldb_private::ModuleSpec &module_spec, lldb::addr_t module_addr) override;
124 virtual void OnUnloadDll(lldb::addr_t module_addr) override;
Zachary Turnerd6a7b632014-11-12 19:31:39 +0000125 virtual void OnDebugString(const std::string &string) override;
126 virtual void OnDebuggerError(const lldb_private::Error &error, uint32_t type) override;
Zachary Turner02862bc2014-11-07 23:44:13 +0000127
128 private:
Zachary Turnera32d2ce2014-11-12 19:31:56 +0000129 // Data for the active debugging session.
130 std::unique_ptr<lldb_private::ProcessWindowsData> m_session_data;
Zachary Turner35ed1322014-07-28 16:45:18 +0000131};
132
133#endif // liblldb_Plugins_Process_Windows_ProcessWindows_H_