LLDB  mainline
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
lldb_private::process_darwin::NativeProcessDarwin Class Reference

Manages communication with the inferior (debugee) process. More...

#include <NativeProcessDarwin.h>

Inheritance diagram for lldb_private::process_darwin::NativeProcessDarwin:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::process_darwin::NativeProcessDarwin:
Collaboration graph
[legend]

Public Member Functions

 ~NativeProcessDarwin () override
 
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. More...
 
Status Interrupt () override
 Tells a process to interrupt all operations as if by a Ctrl-C. More...
 
Status Kill () 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 ReadMemoryWithoutTrap (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
 
Status AllocateMemory (size_t size, uint32_t permissions, lldb::addr_t &addr) override
 
Status DeallocateMemory (lldb::addr_t addr) override
 
lldb::addr_t GetSharedLibraryInfoAddress () override
 
size_t UpdateThreads () override
 
bool GetArchitecture (ArchSpec &arch) const override
 
Status SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware) override
 
void DoStopIDBumped (uint32_t newBumpId) override
 
Status GetLoadedModuleFileSpec (const char *module_path, FileSpec &file_spec) override
 
Status GetFileLoadAddress (const llvm::StringRef &file_name, lldb::addr_t &load_addr) override
 
NativeThreadDarwinSP GetThreadByID (lldb::tid_t id)
 
task_t GetTask () const
 
bool SupportHardwareSingleStepping () const
 
- Public Member Functions inherited from lldb_private::NativeProcessProtocol
virtual ~NativeProcessProtocol ()
 
virtual Status IgnoreSignals (llvm::ArrayRef< int > signals)
 
Status ReadMemoryWithoutTrap (lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)
 
virtual bool IsAlive () const
 
virtual const ArchSpecGetArchitecture () const =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 llvm::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
 
virtual llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > GetAuxvData () const =0
 
virtual llvm::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 ()
 
NativeThreadProtocolGetCurrentThread ()
 
virtual int GetTerminalFileDescriptor ()
 
uint32_t GetStopID () const
 
bool RegisterNativeDelegate (NativeDelegate &native_delegate)
 Register a native delegate. More...
 
bool UnregisterNativeDelegate (NativeDelegate &native_delegate)
 Unregister a native delegate previously registered. More...
 
virtual lldb::user_id_t StartTrace (const TraceOptions &config, Status &error)
 StartTracing API for starting a tracing instance with the TraceOptions on a specific thread or process. More...
 
virtual Status StopTrace (lldb::user_id_t traceid, lldb::tid_t thread=LLDB_INVALID_THREAD_ID)
 StopTracing API as the name suggests stops a tracing instance. More...
 
virtual Status GetData (lldb::user_id_t traceid, lldb::tid_t thread, llvm::MutableArrayRef< uint8_t > &buffer, size_t offset=0)
 This API provides the trace data collected in the form of raw data. More...
 
virtual Status GetMetaData (lldb::user_id_t traceid, lldb::tid_t thread, llvm::MutableArrayRef< uint8_t > &buffer, size_t offset=0)
 Similar API as above except it aims to provide any extra data useful for decoding the actual trace data. More...
 
virtual Status GetTraceConfig (lldb::user_id_t traceid, TraceOptions &config)
 API to query the TraceOptions for a given user id. More...
 

Static Public Member Functions

static Status PtraceWrapper (int req, lldb::pid_t pid, void *addr=nullptr, void *data=nullptr, size_t data_size=0, long *result=nullptr)
 

Protected Member Functions

Status GetSoftwareBreakpointTrapOpcode (size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) override
 
- Protected Member Functions inherited from lldb_private::NativeProcessProtocol
 NativeProcessProtocol (lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate)
 
void SetState (lldb::StateType state, bool notify_delegates=true)
 
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. More...
 
void FixupBreakpointPCAsNeeded (NativeThreadProtocol &thread)
 
void NotifyDidExec ()
 Notify the delegate that an exec occurred. More...
 
NativeThreadProtocolGetThreadByIDUnlocked (lldb::tid_t tid)
 

Friends

Status NativeProcessProtocol::Launch (ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp)
 
Status NativeProcessProtocol::Attach (lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp)
 

Additional Inherited Members

- 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
 
llvm::Optional< WaitStatusm_exit_status
 
std::recursive_mutex m_delegates_mutex
 
std::vector< NativeDelegate * > m_delegates
 
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
 

Detailed Description

Manages communication with the inferior (debugee) process.

Upon construction, this class prepares and launches an inferior process for debugging.

Changes in the inferior process state are broadcasted.

Definition at line 50 of file NativeProcessDarwin.h.

Constructor & Destructor Documentation

◆ ~NativeProcessDarwin()

