LLDB mainline
ProcessWindows.h
Go to the documentation of this file.
1//===-- ProcessWindows.h ----------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_
10#define liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_
11
13#include "lldb/Target/Process.h"
14#include "lldb/Utility/Status.h"
15#include "lldb/lldb-forward.h"
16
18#include "ProcessDebugger.h"
19
20namespace lldb_private {
21
22class HostProcess;
23
24class ProcessWindows : public Process, public ProcessDebugger {
25public:
26 // Static functions.
28 lldb::ListenerSP listener_sp,
29 const FileSpec *,
30 bool can_connect);
31
32 static void Initialize();
33
34 static void Terminate();
35
36 static llvm::StringRef GetPluginNameStatic() { return "windows"; }
37
38 static llvm::StringRef GetPluginDescriptionStatic();
39
41
42 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
43
46
47 Status DoDetach(bool keep_stopped) override;
48 Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override;
50 lldb::pid_t pid,
51 const lldb_private::ProcessAttachInfo &attach_info) override;
52 Status DoResume(lldb::RunDirection direction) override;
53 Status DoDestroy() override;
54 Status DoHalt(bool &caused_stop) override;
55
56 void DidLaunch() override;
57 void DidAttach(lldb_private::ArchSpec &arch_spec) override;
58
59 void RefreshStateAfterStop() override;
60
61 bool CanDebug(lldb::TargetSP target_sp,
62 bool plugin_specified_by_name) override;
63 bool DestroyRequiresHalt() override { return false; }
64 bool DoUpdateThreadList(ThreadList &old_thread_list,
65 ThreadList &new_thread_list) override;
66 bool IsAlive() override;
67
69
70 size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
71 Status &error) override;
72 size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
73 Status &error) override;
74 lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions,
75 Status &error) override;
77
79
81
82 // IDebugDelegate overrides.
83 void OnExitProcess(uint32_t exit_code) override;
84 void OnDebuggerConnected(lldb::addr_t image_base) override;
85 ExceptionResult OnDebugException(bool first_chance,
86 const ExceptionRecord &record) override;
87 void OnCreateThread(const HostThread &thread) override;
88 void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override;
89 void OnLoadDll(const ModuleSpec &module_spec,
90 lldb::addr_t module_addr) override;
91 void OnUnloadDll(lldb::addr_t module_addr) override;
92 void OnDebugString(const std::string &string) override;
93 void OnDebuggerError(const Status &error, uint32_t type) override;
94
95 std::optional<uint32_t> GetWatchpointSlotCount() override;
97 bool notify = true) override;
99 bool notify = true) override;
100
101 void
102 SetPseudoConsoleHandle(const std::shared_ptr<PseudoConsole> &pty) override;
103
104protected:
105 ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
106
108 MemoryRegionInfo &info) override;
109
110private:
112 uint32_t slot_id;
114 uint32_t size;
115 bool read;
116 bool write;
117 };
118 std::map<lldb::break_id_t, WatchpointInfo> m_watchpoints;
119 std::vector<lldb::break_id_t> m_watchpoint_ids;
120};
121} // namespace lldb_private
122
123#endif // liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_
static llvm::raw_ostream & error(Stream &strm)
ExceptionResult
Definition ForwardDecl.h:16
An architecture specification class.
Definition ArchSpec.h:31
Class that manages the actual breakpoint that will be inserted into the running program.
A file utility class.
Definition FileSpec.h:57
A class that describes an executable image and its associated object and symbol files.
Definition Module.h:90
void OnLoadDll(const ModuleSpec &module_spec, lldb::addr_t module_addr) override
void OnDebugString(const std::string &string) override
ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
bool DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) override
Update the thread list following process plug-in's specific logic.
void RefreshStateAfterStop() override
Currently called as part of ShouldStop.
void OnDebuggerConnected(lldb::addr_t image_base) override
Status DoDeallocateMemory(lldb::addr_t ptr) override
Actually deallocate memory in the process.
Status EnableBreakpointSite(BreakpointSite *bp_site) override
void DidLaunch() override
Called after launching a process.
std::optional< uint32_t > GetWatchpointSlotCount() override
Get the number of watchpoints supported by this target.
Status DoResume(lldb::RunDirection direction) override
Resumes all of a process's threads as configured using the Thread run control functions.
void OnUnloadDll(lldb::addr_t module_addr) override
DynamicLoaderWindowsDYLD * GetDynamicLoader() override
Get the dynamic loader plug-in for this process.
void SetPseudoConsoleHandle(const std::shared_ptr< PseudoConsole > &pty) override
Status DisableWatchpoint(lldb::WatchpointSP wp_sp, bool notify=true) override
bool IsAlive() override
Check if a process is still alive.
Status DoGetMemoryRegionInfo(lldb::addr_t vm_addr, MemoryRegionInfo &info) override
DoGetMemoryRegionInfo is called by GetMemoryRegionInfo after it has removed non address bits from loa...
void OnCreateThread(const HostThread &thread) override
static llvm::StringRef GetPluginDescriptionStatic()
size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error) override
Actually do the writing of memory to a process.
llvm::StringRef GetPluginName() override
Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override
Launch a new process.
size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error) override
Actually do the reading of memory from a process.
bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override
Check if a plug-in instance can debug the file in module.
static llvm::StringRef GetPluginNameStatic()
void DidAttach(lldb_private::ArchSpec &arch_spec) override
Called after attaching a process.
void OnExitProcess(uint32_t exit_code) override
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *, bool can_connect)
void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override
Status DoAttachToProcessWithID(lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override
Attach to an existing process using a process ID.
lldb::addr_t GetImageInfoAddress() override
Get the image information address for the current process.
ExceptionResult OnDebugException(bool first_chance, const ExceptionRecord &record) override
std::map< lldb::break_id_t, WatchpointInfo > m_watchpoints
void OnDebuggerError(const Status &error, uint32_t type) override
ArchSpec GetSystemArchitecture() override
Get the system architecture for this process.
Status DoDetach(bool keep_stopped) override
Detaches from a running or stopped process.
std::vector< lldb::break_id_t > m_watchpoint_ids
lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, Status &error) override
Actually allocate memory in the process.
Status DisableBreakpointSite(BreakpointSite *bp_site) override
Status DoHalt(bool &caused_stop) override
Halts a running process.
bool DestroyRequiresHalt() override
Status EnableWatchpoint(lldb::WatchpointSP wp_sp, bool notify=true) override
Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
Construct with a shared pointer to a target, and the Process listener.
Definition Process.cpp:426
An error handling class.
Definition Status.h:118
A class that represents a running process on the host machine.
RunDirection
Execution directions.
std::shared_ptr< lldb_private::Process > ProcessSP
uint64_t pid_t
Definition lldb-types.h:83
std::shared_ptr< lldb_private::Watchpoint > WatchpointSP
std::shared_ptr< lldb_private::Listener > ListenerSP
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
uint64_t tid_t
Definition lldb-types.h:84