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

#include <NativeProcessFreeBSD.h>

Inheritance diagram for lldb_private::process_freebsd::NativeProcessFreeBSD:
Inheritance graph
Collaboration diagram for lldb_private::process_freebsd::NativeProcessFreeBSD:
Collaboration graph


class  Factory

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. 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 WriteMemory (lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) override
size_t UpdateThreads () override
const ArchSpecGetArchitecture () const override
Status SetBreakpoint (lldb::addr_t addr, uint32_t size, bool hardware) override
Status GetLoadedModuleFileSpec (const char *module_path, FileSpec &file_spec) override
Status GetFileLoadAddress (const llvm::StringRef &file_name, lldb::addr_t &load_addr) override
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > GetAuxvData () const override
bool SupportHardwareSingleStepping () const
llvm::Expected< std::stringSaveCore (llvm::StringRef path_hint) override
 Write a core dump (without crashing the program). More...
- Public Member Functions inherited from lldb_private::NativeProcessELF
llvm::Optional< uint64_t > GetAuxValue (enum AuxVector::EntryType type)
- Public Member Functions inherited from lldb_private::NativeProcessProtocol
virtual ~NativeProcessProtocol ()=default
virtual Status IgnoreSignals (llvm::ArrayRef< int > signals)
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. More...
virtual llvm::Expected< lldb::addr_tAllocateMemory (size_t size, uint32_t permissions)
virtual llvm::Error DeallocateMemory (lldb::addr_t addr)
virtual bool IsAlive () const
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
uint32_t GetAddressByteSize () const
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
virtual llvm::Error TraceStart (llvm::StringRef json_params, llvm::StringRef type)
 Start tracing a process or its threads. More...
virtual llvm::Error TraceStop (const TraceStopRequest &request)
 Stop tracing a live process or its threads. More...
virtual llvm::Expected< llvm::json::Value > TraceGetState (llvm::StringRef type)
 Get the current tracing state of the process and its threads. More...
virtual llvm::Expected< std::vector< uint8_t > > TraceGetBinaryData (const TraceGetBinaryDataRequest &request)
 Get binary data given a trace technology and a data identifier. More...
virtual llvm::Expected< TraceSupportedResponseTraceSupported ()
 Get the processor tracing type supported for this process. More...
virtual void SetEnabledExtensions (Extension flags)
 Method called in order to propagate the bitmap of protocol extensions supported by the client. More...

Static Public Member Functions

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

Protected Member Functions

llvm::Expected< llvm::ArrayRef< uint8_t > > GetSoftwareBreakpointTrapOpcode (size_t size_hint) override
- Protected Member Functions inherited from lldb_private::NativeProcessELF
lldb::addr_t GetSharedLibraryInfoAddress () override
template<typename ELF_EHDR , typename ELF_PHDR , typename ELF_DYN >
lldb::addr_t GetELFImageInfoAddress ()
llvm::Expected< std::vector< SVR4LibraryInfo > > GetLoadedSVR4Libraries () override
template<typename T >
llvm::Expected< SVR4LibraryInfoReadSVR4LibraryInfo (lldb::addr_t link_map_addr)
- 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 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)

Private Member Functions

 NativeProcessFreeBSD (::pid_t pid, int terminal_fd, NativeDelegate &delegate, const ArchSpec &arch, MainLoop &mainloop)
bool HasThreadNoLock (lldb::tid_t thread_id)
NativeThreadFreeBSDAddThread (lldb::tid_t thread_id)
void RemoveThread (lldb::tid_t thread_id)
void MonitorCallback (lldb::pid_t pid, int signal)
void MonitorExited (lldb::pid_t pid, WaitStatus status)
void MonitorSIGSTOP (lldb::pid_t pid)
void MonitorSIGTRAP (lldb::pid_t pid)
void MonitorSignal (lldb::pid_t pid, int signal)
void MonitorClone (::pid_t child_pid, bool is_vfork, NativeThreadFreeBSD &parent_thread)
Status PopulateMemoryRegionCache ()
void SigchldHandler ()
Status Attach ()
Status SetupTrace ()
Status ReinitializeThreads ()
- Private Member Functions inherited from lldb_private::NativeProcessSoftwareSingleStep
Status SetupSoftwareSingleStepping (NativeThreadProtocol &thread)

Private Attributes

MainLoop::SignalHandleUP m_sigchld_handle
ArchSpec m_arch
LazyBool m_supports_mem_region = eLazyBoolCalculate
std::vector< std::pair< MemoryRegionInfo, FileSpec > > m_mem_region_cache
- Private Attributes inherited from lldb_private::NativeProcessSoftwareSingleStep
std::map< lldb::tid_t, lldb::addr_tm_threads_stepping_with_breakpoint

Additional Inherited Members

