brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 97284b7 Raw
124 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_10#define liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_11 12#include "lldb/Target/Process.h"13#include "lldb/Utility/Status.h"14#include "lldb/lldb-forward.h"15 16#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"17#include "ProcessDebugger.h"18 19namespace lldb_private {20 21class HostProcess;22 23class ProcessWindows : public Process, public ProcessDebugger {24public:25  // Static functions.26  static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,27                                        lldb::ListenerSP listener_sp,28                                        const FileSpec *,29                                        bool can_connect);30 31  static void Initialize();32 33  static void Terminate();34 35  static llvm::StringRef GetPluginNameStatic() { return "windows"; }36 37  static llvm::StringRef GetPluginDescriptionStatic();38 39  ~ProcessWindows();40 41  size_t GetSTDOUT(char *buf, size_t buf_size, Status &error) override;42  size_t GetSTDERR(char *buf, size_t buf_size, Status &error) override;43  size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) override;44 45  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }46 47  Status EnableBreakpointSite(BreakpointSite *bp_site) override;48  Status DisableBreakpointSite(BreakpointSite *bp_site) override;49 50  Status DoDetach(bool keep_stopped) override;51  Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) override;52  Status DoAttachToProcessWithID(53      lldb::pid_t pid,54      const lldb_private::ProcessAttachInfo &attach_info) override;55  Status DoResume(lldb::RunDirection direction) override;56  Status DoDestroy() override;57  Status DoHalt(bool &caused_stop) override;58 59  void DidLaunch() override;60  void DidAttach(lldb_private::ArchSpec &arch_spec) override;61 62  void RefreshStateAfterStop() override;63 64  bool CanDebug(lldb::TargetSP target_sp,65                bool plugin_specified_by_name) override;66  bool DestroyRequiresHalt() override { return false; }67  bool DoUpdateThreadList(ThreadList &old_thread_list,68                          ThreadList &new_thread_list) override;69  bool IsAlive() override;70 71  ArchSpec GetSystemArchitecture() override;72 73  size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,74                      Status &error) override;75  size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,76                       Status &error) override;77  lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions,78                                Status &error) override;79  Status DoDeallocateMemory(lldb::addr_t ptr) override;80 81  lldb::addr_t GetImageInfoAddress() override;82 83  DynamicLoaderWindowsDYLD *GetDynamicLoader() override;84 85  // IDebugDelegate overrides.86  void OnExitProcess(uint32_t exit_code) override;87  void OnDebuggerConnected(lldb::addr_t image_base) override;88  ExceptionResult OnDebugException(bool first_chance,89                                   const ExceptionRecord &record) override;90  void OnCreateThread(const HostThread &thread) override;91  void OnExitThread(lldb::tid_t thread_id, uint32_t exit_code) override;92  void OnLoadDll(const ModuleSpec &module_spec,93                 lldb::addr_t module_addr) override;94  void OnUnloadDll(lldb::addr_t module_addr) override;95  void OnDebugString(const std::string &string) override;96  void OnDebuggerError(const Status &error, uint32_t type) override;97 98  std::optional<uint32_t> GetWatchpointSlotCount() override;99  Status EnableWatchpoint(lldb::WatchpointSP wp_sp,100                          bool notify = true) override;101  Status DisableWatchpoint(lldb::WatchpointSP wp_sp,102                           bool notify = true) override;103 104protected:105  ProcessWindows(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);106 107  Status DoGetMemoryRegionInfo(lldb::addr_t vm_addr,108                               MemoryRegionInfo &info) override;109 110private:111  struct WatchpointInfo {112    uint32_t slot_id;113    lldb::addr_t address;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_private122 123#endif // liblldb_Plugins_Process_Windows_Common_ProcessWindows_H_124