LLDB mainline
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::NativeProcessWindows Class Reference

#include <NativeProcessWindows.h>

Inheritance diagram for lldb_private::NativeProcessWindows:
Inheritance graph
[legend]

Classes

class  Manager
 

Public Member Functions

Status Resume (const ResumeActionList &resume_actions) override
 
Status Halt () override
 
Status Detach () override
 
Status Signal (int signo) override
 Sends a process a UNIX signal signal.
 
Status Interrupt () override
 Tells a process to interrupt all operations as if by a Ctrl-C.
 
Status Kill () override
 
Status IgnoreSignals (llvm::ArrayRef< int > signals) override
 
Status GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info) override
 
Status ReadMemory (lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) override
 
Status WriteMemory (lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) override
 
llvm::Expected< lldb::addr_tAllocateMemory (size_t size, uint32_t permissions) override
 
llvm::Error DeallocateMemory (lldb::addr_t addr) override
 
lldb::addr_t GetSharedLibraryInfoAddress () override
 
bool IsAlive () const override
 
size_t UpdateThreads () override
 
const ArchSpecGetArchitecture () const override
 
void SetArchitecture (const ArchSpec &arch_spec)
 
Status SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware) override
 
Status RemoveBreakpoint (lldb::addr_t addr, bool hardware=false) override
 
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > GetAuxvData () const override
 
Status GetLoadedModuleFileSpec (const char *module_path, FileSpec &file_spec) override
 
Status GetFileLoadAddress (const llvm::StringRef &file_name, lldb::addr_t &load_addr) override
 
void OnExitProcess (uint32_t exit_code) override
 
void OnDebuggerConnected (lldb::addr_t image_base) override
 
ExceptionResult OnDebugException (bool first_chance, const ExceptionRecord &record) override
 
void OnCreateThread (const HostThread &thread) override
 
void OnExitThread (lldb::tid_t thread_id, uint32_t exit_code) override
 
void OnLoadDll (const ModuleSpec &module_spec, lldb::addr_t module_addr) override
 
void OnUnloadDll (lldb::addr_t module_addr) override
 
- Public Member Functions inherited from lldb_private::NativeProcessProtocol
virtual ~NativeProcessProtocol ()=default
 
virtual Status Resume (const ResumeActionList &resume_actions)=0
 
virtual Status Halt ()=0
 
virtual Status Detach ()=0
 
virtual Status Signal (int signo)=0
 Sends a process a UNIX signal signal.
 
virtual Status Interrupt ()
 Tells a process to interrupt all operations as if by a Ctrl-C.
 
virtual Status Kill ()=0
 
virtual Status IgnoreSignals (llvm::ArrayRef< int > signals)
 
virtual Status GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info)
 
virtual Status ReadMemory (lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)=0
 
Status ReadMemoryWithoutTrap (lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
 
virtual Status ReadMemoryTags (int32_t type, lldb::addr_t addr, size_t len, std::vector< uint8_t > &tags)
 
virtual Status WriteMemoryTags (int32_t type, lldb::addr_t addr, size_t len, const std::vector< uint8_t > &tags)
 
llvm::Expected< llvm::StringRef > ReadCStringFromMemory (lldb::addr_t addr, char *buffer, size_t max_size, size_t &total_bytes_read)
 Reads a null terminated string from memory.
 
virtual Status WriteMemory (lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)=0
 
virtual llvm::Expected< lldb::addr_tAllocateMemory (size_t size, uint32_t permissions)
 
virtual llvm::Error DeallocateMemory (lldb::addr_t addr)
 
virtual lldb::addr_t GetSharedLibraryInfoAddress ()=0
 
virtual llvm::Expected< std::vector< SVR4LibraryInfo > > GetLoadedSVR4Libraries ()
 
virtual bool IsAlive () const
 
virtual size_t UpdateThreads ()=0
 
virtual const ArchSpecGetArchitecture () const =0
 
virtual Status SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware)=0
 
virtual Status RemoveBreakpoint (lldb::addr_t addr, bool hardware=false)
 
virtual const HardwareBreakpointMapGetHardwareBreakpointMap () const
 
virtual Status SetHardwareBreakpoint (lldb::addr_t addr, size_t size)
 
virtual Status RemoveHardwareBreakpoint (lldb::addr_t addr)
 
virtual const NativeWatchpointList::WatchpointMapGetWatchpointMap () const
 