- Public Types inherited from lldb_private::NativeProcessProtocol
enum  Extension {
  Extension::multiprocess = (1u << 0), Extension::fork = (1u << 1), Extension::vfork = (1u << 2), Extension::pass_signals = (1u << 3),
  Extension::auxv = (1u << 4), Extension::libraries_svr4 = (1u << 5), Extension::memory_tagging = (1u << 6), Extension::savecore = (1u << 7)
 Extension flag constants, returned by Factory::GetSupportedExtensions() and passed to SetEnabledExtension() More...
- Protected Attributes inherited from lldb_private::NativeProcessELF
std::unique_ptr< AuxVectorm_aux_vector
llvm::Optional< lldb::addr_tm_shared_library_info_addr
- 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
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

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 30 of file NativeProcessFreeBSD.h.

Constructor & Destructor Documentation

◆ NativeProcessFreeBSD()

NativeProcessFreeBSD::NativeProcessFreeBSD ( ::pid_t  pid,
int  terminal_fd,
NativeDelegate delegate,
const ArchSpec arch,
MainLoop mainloop 

Member Function Documentation

◆ AddThread()

NativeThreadFreeBSD & NativeProcessFreeBSD::AddThread ( lldb::tid_t  thread_id)

◆ Attach()

Status NativeProcessFreeBSD::Attach ( )

◆ Detach()

Status NativeProcessFreeBSD::Detach ( )

◆ GetArchitecture()

const ArchSpec& lldb_private::process_freebsd::NativeProcessFreeBSD::GetArchitecture ( ) const

Implements lldb_private::NativeProcessProtocol.

Definition at line 70 of file NativeProcessFreeBSD.h.

References m_arch.

Referenced by GetSoftwareBreakpointTrapOpcode().

◆ GetAuxvData()

llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > NativeProcessFreeBSD::GetAuxvData ( ) const

◆ GetFileLoadAddress()

Status NativeProcessFreeBSD::GetFileLoadAddress ( const llvm::StringRef &  file_name,
lldb::addr_t load_addr 

◆ GetLoadedModuleFileSpec()

Status NativeProcessFreeBSD::GetLoadedModuleFileSpec ( const char *  module_path,
FileSpec file_spec 

◆ GetMemoryRegionInfo()

Status NativeProcessFreeBSD::GetMemoryRegionInfo ( lldb::addr_t  load_addr,
MemoryRegionInfo range_info 

◆ GetSoftwareBreakpointTrapOpcode()

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

◆ Halt()

Status NativeProcessFreeBSD::Halt ( )

◆ HasThreadNoLock()

bool NativeProcessFreeBSD::HasThreadNoLock ( lldb::tid_t  thread_id)

Definition at line 769 of file NativeProcessFreeBSD.cpp.

References lldb_private::NativeProcessProtocol::m_threads.

Referenced by AddThread(), and RemoveThread().

◆ Interrupt()

Status NativeProcessFreeBSD::Interrupt ( )

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 an error object.

Reimplemented from lldb_private::NativeProcessProtocol.

Definition at line 521 of file NativeProcessFreeBSD.cpp.

References Halt().

◆ Kill()

Status NativeProcessFreeBSD::Kill ( )

◆ MonitorCallback()

void NativeProcessFreeBSD::MonitorCallback ( lldb::pid_t  pid,
int  signal 

Definition at line 161 of file NativeProcessFreeBSD.cpp.

References MonitorSignal(), MonitorSIGSTOP(), MonitorSIGTRAP(), SIGSTOP, and SIGTRAP.

Referenced by SigchldHandler().

◆ MonitorClone()

void NativeProcessFreeBSD::MonitorClone ( ::pid_t  child_pid,
bool  is_vfork,
NativeThreadFreeBSD parent_thread 

◆ MonitorExited()

void NativeProcessFreeBSD::MonitorExited ( lldb::pid_t  pid,
WaitStatus  status 

◆ MonitorSignal()

void NativeProcessFreeBSD::MonitorSignal ( lldb::pid_t  pid,
int  signal 

◆ MonitorSIGSTOP()

void NativeProcessFreeBSD::MonitorSIGSTOP ( lldb::pid_t  pid)

◆ MonitorSIGTRAP()

void NativeProcessFreeBSD::MonitorSIGTRAP ( lldb::pid_t  pid)

Definition at line 195 of file NativeProcessFreeBSD.cpp.

References AddThread(), lldb_private::process_freebsd::NativeThreadFreeBSD::CopyWatchpointsFrom(), error(), lldb::eStateInvalid, lldb::eStateStopped, lldb_private::Status::Fail(), lldb_private::NativeProcessProtocol::FixupBreakpointPCAsNeeded(), lldb_private::NativeProcessProtocol::GetCurrentThread(), lldb_private::NativeThreadProtocol::GetID(), lldb_private::ProcessPOSIXLog::GetLogIfAllCategoriesSet(), lldb_private::process_freebsd::NativeThreadFreeBSD::GetRegisterContext(), LLDB_INVALID_INDEX32, LLDB_LOG, LLDB_LOG_ERROR, lldb_private::NativeProcessProtocol::m_enabled_extensions, lldb_private::NativeProcessProtocol::m_threads, lldb_private::NativeProcessSoftwareSingleStep::m_threads_stepping_with_breakpoint, MonitorClone(), MonitorSignal(), lldb_private::NativeProcessProtocol::NotifyDidExec(), POSIX_LOG_PROCESS, PtraceWrapper(), ReinitializeThreads(), lldb_private::NativeProcessProtocol::RemoveBreakpoint(), RemoveThread(), lldb_private::NativeProcessProtocol::SetState(), lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByBreakpoint(), lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByExec(), lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByTrace(), lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByVForkDone(), lldb_private::process_freebsd::NativeThreadFreeBSD::SetStoppedByWatchpoint(), SIGTRAP, and lldb_private::NativeProcessProtocol::vfork.

Referenced by MonitorCallback().

◆ PopulateMemoryRegionCache()

Status NativeProcessFreeBSD::PopulateMemoryRegionCache ( )

◆ PtraceWrapper()

Status NativeProcessFreeBSD::PtraceWrapper ( int  req,
lldb::pid_t  pid,
void *  addr = nullptr,
int  data = 0,
int *  result = nullptr 

◆ ReadMemory()

Status NativeProcessFreeBSD::ReadMemory ( lldb::addr_t  addr,
void *  buf,
size_t  size,
size_t &  bytes_read 

◆ ReinitializeThreads()

Status NativeProcessFreeBSD::ReinitializeThreads ( )

◆ RemoveThread()

void NativeProcessFreeBSD::RemoveThread ( lldb::tid_t  thread_id)

◆ Resume()

Status NativeProcessFreeBSD::Resume ( const ResumeActionList resume_actions)

◆ SaveCore()

llvm::Expected< std::string > NativeProcessFreeBSD::SaveCore ( llvm::StringRef  path_hint)

Write a core dump (without crashing the program).

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

Reimplemented from lldb_private::NativeProcessProtocol.

Definition at line 1018 of file NativeProcessFreeBSD.cpp.

References error(), lldb_private::NativeProcessProtocol::GetID(), pc, and PtraceWrapper().

◆ SetBreakpoint()

Status NativeProcessFreeBSD::SetBreakpoint ( lldb::addr_t  addr,
uint32_t  size,
bool  hardware 

◆ SetupTrace()

Status NativeProcessFreeBSD::SetupTrace ( )

◆ SigchldHandler()

void NativeProcessFreeBSD::SigchldHandler ( )

◆ Signal()

Status NativeProcessFreeBSD::Signal ( int  signo)

Sends a process a UNIX signal signal.

Returns an error object.

Implements lldb_private::NativeProcessProtocol.

Definition at line 512 of file NativeProcessFreeBSD.cpp.

References error(), and lldb_private::NativeProcessProtocol::GetID().

◆ SupportHardwareSingleStepping()

bool NativeProcessFreeBSD::SupportHardwareSingleStepping ( ) const

Definition at line 950 of file NativeProcessFreeBSD.cpp.

References lldb_private::ArchSpec::IsMIPS(), and m_arch.

◆ UpdateThreads()

size_t NativeProcessFreeBSD::UpdateThreads ( )

◆ WriteMemory()

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

Member Data Documentation

◆ m_arch

ArchSpec lldb_private::process_freebsd::NativeProcessFreeBSD::m_arch

◆ m_main_loop

MainLoop& lldb_private::process_freebsd::NativeProcessFreeBSD::m_main_loop

Definition at line 103 of file NativeProcessFreeBSD.h.

Referenced by MonitorClone().

◆ m_mem_region_cache

std::vector<std::pair<MemoryRegionInfo, FileSpec> > lldb_private::process_freebsd::NativeProcessFreeBSD::m_mem_region_cache

◆ m_sigchld_handle

MainLoop::SignalHandleUP lldb_private::process_freebsd::NativeProcessFreeBSD::m_sigchld_handle

Definition at line 101 of file NativeProcessFreeBSD.h.

Referenced by Detach(), and NativeProcessFreeBSD().

◆ m_supports_mem_region

LazyBool lldb_private::process_freebsd::NativeProcessFreeBSD::m_supports_mem_region = eLazyBoolCalculate

Definition at line 104 of file NativeProcessFreeBSD.h.

Referenced by GetMemoryRegionInfo(), and PopulateMemoryRegionCache().

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