NativeProcessDarwin::~NativeProcessDarwin ( )
override

Member Function Documentation

◆ AllocateMemory()

Status NativeProcessDarwin::AllocateMemory ( size_t  size,
uint32_t  permissions,
lldb::addr_t addr 
)
overridevirtual

◆ DeallocateMemory()

Status NativeProcessDarwin::DeallocateMemory ( lldb::addr_t  addr)
overridevirtual

◆ Detach()

Status NativeProcessDarwin::Detach ( )
overridevirtual

Implements lldb_private::NativeProcessProtocol.

Definition at line 1443 of file NativeProcessDarwin.cpp.

References lldb_private::Status::SetErrorString().

Referenced by GetTask().

◆ DoStopIDBumped()

void NativeProcessDarwin::DoStopIDBumped ( uint32_t  newBumpId)
overridevirtual

Reimplemented from lldb_private::NativeProcessProtocol.

Definition at line 1526 of file NativeProcessDarwin.cpp.

◆ GetArchitecture()

bool NativeProcessDarwin::GetArchitecture ( ArchSpec arch) const
override

Definition at line 1515 of file NativeProcessDarwin.cpp.

◆ GetFileLoadAddress()

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

◆ GetLoadedModuleFileSpec()

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

◆ GetMemoryRegionInfo()

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

◆ GetSharedLibraryInfoAddress()

lldb::addr_t NativeProcessDarwin::GetSharedLibraryInfoAddress ( )
overridevirtual

Implements lldb_private::NativeProcessProtocol.

Definition at line 1509 of file NativeProcessDarwin.cpp.

References LLDB_INVALID_ADDRESS.

◆ GetSoftwareBreakpointTrapOpcode()

Status NativeProcessDarwin::GetSoftwareBreakpointTrapOpcode ( size_t  trap_opcode_size_hint,
size_t &  actual_opcode_size,
const uint8_t *&  trap_opcode_bytes 
)
overrideprotected

Definition at line 1543 of file NativeProcessDarwin.cpp.

References lldb_private::Status::SetErrorString().

Referenced by GetTask().

◆ GetTask()

task_t lldb_private::process_darwin::NativeProcessDarwin::GetTask ( ) const
inline

◆ GetThreadByID()

NativeThreadDarwinSP lldb_private::process_darwin::NativeProcessDarwin::GetThreadByID ( lldb::tid_t  id)

◆ Halt()

Status NativeProcessDarwin::Halt ( )
overridevirtual

◆ Interrupt()

Status NativeProcessDarwin::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 1455 of file NativeProcessDarwin.cpp.

References lldb_private::Status::SetErrorString().

◆ Kill()

Status NativeProcessDarwin::Kill ( )
overridevirtual

◆ PtraceWrapper()

static Status lldb_private::process_darwin::NativeProcessDarwin::PtraceWrapper ( int  req,
lldb::pid_t  pid,
void *  addr = nullptr,
void *  data = nullptr,
size_t  data_size = 0,
long *  result = nullptr 
)
static

Referenced by GetTask().

◆ ReadMemory()

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

◆ ReadMemoryWithoutTrap()

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

Definition at line 1481 of file NativeProcessDarwin.cpp.

References lldb_private::Status::SetErrorString().

◆ Resume()

Status NativeProcessDarwin::Resume ( const ResumeActionList resume_actions)
overridevirtual

◆ SetBreakpoint()

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

◆ Signal()

Status NativeProcessDarwin::Signal ( int  signo)
overridevirtual

Sends a process a UNIX signal signal.

Returns
Returns an error object.

Implements lldb_private::NativeProcessProtocol.

Definition at line 1449 of file NativeProcessDarwin.cpp.

References lldb_private::Status::SetErrorString().

◆ SupportHardwareSingleStepping()

bool lldb_private::process_darwin::NativeProcessDarwin::SupportHardwareSingleStepping ( ) const

Referenced by GetTask().

◆ UpdateThreads()

size_t NativeProcessDarwin::UpdateThreads ( )
overridevirtual

Implements lldb_private::NativeProcessProtocol.

Definition at line 1513 of file NativeProcessDarwin.cpp.

◆ WriteMemory()

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

Friends And Related Function Documentation

◆ NativeProcessProtocol::Attach

Status NativeProcessProtocol::Attach ( lldb::pid_t  pid,
NativeProcessProtocol::NativeDelegate native_delegate,
MainLoop mainloop,
NativeProcessProtocolSP &  process_sp 
)
friend

◆ NativeProcessProtocol::Launch

Status NativeProcessProtocol::Launch ( ProcessLaunchInfo launch_info,
NativeDelegate native_delegate,
MainLoop mainloop,
NativeProcessProtocolSP &  process_sp 
)
friend

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