virtual std::optional< std::pair< uint32_t, uint32_t > > GetHardwareDebugSupportInfo () const
 
virtual Status SetWatchpoint (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware)
 
virtual Status RemoveWatchpoint (lldb::addr_t addr)
 
lldb::pid_t GetID () const
 
lldb::StateType GetState () const
 
bool IsRunning () const
 
bool IsStepping () const
 
bool CanResume () const
 
lldb::ByteOrder GetByteOrder () const
 
uint32_t GetAddressByteSize () const
 
virtual llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > GetAuxvData () const =0
 
virtual std::optional< WaitStatusGetExitStatus ()
 
virtual bool SetExitStatus (WaitStatus status, bool bNotifyStateChange)
 
NativeThreadProtocolGetThreadAtIndex (uint32_t idx)
 
NativeThreadProtocolGetThreadByID (lldb::tid_t tid)
 
void SetCurrentThreadID (lldb::tid_t tid)
 
lldb::tid_t GetCurrentThreadID () const
 
NativeThreadProtocolGetCurrentThread ()
 
ThreadIterable Threads () const
 
virtual int GetTerminalFileDescriptor ()
 
uint32_t GetStopID () const
 
virtual Status GetLoadedModuleFileSpec (const char *module_path, FileSpec &file_spec)=0
 
virtual Status GetFileLoadAddress (const llvm::StringRef &file_name, lldb::addr_t &load_addr)=0
 
virtual void NotifyTracersProcessWillResume ()
 Notify tracers that the target process will resume.
 
virtual void NotifyTracersProcessDidStop ()
 Notify tracers that the target process just stopped.
 
virtual llvm::Error TraceStart (llvm::StringRef json_params, llvm::StringRef type)
 Start tracing a process or its threads.
 
virtual llvm::Error TraceStop (const TraceStopRequest &request)
 Stop tracing a live process or its threads.
 
virtual llvm::Expected< llvm::json::Value > TraceGetState (llvm::StringRef type)
 Get the current tracing state of the process and its threads.
 
virtual llvm::Expected< std::vector< uint8_t > > TraceGetBinaryData (const TraceGetBinaryDataRequest &request)
 Get binary data given a trace technology and a data identifier.
 
virtual llvm::Expected< TraceSupportedResponseTraceSupported ()
 Get the processor tracing type supported for this process.
 
virtual void SetEnabledExtensions (Extension flags)
 Method called in order to propagate the bitmap of protocol extensions supported by the client.
 
virtual llvm::Expected< std::string > SaveCore (llvm::StringRef path_hint)
 Write a core dump (without crashing the program).
 
- Public Member Functions inherited from lldb_private::ProcessDebugger
virtual ~ProcessDebugger ()
 
virtual void OnExitProcess (uint32_t exit_code)
 
virtual void OnDebuggerConnected (lldb::addr_t image_base)
 
virtual ExceptionResult OnDebugException (bool first_chance, const ExceptionRecord &record)
 
virtual void OnCreateThread (const HostThread &thread)
 
virtual void OnExitThread (lldb::tid_t thread_id, uint32_t exit_code)
 
virtual void OnLoadDll (const ModuleSpec &module_spec, lldb::addr_t module_addr)
 
virtual void OnUnloadDll (lldb::addr_t module_addr)
 
virtual void OnDebugString (const std::string &string)
 
virtual void OnDebuggerError (const Status &error, uint32_t type)
 

Protected Member Functions

NativeThreadWindowsGetThreadByID (lldb::tid_t thread_id)
 
llvm::Expected< llvm::ArrayRef< uint8_t > > GetSoftwareBreakpointTrapOpcode (size_t size_hint) override
 
size_t GetSoftwareBreakpointPCOffset () override
 Return the offset of the PC relative to the software breakpoint that was hit.
 
bool FindSoftwareBreakpoint (lldb::addr_t addr)
 
void StopThread (lldb::tid_t thread_id, lldb::StopReason reason, std::string description="")
 
void SetStopReasonForThread (NativeThreadWindows &thread, lldb::StopReason reason, std::string description="")
 
- Protected Member Functions inherited from lldb_private::NativeProcessProtocol
 NativeProcessProtocol (lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate)
 
void SetID (lldb::pid_t pid)
 
void SetState (lldb::StateType state, bool notify_delegates=true)
 
virtual void DoStopIDBumped (uint32_t newBumpId)
 
