]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Plugins/Process/Windows/Live/ProcessWindowsLive.h
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / source / Plugins / Process / Windows / Live / ProcessWindowsLive.h
1 //===-- ProcessWindowsLive.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_Live_ProcessWindowsLive_H_
11 #define liblldb_Plugins_Process_Windows_Live_ProcessWindowsLive_H_
12
13 // C Includes
14
15 // C++ Includes
16 #include <memory>
17 #include <queue>
18
19 // Other libraries and framework includes
20 #include "ForwardDecl.h"
21 #include "IDebugDelegate.h"
22 #include "lldb/lldb-forward.h"
23 #include "lldb/Core/Error.h"
24 #include "lldb/Host/HostThread.h"
25 #include "lldb/Target/Process.h"
26
27 #include "llvm/Support/Mutex.h"
28
29 #include "plugins/Process/Windows/Common/ProcessWindows.h"
30
31 class ProcessMonitor;
32
33 namespace lldb_private
34 {
35 class HostProcess;
36 class ProcessWindowsData;
37
38 class ProcessWindowsLive : public lldb_private::ProcessWindows, public lldb_private::IDebugDelegate
39 {
40 public:
41     //------------------------------------------------------------------
42     // Static functions.
43     //------------------------------------------------------------------
44     static lldb::ProcessSP
45     CreateInstance(lldb::TargetSP target_sp,
46                    lldb_private::Listener &listener,
47                    const lldb_private::FileSpec *);
48
49     static void
50     Initialize();
51
52     static void
53     Terminate();
54
55     static lldb_private::ConstString
56     GetPluginNameStatic();
57
58     static const char *
59     GetPluginDescriptionStatic();
60
61     //------------------------------------------------------------------
62     // Constructors and destructors
63     //------------------------------------------------------------------
64     ProcessWindowsLive(lldb::TargetSP target_sp,
65                        lldb_private::Listener &listener);
66
67     ~ProcessWindowsLive();
68
69     // lldb_private::Process overrides
70     lldb_private::ConstString GetPluginName() override;
71     uint32_t GetPluginVersion() override;
72
73     lldb_private::Error EnableBreakpointSite(lldb_private::BreakpointSite *bp_site) override;
74     lldb_private::Error DisableBreakpointSite(lldb_private::BreakpointSite *bp_site) override;
75
76     lldb_private::Error DoDetach(bool keep_stopped) override;
77     lldb_private::Error DoLaunch(lldb_private::Module *exe_module, lldb_private::ProcessLaunchInfo &launch_info) override;
78     lldb_private::Error DoAttachToProcessWithID(lldb::pid_t pid,
79                                                 const lldb_private::ProcessAttachInfo &attach_info) override;
80     lldb_private::Error DoResume() override;
81     lldb_private::Error DoDestroy() override;
82     lldb_private::Error DoHalt(bool &caused_stop) override;
83
84     void DidLaunch() override;
85     void DidAttach(lldb_private::ArchSpec &arch_spec) override;
86
87     void RefreshStateAfterStop() override;
88
89     bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override;
90     bool
91     DestroyRequiresHalt() override
92     {
93         return false;
94     }
95     bool UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list) override;
96     bool IsAlive() override;
97
98     size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, lldb_private::Error &error) override;
99     size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, lldb_private::Error &error) override;
100     lldb_private::Error GetMemoryRegionInfo(lldb::addr_t vm_addr, lldb_private::MemoryRegionInfo &info) override;
101
102     // IDebugDelegate overrides.
103     void OnExitProcess(uint32_t exit_code) override;
104     void OnDebuggerConnected(lldb::addr_t image_base) override;
105     ExceptionResult OnDebugException(bool first_chance, const lldb_private::ExceptionRecord &record) override;
106     void OnCreateThread(const lldb_private::HostThread &thread) override;
107     void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override;
108     void OnLoadDll(const lldb_private::ModuleSpec &module_spec, lldb::addr_t module_addr) override;
109     void OnUnloadDll(lldb::addr_t module_addr) override;
110     void OnDebugString(const std::string &string) override;
111     void OnDebuggerError(const lldb_private::Error &error, uint32_t type) override;
112
113   private:
114     lldb_private::Error WaitForDebuggerConnection(lldb_private::DebuggerThreadSP debugger,
115                                                   lldb_private::HostProcess &process);
116
117     llvm::sys::Mutex m_mutex;
118
119     // Data for the active debugging session.
120     std::unique_ptr<lldb_private::ProcessWindowsData> m_session_data;
121 };
122
123 }
124
125 #endif  // liblldb_Plugins_Process_Windows_Live_ProcessWindowsLive_H_