Zachary Turner | 35ed132 | 2014-07-28 16:45:18 +0000 | [diff] [blame] | 1 | //===-- 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 Turner | 8f21174 | 2014-11-04 00:00:12 +0000 | [diff] [blame] | 16 | #include <map> |
Zachary Turner | 3985f89 | 2014-11-10 22:32:18 +0000 | [diff] [blame] | 17 | #include <memory> |
Zachary Turner | 35ed132 | 2014-07-28 16:45:18 +0000 | [diff] [blame] | 18 | #include <queue> |
| 19 | |
| 20 | // Other libraries and framework includes |
Zachary Turner | 742346a | 2014-11-05 22:16:28 +0000 | [diff] [blame] | 21 | #include "ForwardDecl.h" |
| 22 | #include "IDebugDelegate.h" |
Zachary Turner | a32d2ce | 2014-11-12 19:31:56 +0000 | [diff] [blame] | 23 | #include "lldb/lldb-forward.h" |
Zachary Turner | 3985f89 | 2014-11-10 22:32:18 +0000 | [diff] [blame] | 24 | #include "lldb/Core/Error.h" |
Zachary Turner | 8f21174 | 2014-11-04 00:00:12 +0000 | [diff] [blame] | 25 | #include "lldb/Host/HostThread.h" |
Zachary Turner | 35ed132 | 2014-07-28 16:45:18 +0000 | [diff] [blame] | 26 | #include "lldb/Target/Process.h" |
| 27 | |
| 28 | class ProcessMonitor; |
| 29 | |
Zachary Turner | 8f21174 | 2014-11-04 00:00:12 +0000 | [diff] [blame] | 30 | namespace lldb_private |
| 31 | { |
Zachary Turner | 3985f89 | 2014-11-10 22:32:18 +0000 | [diff] [blame] | 32 | class ProcessWindowsData; |
Zachary Turner | 8f21174 | 2014-11-04 00:00:12 +0000 | [diff] [blame] | 33 | } |
| 34 | |
Zachary Turner | 742346a | 2014-11-05 22:16:28 +0000 | [diff] [blame] | 35 | class ProcessWindows : public lldb_private::Process, public lldb_private::IDebugDelegate |
Zachary Turner | 35ed132 | 2014-07-28 16:45:18 +0000 | [diff] [blame] | 36 | { |
| 37 | public: |
| 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 Turner | 8f21174 | 2014-11-04 00:00:12 +0000 | [diff] [blame] | 64 | ~ProcessWindows(); |
| 65 | |
Zachary Turner | 35ed132 | 2014-07-28 16:45:18 +0000 | [diff] [blame] | 66 | 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 Turner | a2fc3a4 | 2014-11-17 17:46:27 +0000 | [diff] [blame^] | 115 | virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, lldb_private::Error &error) override; |
| 116 | virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, lldb_private::Error &error) override; |
Zachary Turner | 742346a | 2014-11-05 22:16:28 +0000 | [diff] [blame] | 117 | |
| 118 | // IDebugDelegate overrides. |
Zachary Turner | d6a7b63 | 2014-11-12 19:31:39 +0000 | [diff] [blame] | 119 | virtual void OnExitProcess(uint32_t exit_code) override; |
Zachary Turner | a32d2ce | 2014-11-12 19:31:56 +0000 | [diff] [blame] | 120 | virtual void OnDebuggerConnected(lldb::addr_t image_base) override; |
Zachary Turner | d6a7b63 | 2014-11-12 19:31:39 +0000 | [diff] [blame] | 121 | virtual ExceptionResult OnDebugException(bool first_chance, const lldb_private::ExceptionRecord &record) override; |
| 122 | virtual void OnCreateThread(const lldb_private::HostThread &thread) override; |
| 123 | virtual void OnExitThread(const lldb_private::HostThread &thread) override; |
Zachary Turner | a32d2ce | 2014-11-12 19:31:56 +0000 | [diff] [blame] | 124 | virtual void OnLoadDll(const lldb_private::ModuleSpec &module_spec, lldb::addr_t module_addr) override; |
| 125 | virtual void OnUnloadDll(lldb::addr_t module_addr) override; |
Zachary Turner | d6a7b63 | 2014-11-12 19:31:39 +0000 | [diff] [blame] | 126 | virtual void OnDebugString(const std::string &string) override; |
| 127 | virtual void OnDebuggerError(const lldb_private::Error &error, uint32_t type) override; |
Zachary Turner | 02862bc | 2014-11-07 23:44:13 +0000 | [diff] [blame] | 128 | |
| 129 | private: |
Zachary Turner | a32d2ce | 2014-11-12 19:31:56 +0000 | [diff] [blame] | 130 | // Data for the active debugging session. |
| 131 | std::unique_ptr<lldb_private::ProcessWindowsData> m_session_data; |
Zachary Turner | 35ed132 | 2014-07-28 16:45:18 +0000 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | #endif // liblldb_Plugins_Process_Windows_ProcessWindows_H_ |