Status SetSoftwareBreakpoint (lldb::addr_t addr, uint32_t size_hint)
 
Status RemoveSoftwareBreakpoint (lldb::addr_t addr)
 
virtual llvm::Expected< llvm::ArrayRef< uint8_t > > GetSoftwareBreakpointTrapOpcode (size_t size_hint)
 
virtual size_t GetSoftwareBreakpointPCOffset ()
 Return the offset of the PC relative to the software breakpoint that was hit.
 
void FixupBreakpointPCAsNeeded (NativeThreadProtocol &thread)
 
virtual void NotifyDidExec ()
 Notify the delegate that an exec occurred.
 
NativeThreadProtocolGetThreadByIDUnlocked (lldb::tid_t tid)
 
- Protected Member Functions inherited from lldb_private::ProcessDebugger
Status DetachProcess ()
 
Status LaunchProcess (ProcessLaunchInfo &launch_info, DebugDelegateSP delegate)
 
Status AttachProcess (lldb::pid_t pid, const ProcessAttachInfo &attach_info, DebugDelegateSP delegate)
 
Status DestroyProcess (lldb::StateType process_state)
 
Status HaltProcess (bool &caused_stop)
 
Status GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info)
 
Status ReadMemory (lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
 
Status WriteMemory (lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)
 
Status AllocateMemory (size_t size, uint32_t permissions, lldb::addr_t &addr)
 
Status DeallocateMemory (lldb::addr_t addr)
 
lldb::pid_t GetDebuggedProcessId () const
 
Status WaitForDebuggerConnection (DebuggerThreadSP debugger, HostProcess &process)
 

Private Member Functions

 NativeProcessWindows (ProcessLaunchInfo &launch_info, NativeDelegate &delegate, llvm::Error &E)
 
 NativeProcessWindows (lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate, llvm::Error &E)
 
Status CacheLoadedModules ()
 

Private Attributes

ArchSpec m_arch
 
std::map< lldb_private::FileSpec, lldb::addr_tm_loaded_modules
 

Additional Inherited Members

- Public Types inherited from lldb_private::NativeProcessProtocol
enum class  Extension {
  multiprocess = (1u << 0) , fork = (1u << 1) , vfork = (1u << 2) , pass_signals = (1u << 3) ,
  auxv = (1u << 4) , libraries_svr4 = (1u << 5) , memory_tagging = (1u << 6) , savecore = (1u << 7) ,
  siginfo_read = (1u << 8)
}
 Extension flag constants, returned by Manager::GetSupportedExtensions() and passed to SetEnabledExtension() More...
 
typedef std::vector< std::unique_ptr< NativeThreadProtocol > > thread_collection
 
typedef LockingAdaptedIterable< thread_collection, NativeThreadProtocol &, thread_list_adapter, std::recursive_mutex > ThreadIterable
 
- Static Public Member Functions inherited from lldb_private::NativeProcessProtocol
template<typename I >
static NativeThreadProtocolthread_list_adapter (I &iter)
 
- Protected Attributes inherited from lldb_private::NativeProcessProtocol
std::unordered_map< lldb::addr_t, SoftwareBreakpointm_software_breakpoints
 
lldb::pid_t m_pid
 
std::vector< std::unique_ptr< NativeThreadProtocol > > m_threads
 
lldb::tid_t m_current_thread_id = LLDB_INVALID_THREAD_ID
 
std::recursive_mutex m_threads_mutex
 
lldb::StateType m_state = lldb::eStateInvalid
 
std::recursive_mutex m_state_mutex
 
std::optional< WaitStatusm_exit_status
 
NativeDelegatem_delegate
 
NativeWatchpointList m_watchpoint_list
 
HardwareBreakpointMap m_hw_breakpoints_map
 
int m_terminal_fd
 
uint32_t m_stop_id = 0
 
llvm::DenseSet< int > m_signals_to_ignore
 
Extension m_enabled_extensions
 
- Protected Attributes inherited from lldb_private::ProcessDebugger
llvm::sys::Mutex m_mutex
 
std::unique_ptr< ProcessWindowsDatam_session_data
 

Detailed Description

Definition at line 30 of file NativeProcessWindows.h.

Constructor & Destructor Documentation

◆ NativeProcessWindows() [1/2]

lldb_private::NativeProcessWindows::NativeProcessWindows ( ProcessLaunchInfo launch_info,
NativeDelegate delegate,
llvm::Error &  E 
)
private

◆ NativeProcessWindows() [2/2]

lldb_private::NativeProcessWindows::NativeProcessWindows ( lldb::pid_t  pid,
int  terminal_fd,
NativeDelegate delegate,
llvm::Error &  E 
)
private

Member Function Documentation

◆ AllocateMemory()

llvm::Expected< lldb::addr_t > lldb_private::NativeProcessWindows::AllocateMemory ( size_t  size,
uint32_t  permissions 
)
overridevirtual

◆ CacheLoadedModules()

Status lldb_private::NativeProcessWindows::CacheLoadedModules ( )
private

◆ DeallocateMemory()

llvm::Error lldb_private::NativeProcessWindows::DeallocateMemory ( lldb::addr_t  addr)
overridevirtual

◆ Detach()

Status lldb_private::NativeProcessWindows::Detach ( )
overridevirtual

◆ FindSoftwareBreakpoint()

bool lldb_private::NativeProcessWindows::FindSoftwareBreakpoint ( lldb::addr_t  addr)
protected

◆ GetArchitecture()

const ArchSpec & lldb_private::NativeProcessWindows::GetArchitecture ( ) const
inlineoverridevirtual

◆ GetAuxvData()

llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > lldb_private::NativeProcessWindows::GetAuxvData ( ) const
overridevirtual

Implements lldb_private::NativeProcessProtocol.

Definition at line 286 of file NativeProcessWindows.cpp.

◆ GetFileLoadAddress()

Status lldb_private::NativeProcessWindows::GetFileLoadAddress ( const llvm::StringRef &  file_name,
lldb::addr_t load_addr 
)
overridevirtual

◆ GetLoadedModuleFileSpec()

Status lldb_private::NativeProcessWindows::GetLoadedModuleFileSpec ( const char *  module_path,
FileSpec file_spec 
)
overridevirtual

◆ GetMemoryRegionInfo()

Status lldb_private::NativeProcessWindows::GetMemoryRegionInfo ( lldb::addr_t  load_addr,
MemoryRegionInfo range_info 
)
overridevirtual

◆ GetSharedLibraryInfoAddress()

lldb::addr_t lldb_private::NativeProcessWindows::GetSharedLibraryInfoAddress ( )
overridevirtual

Implements lldb_private::NativeProcessProtocol.

Definition at line 233 of file NativeProcessWindows.cpp.

◆ GetSoftwareBreakpointPCOffset()

size_t lldb_private::NativeProcessWindows::GetSoftwareBreakpointPCOffset ( )
overrideprotectedvirtual

Return the offset of the PC relative to the software breakpoint that was hit.

If an architecture (e.g. arm) reports breakpoint hits before incrementing the PC, this offset will be 0. If an architecture (e.g. intel) reports breakpoints hits after incrementing the PC, this offset will be the size of the breakpoint opcode.

Reimplemented from lldb_private::NativeProcessProtocol.

Definition at line 309 of file NativeProcessWindows.cpp.

References GetSoftwareBreakpointTrapOpcode().

Referenced by OnDebugException().

◆ GetSoftwareBreakpointTrapOpcode()

llvm::Expected< llvm::ArrayRef< uint8_t > > lldb_private::NativeProcessWindows::GetSoftwareBreakpointTrapOpcode ( size_t  size_hint)
overrideprotectedvirtual

◆ GetThreadByID()

NativeThreadWindows * lldb_private::NativeProcessWindows::GetThreadByID ( lldb::tid_t  thread_id)
protected

◆ Halt()

Status lldb_private::NativeProcessWindows::Halt ( )
overridevirtual

◆ IgnoreSignals()

Status lldb_private::NativeProcessWindows::IgnoreSignals ( llvm::ArrayRef< int >  signals)
overridevirtual

Reimplemented from lldb_private::NativeProcessProtocol.

Definition at line 201 of file NativeProcessWindows.cpp.

◆ Interrupt()

Status lldb_private::NativeProcessWindows::Interrupt ( )
overridevirtual

Tells a process to interrupt all operations as if by a Ctrl-C.

The default implementation will send a local host's equivalent of a SIGSTOP to the process via the NativeProcessProtocol::Signal() operation.

Returns
Returns an error object.

Reimplemented from lldb_private::NativeProcessProtocol.

Definition at line 194 of file NativeProcessWindows.cpp.

References Halt().

◆ IsAlive()

bool lldb_private::NativeProcessWindows::IsAlive ( ) const
overridevirtual

◆ Kill()

Status lldb_private::NativeProcessWindows::Kill ( )
overridevirtual

◆ OnCreateThread()

void lldb_private::NativeProcessWindows::OnCreateThread ( const HostThread thread)
overridevirtual

◆ OnDebugException()

ExceptionResult lldb_private::NativeProcessWindows::OnDebugException ( bool  first_chance,
const ExceptionRecord record 
)
overridevirtual

◆ OnDebuggerConnected()

void lldb_private::NativeProcessWindows::OnDebuggerConnected ( lldb::addr_t  image_base)
overridevirtual

◆ OnExitProcess()

void lldb_private::NativeProcessWindows::OnExitProcess ( uint32_t  exit_code)
overridevirtual

◆ OnExitThread()

void lldb_private::NativeProcessWindows::OnExitThread ( lldb::tid_t  thread_id,
uint32_t  exit_code 
)
overridevirtual

◆ OnLoadDll()

void lldb_private::NativeProcessWindows::OnLoadDll ( const ModuleSpec module_spec,
lldb::addr_t  module_addr 
)
overridevirtual

Reimplemented from lldb_private::ProcessDebugger.

Definition at line 593 of file NativeProcessWindows.cpp.

References m_loaded_modules.

Referenced by lldb_private::NativeDebugDelegate::OnLoadDll().

◆ OnUnloadDll()

void lldb_private::NativeProcessWindows::OnUnloadDll ( lldb::addr_t  module_addr)
overridevirtual

Reimplemented from lldb_private::ProcessDebugger.

Definition at line 600 of file NativeProcessWindows.cpp.

References m_loaded_modules.

Referenced by lldb_private::NativeDebugDelegate::OnUnloadDll().

◆ ReadMemory()

Status lldb_private::NativeProcessWindows::ReadMemory ( lldb::addr_t  addr,
void *  buf,
size_t  size,
size_t &  bytes_read 
)
overridevirtual

◆ RemoveBreakpoint()

Status lldb_private::NativeProcessWindows::RemoveBreakpoint ( lldb::addr_t  addr,
bool  hardware = false 
)
overridevirtual

◆ Resume()

Status lldb_private::NativeProcessWindows::Resume ( const ResumeActionList resume_actions)
overridevirtual

◆ SetArchitecture()

void lldb_private::NativeProcessWindows::SetArchitecture ( const ArchSpec arch_spec)
inline

Definition at line 82 of file NativeProcessWindows.h.

References m_arch.

Referenced by OnDebuggerConnected().

◆ SetBreakpoint()

Status lldb_private::NativeProcessWindows::SetBreakpoint ( lldb::addr_t  addr,
uint32_t  size,
bool  hardware 
)
overridevirtual

◆ SetStopReasonForThread()

void lldb_private::NativeProcessWindows::SetStopReasonForThread ( NativeThreadWindows thread,
lldb::StopReason  reason,
std::string  description = "" 
)
protected

◆ Signal()

Status lldb_private::NativeProcessWindows::Signal ( int  signo)
overridevirtual

Sends a process a UNIX signal signal.

Returns
Returns an error object.

Implements lldb_private::NativeProcessProtocol.

Definition at line 188 of file NativeProcessWindows.cpp.

References error().

◆ StopThread()

void lldb_private::NativeProcessWindows::StopThread ( lldb::tid_t  thread_id,
lldb::StopReason  reason,
std::string  description = "" 
)
protected

◆ UpdateThreads()

size_t lldb_private::NativeProcessWindows::UpdateThreads ( )
overridevirtual

◆ WriteMemory()

Status lldb_private::NativeProcessWindows::WriteMemory ( lldb::addr_t  addr,
const void *  buf,
size_t  size,
size_t &  bytes_written 
)
overridevirtual

Member Data Documentation

◆ m_arch

ArchSpec lldb_private::NativeProcessWindows::m_arch
private

Definition at line 127 of file NativeProcessWindows.h.

Referenced by GetArchitecture(), NativeProcessWindows(), and SetArchitecture().

◆ m_loaded_modules

std::map<lldb_private::FileSpec, lldb::addr_t> lldb_private::NativeProcessWindows::m_loaded_modules
private

The documentation for this class was generated from the following files: