LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
lldb_private::NativeProcessProtocol Class Referenceabstract

#include <NativeProcessProtocol.h>

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

Classes

class  Manager
 
class  NativeDelegate
 
struct  SoftwareBreakpoint
 

Public Types

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
 

Public Member Functions

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).
 

Static Public Member Functions

template<typename I >
static NativeThreadProtocolthread_list_adapter (I &iter)
 

Protected Member Functions

 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 Attributes

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
 

Private Member Functions

void SynchronouslyNotifyProcessStateChanged (lldb::StateType state)
 
llvm::Expected< SoftwareBreakpointEnableSoftwareBreakpoint (lldb::addr_t addr, uint32_t size_hint)
 

Detailed Description

Definition at line 49 of file NativeProcessProtocol.h.

Member Typedef Documentation

◆ thread_collection

Definition at line 53 of file NativeProcessProtocol.h.

◆ ThreadIterable

Definition at line 61 of file NativeProcessProtocol.h.

Member Enumeration Documentation

◆ Extension

Extension flag constants, returned by Manager::GetSupportedExtensions() and passed to SetEnabledExtension()

Enumerator
multiprocess 
fork 
vfork 
pass_signals 
auxv 
libraries_svr4 
memory_tagging 
savecore 
siginfo_read 

Definition at line 261 of file NativeProcessProtocol.h.

Constructor & Destructor Documentation

◆ ~NativeProcessProtocol()

virtual lldb_private::NativeProcessProtocol::~NativeProcessProtocol ( )
virtualdefault

◆ NativeProcessProtocol()

NativeProcessProtocol::NativeProcessProtocol ( lldb::pid_t  pid,
int  terminal_fd,
NativeDelegate delegate 
)
protected

Member Function Documentation

◆ AllocateMemory()

virtual llvm::Expected< lldb::addr_t > lldb_private::NativeProcessProtocol::AllocateMemory ( size_t  size,
uint32_t  permissions 
)
inlinevirtual

◆ CanResume()

bool lldb_private::NativeProcessProtocol::CanResume ( ) const
inline

◆ DeallocateMemory()

virtual llvm::Error lldb_private::NativeProcessProtocol::DeallocateMemory ( lldb::addr_t  addr)
inlinevirtual

◆ Detach()

virtual Status lldb_private::NativeProcessProtocol::Detach ( )
pure virtual

◆ DoStopIDBumped()

void NativeProcessProtocol::DoStopIDBumped ( uint32_t  newBumpId)
protectedvirtual

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 762 of file NativeProcessProtocol.cpp.

Referenced by SetState().

◆ EnableSoftwareBreakpoint()

llvm::Expected< NativeProcessProtocol::SoftwareBreakpoint > NativeProcessProtocol::EnableSoftwareBreakpoint ( lldb::addr_t  addr,
uint32_t  size_hint 
)
private

◆ FixupBreakpointPCAsNeeded()

void NativeProcessProtocol::FixupBreakpointPCAsNeeded ( NativeThreadProtocol thread)
protected

◆ GetAddressByteSize()

uint32_t lldb_private::NativeProcessProtocol::GetAddressByteSize ( ) const
inline

◆ GetArchitecture()

virtual const ArchSpec & lldb_private::NativeProcessProtocol::GetArchitecture ( ) const
pure virtual

◆ GetAuxvData()

virtual llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > lldb_private::NativeProcessProtocol::GetAuxvData ( ) const
pure virtual

◆ GetByteOrder()

lldb::ByteOrder lldb_private::NativeProcessProtocol::GetByteOrder ( ) const
inline

◆ GetCurrentThread()

NativeThreadProtocol * lldb_private::NativeProcessProtocol::GetCurrentThread ( )
inline

◆ GetCurrentThreadID()

lldb::tid_t lldb_private::NativeProcessProtocol::GetCurrentThreadID ( ) const
inline

◆ GetExitStatus()

std::optional< WaitStatus > NativeProcessProtocol::GetExitStatus ( )
virtual

◆ GetFileLoadAddress()

virtual Status lldb_private::NativeProcessProtocol::GetFileLoadAddress ( const llvm::StringRef &  file_name,
lldb::addr_t load_addr 
)
pure virtual

◆ GetHardwareBreakpointMap()

const HardwareBreakpointMap & NativeProcessProtocol::GetHardwareBreakpointMap ( ) const
virtual

◆ GetHardwareDebugSupportInfo()

std::optional< std::pair< uint32_t, uint32_t > > NativeProcessProtocol::GetHardwareDebugSupportInfo ( ) const
virtual

◆ GetID()

lldb::pid_t lldb_private::NativeProcessProtocol::GetID ( ) const
inline

Definition at line 184 of file NativeProcessProtocol.h.

References m_pid.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::AddProcessThreads(), lldb_private::process_freebsd::NativeProcessFreeBSD::AddThread(), lldb_private::process_netbsd::NativeProcessNetBSD::AddThread(), lldb_private::process_linux::NativeProcessLinux::AddThread(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::AttachToProcess(), lldb_private::NativeProcessWindows::CacheLoadedModules(), lldb_private::process_freebsd::NativeProcessFreeBSD::Detach(), lldb_private::process_linux::NativeProcessLinux::Detach(), lldb_private::process_netbsd::NativeProcessNetBSD::Detach(), lldb_private::NativeProcessWindows::Detach(), FixupBreakpointPCAsNeeded(), lldb_private::process_freebsd::NativeProcessFreeBSD::GetAuxvData(), lldb_private::process_linux::NativeProcessLinux::GetAuxvData(), lldb_private::process_netbsd::NativeProcessNetBSD::GetAuxvData(), lldb_private::NativeProcessWindows::GetFileLoadAddress(), GetJSONThreadsInfo(), lldb_private::process_linux::NativeProcessLinux::GetLoadedModuleFileSpec(), lldb_private::NativeProcessWindows::GetLoadedModuleFileSpec(), lldb_private::process_freebsd::NativeThreadFreeBSD::GetName(), lldb_private::process_linux::NativeThreadLinux::GetName(), lldb_private::process_netbsd::NativeThreadNetBSD::GetName(), lldb_private::NativeThreadWindows::GetName(), lldb_private::process_freebsd::NativeRegisterContextFreeBSD::GetProcessPid(), lldb_private::process_netbsd::NativeRegisterContextNetBSD::GetProcessPid(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::GetThreadFromSuffix(), lldb_private::process_freebsd::NativeProcessFreeBSD::Halt(), lldb_private::process_linux::NativeProcessLinux::Halt(), lldb_private::process_netbsd::NativeProcessNetBSD::Halt(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle__M(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle__m(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_C(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_H(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_I(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_interrupt(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceGetBinaryData(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceGetState(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceStart(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceStop(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jThreadsInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_M(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_memory_read(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qC(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qFileLoadAddress(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfoSupported(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qMemTags(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_QMemTags(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qProcessInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qRegisterInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_QRestoreRegisterState(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qSaveCore(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_QSaveRegisterState(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qThreadStopInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qWatchpointSupportInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_s(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_T(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_vCont(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_Z(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_z(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::HandleInferiorState_Exited(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::HandleInferiorState_Stopped(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::InitializeDelegate(), lldb_private::process_linux::NativeProcessLinux::Interrupt(), lldb_private::process_netbsd::NativeProcessNetBSD::Interrupt(), lldb_private::process_freebsd::NativeProcessFreeBSD::Kill(), lldb_private::process_linux::NativeProcessLinux::Kill(), lldb_private::process_netbsd::NativeProcessNetBSD::Kill(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::LaunchProcess(), lldb_private::process_linux::NativeThreadLinux::MaybeLogStateChange(), lldb_private::process_linux::NativeProcessLinux::MonitorCallback(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorClone(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorClone(), lldb_private::process_linux::NativeProcessLinux::MonitorClone(), lldb_private::process_linux::NativeProcessLinux::MonitorSignal(), lldb_private::process_linux::NativeProcessLinux::MonitorSIGTRAP(), NotifyDidExec(), lldb_private::NativeProcessWindows::OnDebuggerConnected(), lldb_private::NativeProcessWindows::OnExitProcess(), lldb_private::process_freebsd::NativeProcessFreeBSD::PopulateMemoryRegionCache(), lldb_private::process_linux::NativeProcessLinux::PopulateMemoryRegionCache(), lldb_private::process_netbsd::NativeProcessNetBSD::PopulateMemoryRegionCache(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::PrepareStopReplyPacketForThread(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::ProcessStateChanged(), lldb_private::process_freebsd::NativeProcessFreeBSD::ReadMemory(), lldb_private::process_netbsd::NativeProcessNetBSD::ReadMemory(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::ReadXferObject(), lldb_private::process_freebsd::NativeProcessFreeBSD::ReinitializeThreads(), lldb_private::process_netbsd::NativeProcessNetBSD::ReinitializeThreads(), lldb_private::process_freebsd::NativeProcessFreeBSD::RemoveThread(), lldb_private::process_netbsd::NativeProcessNetBSD::RemoveThread(), lldb_private::process_linux::NativeThreadLinux::RequestStop(), lldb_private::process_netbsd::NativeThreadNetBSD::Resume(), lldb_private::process_freebsd::NativeProcessFreeBSD::Resume(), lldb_private::process_linux::NativeProcessLinux::Resume(), lldb_private::process_netbsd::NativeProcessNetBSD::Resume(), lldb_private::NativeProcessWindows::Resume(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::ResumeProcess(), lldb_private::process_freebsd::NativeProcessFreeBSD::SaveCore(), lldb_private::process_netbsd::NativeProcessNetBSD::SaveCore(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SendStopReasonForState(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SendWResponse(), SetHardwareBreakpoint(), lldb_private::process_freebsd::NativeProcessFreeBSD::SetupTrace(), lldb_private::process_netbsd::NativeProcessNetBSD::SetupTrace(), SetWatchpoint(), lldb_private::process_freebsd::NativeProcessFreeBSD::SigchldHandler(), lldb_private::process_netbsd::NativeProcessNetBSD::SigchldHandler(), lldb_private::process_freebsd::NativeProcessFreeBSD::Signal(), lldb_private::process_linux::NativeProcessLinux::Signal(), lldb_private::process_netbsd::NativeProcessNetBSD::Signal(), lldb_private::process_netbsd::NativeThreadNetBSD::SingleStep(), lldb_private::process_netbsd::NativeThreadNetBSD::Suspend(), SynchronouslyNotifyProcessStateChanged(), lldb_private::process_linux::IntelPTCollector::TraceStart(), lldb_private::process_linux::NativeProcessLinux::TryHandleWaitStatus(), lldb_private::process_freebsd::NativeProcessFreeBSD::WriteMemory(), and lldb_private::process_netbsd::NativeProcessNetBSD::WriteMemory().

◆ GetLoadedModuleFileSpec()

virtual Status lldb_private::NativeProcessProtocol::GetLoadedModuleFileSpec ( const char *  module_path,
FileSpec file_spec 
)
pure virtual

◆ GetLoadedSVR4Libraries()

virtual llvm::Expected< std::vector< SVR4LibraryInfo > > lldb_private::NativeProcessProtocol::GetLoadedSVR4Libraries ( )
inlinevirtual

◆ GetMemoryRegionInfo()

lldb_private::Status NativeProcessProtocol::GetMemoryRegionInfo ( lldb::addr_t  load_addr,
MemoryRegionInfo range_info 
)
virtual

◆ GetSharedLibraryInfoAddress()

virtual lldb::addr_t lldb_private::NativeProcessProtocol::GetSharedLibraryInfoAddress ( )
pure virtual

◆ GetSoftwareBreakpointPCOffset()

size_t NativeProcessProtocol::GetSoftwareBreakpointPCOffset ( )
protectedvirtual

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 in lldb_private::NativeProcessWindows.

Definition at line 561 of file NativeProcessProtocol.cpp.

References GetArchitecture(), and GetSoftwareBreakpointTrapOpcode().

Referenced by FixupBreakpointPCAsNeeded().

◆ GetSoftwareBreakpointTrapOpcode()

llvm::Expected< llvm::ArrayRef< uint8_t > > NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode ( size_t  size_hint)
protectedvirtual

◆ GetState()

lldb::StateType NativeProcessProtocol::GetState ( ) const

◆ GetStopID()

uint32_t NativeProcessProtocol::GetStopID ( ) const

Definition at line 757 of file NativeProcessProtocol.cpp.

References m_state_mutex, and m_stop_id.

◆ GetTerminalFileDescriptor()

virtual int lldb_private::NativeProcessProtocol::GetTerminalFileDescriptor ( )
inlinevirtual

Definition at line 230 of file NativeProcessProtocol.h.

References m_terminal_fd.

◆ GetThreadAtIndex()

NativeThreadProtocol * NativeProcessProtocol::GetThreadAtIndex ( uint32_t  idx)

◆ GetThreadByID()

NativeThreadProtocol * NativeProcessProtocol::GetThreadByID ( lldb::tid_t  tid)

◆ GetThreadByIDUnlocked()

NativeThreadProtocol * NativeProcessProtocol::GetThreadByIDUnlocked ( lldb::tid_t  tid)
protected

Definition at line 108 of file NativeProcessProtocol.cpp.

References m_threads.

Referenced by GetThreadByID().

◆ GetWatchpointMap()

const NativeWatchpointList::WatchpointMap & NativeProcessProtocol::GetWatchpointMap ( ) const
virtual

◆ Halt()

virtual Status lldb_private::NativeProcessProtocol::Halt ( )
pure virtual

◆ IgnoreSignals()

Status NativeProcessProtocol::IgnoreSignals ( llvm::ArrayRef< int >  signals)
virtual

◆ Interrupt()

lldb_private::Status NativeProcessProtocol::Interrupt ( )
virtual

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 in lldb_private::process_freebsd::NativeProcessFreeBSD, lldb_private::process_linux::NativeProcessLinux, lldb_private::process_netbsd::NativeProcessNetBSD, and lldb_private::NativeProcessWindows.

Definition at line 34 of file NativeProcessProtocol.cpp.

References error(), Signal(), and SIGSTOP.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_interrupt().

◆ IsAlive()

bool NativeProcessProtocol::IsAlive ( ) const
virtual

◆ IsRunning()

bool lldb_private::NativeProcessProtocol::IsRunning ( ) const
inline

Definition at line 188 of file NativeProcessProtocol.h.

References lldb::eStateRunning, IsStepping(), and m_state.

◆ IsStepping()

bool lldb_private::NativeProcessProtocol::IsStepping ( ) const
inline

Definition at line 192 of file NativeProcessProtocol.h.

References lldb::eStateStepping, and m_state.

Referenced by IsRunning().

◆ Kill()

virtual Status lldb_private::NativeProcessProtocol::Kill ( )
pure virtual

◆ NotifyDidExec()

void NativeProcessProtocol::NotifyDidExec ( )
protectedvirtual

Notify the delegate that an exec occurred.

Provide a mechanism for a delegate to clear out any exec- sensitive data.

Reimplemented in lldb_private::NativeProcessELF.

Definition at line 331 of file NativeProcessProtocol.cpp.

References lldb_private::NativeProcessProtocol::NativeDelegate::DidExec(), GetID(), lldb_private::GetLog(), LLDB_LOG, m_delegate, m_software_breakpoints, and lldb_private::Process.

Referenced by lldb_private::NativeProcessELF::NotifyDidExec().

◆ NotifyTracersProcessDidStop()

virtual void lldb_private::NativeProcessProtocol::NotifyTracersProcessDidStop ( )
inlinevirtual

Notify tracers that the target process just stopped.

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 340 of file NativeProcessProtocol.h.

Referenced by SynchronouslyNotifyProcessStateChanged().

◆ NotifyTracersProcessWillResume()

virtual void lldb_private::NativeProcessProtocol::NotifyTracersProcessWillResume ( )
inlinevirtual

Notify tracers that the target process will resume.

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 337 of file NativeProcessProtocol.h.

◆ ReadCStringFromMemory()

llvm::Expected< llvm::StringRef > NativeProcessProtocol::ReadCStringFromMemory ( lldb::addr_t  addr,
char *  buffer,
size_t  max_size,
size_t &  total_bytes_read 
)

Reads a null terminated string from memory.

Reads up to max_size bytes of memory until it finds a '\0'. If a '\0' is not found then it reads max_size-1 bytes as a string and a '\0' is added as the last character of the buffer.

Parameters
[in]addrThe address in memory to read from.
[in]bufferAn allocated buffer with at least max_size size.
[in]max_sizeThe maximum number of bytes to read from memory until it reads the string.
[out]total_bytes_readThe number of bytes read from memory into buffer.
Returns
Returns a StringRef backed up by the buffer passed in.

Definition at line 677 of file NativeProcessProtocol.cpp.

References lldb_private::Status::Clear(), ReadMemory(), lldb_private::Status::Success(), and lldb_private::Status::ToError().

Referenced by lldb_private::NativeProcessELF::ReadSVR4LibraryInfo().

◆ ReadMemory()

virtual Status lldb_private::NativeProcessProtocol::ReadMemory ( lldb::addr_t  addr,
void *  buf,
size_t  size,
size_t &  bytes_read 
)
pure virtual

◆ ReadMemoryTags()

lldb_private::Status NativeProcessProtocol::ReadMemoryTags ( int32_t  type,
lldb::addr_t  addr,
size_t  len,
std::vector< uint8_t > &  tags 
)
virtual

◆ ReadMemoryWithoutTrap()

Status NativeProcessProtocol::ReadMemoryWithoutTrap ( lldb::addr_t  addr,
void *  buf,
size_t  size,
size_t &  bytes_read 
)

◆ RemoveBreakpoint()

Status NativeProcessProtocol::RemoveBreakpoint ( lldb::addr_t  addr,
bool  hardware = false 
)
virtual

◆ RemoveHardwareBreakpoint()

Status NativeProcessProtocol::RemoveHardwareBreakpoint ( lldb::addr_t  addr)
virtual

◆ RemoveSoftwareBreakpoint()

Status NativeProcessProtocol::RemoveSoftwareBreakpoint ( lldb::addr_t  addr)
protected

◆ RemoveWatchpoint()

Status NativeProcessProtocol::RemoveWatchpoint ( lldb::addr_t  addr)
virtual

◆ Resume()

virtual Status lldb_private::NativeProcessProtocol::Resume ( const ResumeActionList resume_actions)
pure virtual

◆ SaveCore()

virtual llvm::Expected< std::string > lldb_private::NativeProcessProtocol::SaveCore ( llvm::StringRef  path_hint)
inlinevirtual

Write a core dump (without crashing the program).

Parameters
[in]path_hintSuggested core dump path (optional, can be empty).
Returns
Path to the core dump if successfully written, an error otherwise.

Reimplemented in lldb_private::process_freebsd::NativeProcessFreeBSD, and lldb_private::process_netbsd::NativeProcessNetBSD.

Definition at line 411 of file NativeProcessProtocol.h.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_qSaveCore().

◆ SetBreakpoint()

virtual Status lldb_private::NativeProcessProtocol::SetBreakpoint ( lldb::addr_t  addr,
uint32_t  size,
bool  hardware 
)
pure virtual

◆ SetCurrentThreadID()

void lldb_private::NativeProcessProtocol::SetCurrentThreadID ( lldb::tid_t  tid)
inline

◆ SetEnabledExtensions()

virtual void lldb_private::NativeProcessProtocol::SetEnabledExtensions ( Extension  flags)
inlinevirtual

Method called in order to propagate the bitmap of protocol extensions supported by the client.

Parameters
[in]flagsThe bitmap of enabled extensions.

Definition at line 399 of file NativeProcessProtocol.h.

References m_enabled_extensions.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::SetEnabledExtensions().

◆ SetExitStatus()

bool NativeProcessProtocol::SetExitStatus ( WaitStatus  status,
bool  bNotifyStateChange 
)
virtual

◆ SetHardwareBreakpoint()

Status NativeProcessProtocol::SetHardwareBreakpoint ( lldb::addr_t  addr,
size_t  size 
)
virtual

◆ SetID()

void lldb_private::NativeProcessProtocol::SetID ( lldb::pid_t  pid)
inlineprotected

◆ SetSoftwareBreakpoint()

Status NativeProcessProtocol::SetSoftwareBreakpoint ( lldb::addr_t  addr,
uint32_t  size_hint 
)
protected

◆ SetState()

void NativeProcessProtocol::SetState ( lldb::StateType  state,
bool  notify_delegates = true 
)
protected

Definition at line 733 of file NativeProcessProtocol.cpp.

References DoStopIDBumped(), m_state, m_state_mutex, m_stop_id, lldb_private::StateIsStoppedState(), and SynchronouslyNotifyProcessStateChanged().

Referenced by lldb_private::process_freebsd::NativeProcessFreeBSD::Attach(), lldb_private::process_netbsd::NativeProcessNetBSD::Attach(), lldb_private::NativeProcessWindows::Detach(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorClone(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorClone(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorExited(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorExited(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorSignal(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorSignal(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorSIGSTOP(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorSIGSTOP(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorSIGTRAP(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorSIGTRAP(), lldb_private::process_linux::NativeProcessLinux::NativeProcessLinux(), lldb_private::NativeProcessWindows::OnDebugException(), lldb_private::NativeProcessWindows::OnExitProcess(), lldb_private::process_freebsd::NativeProcessFreeBSD::Resume(), lldb_private::process_netbsd::NativeProcessNetBSD::Resume(), lldb_private::NativeProcessWindows::Resume(), lldb_private::process_linux::NativeProcessLinux::ResumeThread(), and lldb_private::process_linux::NativeProcessLinux::SignalIfAllThreadsStopped().

◆ SetWatchpoint()

Status NativeProcessProtocol::SetWatchpoint ( lldb::addr_t  addr,
size_t  size,
uint32_t  watch_flags,
bool  hardware 
)
virtual

◆ Signal()

virtual Status lldb_private::NativeProcessProtocol::Signal ( int  signo)
pure virtual

◆ SynchronouslyNotifyProcessStateChanged()

void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged ( lldb::StateType  state)
private

◆ thread_list_adapter()

template<typename I >
static NativeThreadProtocol & lldb_private::NativeProcessProtocol::thread_list_adapter ( I &  iter)
inlinestatic

Definition at line 55 of file NativeProcessProtocol.h.

◆ Threads()

ThreadIterable lldb_private::NativeProcessProtocol::Threads ( ) const
inline

◆ TraceGetBinaryData()

virtual llvm::Expected< std::vector< uint8_t > > lldb_private::NativeProcessProtocol::TraceGetBinaryData ( const TraceGetBinaryDataRequest request)
inlinevirtual

Get binary data given a trace technology and a data identifier.

Parameters
[in]requestObject with the params of the requested data.
Returns
A vector of bytes with the requested data, or an llvm::Error in case of failures.

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 382 of file NativeProcessProtocol.h.

References lldb_private::TraceGetBinaryDataRequest::kind, and lldb_private::TraceGetBinaryDataRequest::type.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceGetBinaryData(), and lldb_private::process_linux::NativeProcessLinux::TraceGetBinaryData().

◆ TraceGetState()

virtual llvm::Expected< llvm::json::Value > lldb_private::NativeProcessProtocol::TraceGetState ( llvm::StringRef  type)
inlinevirtual

Get the current tracing state of the process and its threads.

Parameters
[in]typeTracing technology type to consider.
Returns
A JSON object string with custom data depending on the trace technology, or an llvm::Error in case of errors.

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 374 of file NativeProcessProtocol.h.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceGetState(), and lldb_private::process_linux::NativeProcessLinux::TraceGetState().

◆ TraceStart()

virtual llvm::Error lldb_private::NativeProcessProtocol::TraceStart ( llvm::StringRef  json_params,
llvm::StringRef  type 
)
inlinevirtual

Start tracing a process or its threads.

Parameters
[in]json_paramsJSON object with the information of what and how to trace. In the case of gdb-remote, this object should conform to the jLLDBTraceStart packet.

This object should have a string entry called "type", which is the tracing technology name.

Parameters
[in]typeTracing technology type, as described in the json_params.
Returns
llvm::Error::success if the operation was successful, or an llvm::Error otherwise.

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 358 of file NativeProcessProtocol.h.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceStart(), and lldb_private::process_linux::NativeProcessLinux::TraceStart().

◆ TraceStop()

virtual llvm::Error lldb_private::NativeProcessProtocol::TraceStop ( const TraceStopRequest request)
inlinevirtual

Stop tracing a live process or its threads.

Parameters
[in]requestThe information determining which threads or process to stop tracing.
Returns
llvm::Error::success if the operation was successful, or llvm::Error otherwise.

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 366 of file NativeProcessProtocol.h.

References lldb_private::TraceStopRequest::type.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceStop(), and lldb_private::process_linux::NativeProcessLinux::TraceStop().

◆ TraceSupported()

virtual llvm::Expected< TraceSupportedResponse > lldb_private::NativeProcessProtocol::TraceSupported ( )
inlinevirtual

Get the processor tracing type supported for this process.

Responses might be different depending on the architecture and capabilities of the underlying OS.

Returns
The supported trace type or an llvm::Error if tracing is not supported for the inferior.

Reimplemented in lldb_private::process_linux::NativeProcessLinux.

Definition at line 390 of file NativeProcessProtocol.h.

Referenced by lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceSupported(), and lldb_private::process_linux::NativeProcessLinux::TraceSupported().

◆ UpdateThreads()

virtual size_t lldb_private::NativeProcessProtocol::UpdateThreads ( )
pure virtual

◆ WriteMemory()

virtual Status lldb_private::NativeProcessProtocol::WriteMemory ( lldb::addr_t  addr,
const void *  buf,
size_t  size,
size_t &  bytes_written 
)
pure virtual

◆ WriteMemoryTags()

lldb_private::Status NativeProcessProtocol::WriteMemoryTags ( int32_t  type,
lldb::addr_t  addr,
size_t  len,
const std::vector< uint8_t > &  tags 
)
virtual

Member Data Documentation

◆ m_current_thread_id

lldb::tid_t lldb_private::NativeProcessProtocol::m_current_thread_id = LLDB_INVALID_THREAD_ID
protected

◆ m_delegate

NativeDelegate& lldb_private::NativeProcessProtocol::m_delegate
protected

◆ m_enabled_extensions

Extension lldb_private::NativeProcessProtocol::m_enabled_extensions
protected

◆ m_exit_status

std::optional<WaitStatus> lldb_private::NativeProcessProtocol::m_exit_status
protected

Definition at line 433 of file NativeProcessProtocol.h.

Referenced by GetExitStatus(), and SetExitStatus().

◆ m_hw_breakpoints_map

HardwareBreakpointMap lldb_private::NativeProcessProtocol::m_hw_breakpoints_map
protected

◆ m_pid

lldb::pid_t lldb_private::NativeProcessProtocol::m_pid
protected

◆ m_signals_to_ignore

llvm::DenseSet<int> lldb_private::NativeProcessProtocol::m_signals_to_ignore
protected

◆ m_software_breakpoints

std::unordered_map<lldb::addr_t, SoftwareBreakpoint> lldb_private::NativeProcessProtocol::m_software_breakpoints
protected

◆ m_state

lldb::StateType lldb_private::NativeProcessProtocol::m_state = lldb::eStateInvalid
protected

◆ m_state_mutex

std::recursive_mutex lldb_private::NativeProcessProtocol::m_state_mutex
mutableprotected

Definition at line 431 of file NativeProcessProtocol.h.

Referenced by GetState(), GetStopID(), and SetState().

◆ m_stop_id

uint32_t lldb_private::NativeProcessProtocol::m_stop_id = 0
protected

Definition at line 439 of file NativeProcessProtocol.h.

Referenced by GetStopID(), and SetState().

◆ m_terminal_fd

int lldb_private::NativeProcessProtocol::m_terminal_fd
protected

◆ m_threads

std::vector<std::unique_ptr<NativeThreadProtocol> > lldb_private::NativeProcessProtocol::m_threads
protected

Definition at line 426 of file NativeProcessProtocol.h.

Referenced by lldb_private::process_freebsd::NativeProcessFreeBSD::AddThread(), lldb_private::process_netbsd::NativeProcessNetBSD::AddThread(), lldb_private::process_linux::NativeProcessLinux::AddThread(), lldb_private::process_freebsd::NativeProcessFreeBSD::Attach(), lldb_private::process_netbsd::NativeProcessNetBSD::Attach(), lldb_private::process_linux::NativeProcessLinux::Detach(), GetThreadAtIndex(), GetThreadByIDUnlocked(), lldb_private::process_freebsd::NativeProcessFreeBSD::HasThreadNoLock(), lldb_private::process_linux::NativeProcessLinux::HasThreadNoLock(), lldb_private::process_netbsd::NativeProcessNetBSD::HasThreadNoLock(), lldb_private::process_linux::NativeProcessLinux::Interrupt(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorExited(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorExited(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorSignal(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorSignal(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorSIGSTOP(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorSIGSTOP(), lldb_private::process_linux::NativeProcessLinux::MonitorSIGTRAP(), lldb_private::process_freebsd::NativeProcessFreeBSD::MonitorSIGTRAP(), lldb_private::process_netbsd::NativeProcessNetBSD::MonitorSIGTRAP(), lldb_private::NativeProcessWindows::OnCreateThread(), lldb_private::NativeProcessWindows::OnDebuggerConnected(), lldb_private::NativeProcessWindows::OnExitThread(), lldb_private::process_freebsd::NativeProcessFreeBSD::ReinitializeThreads(), lldb_private::process_netbsd::NativeProcessNetBSD::ReinitializeThreads(), RemoveHardwareBreakpoint(), lldb_private::process_freebsd::NativeProcessFreeBSD::RemoveThread(), lldb_private::process_netbsd::NativeProcessNetBSD::RemoveThread(), RemoveWatchpoint(), lldb_private::process_freebsd::NativeProcessFreeBSD::Resume(), lldb_private::process_linux::NativeProcessLinux::Resume(), lldb_private::process_netbsd::NativeProcessNetBSD::Resume(), lldb_private::NativeProcessWindows::Resume(), SetHardwareBreakpoint(), SetWatchpoint(), lldb_private::process_linux::NativeProcessLinux::SignalIfAllThreadsStopped(), lldb_private::process_linux::NativeProcessLinux::StopRunningThreads(), lldb_private::NativeProcessWindows::StopThread(), lldb_private::process_linux::NativeProcessLinux::StopTrackingThread(), Threads(), lldb_private::process_freebsd::NativeProcessFreeBSD::UpdateThreads(), lldb_private::process_linux::NativeProcessLinux::UpdateThreads(), lldb_private::process_netbsd::NativeProcessNetBSD::UpdateThreads(), and lldb_private::NativeProcessWindows::UpdateThreads().

◆ m_threads_mutex

std::recursive_mutex lldb_private::NativeProcessProtocol::m_threads_mutex
mutableprotected

◆ m_watchpoint_list

NativeWatchpointList lldb_private::NativeProcessProtocol::m_watchpoint_list
protected

Definition at line 436 of file NativeProcessProtocol.h.

Referenced by GetWatchpointMap(), RemoveWatchpoint(), and SetWatchpoint().


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