Crashpad
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
crashpad::PtraceConnection Class Referenceabstract

Provides an interface for making ptrace requests against a process and its threads. More...

#include "util/linux/ptrace_connection.h"

Inheritance diagram for crashpad::PtraceConnection:
[legend]

Public Member Functions

virtual pid_t GetProcessID ()=0
 Returns the process ID of the connected process.
 
virtual bool Attach (pid_t tid)=0
 Adds a new thread to this connection.
 
virtual bool Is64Bit ()=0
 Returns true if connected to a 64-bit process.
 
virtual bool GetThreadInfo (pid_t tid, ThreadInfo *info)=0
 Retrieves a ThreadInfo for a target thread.
 
virtual bool ReadFileContents (const base::FilePath &path, std::string *contents)=0
 Reads the entire contents of a file.
 
virtual ProcessMemoryLinuxMemory ()=0
 Returns a memory reader for the connected process.
 
virtual bool Threads (std::vector< pid_t > *threads)=0
 Determines the thread IDs of the threads in the connected process.
 
virtual ssize_t ReadUpTo (VMAddress address, size_t size, void *buffer)=0
 Copies memory from the connected process into a caller-provided buffer in the current process, up to a maximum number of bytes.
 

Detailed Description

Provides an interface for making ptrace requests against a process and its threads.

Member Function Documentation

◆ Attach()

virtual bool crashpad::PtraceConnection::Attach ( pid_t tid)
pure virtual

Adds a new thread to this connection.

Parameters
[in]tidThe thread ID of the thread to attach.
Returns
true on success. false on failure with a message logged.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.

◆ GetProcessID()

virtual pid_t crashpad::PtraceConnection::GetProcessID ( )
pure virtual

Returns the process ID of the connected process.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.

◆ GetThreadInfo()

virtual bool crashpad::PtraceConnection::GetThreadInfo ( pid_t tid,
ThreadInfo * info )
pure virtual

Retrieves a ThreadInfo for a target thread.

Parameters
[in]tidThe thread ID of the target thread.
[out]infoInformation about the thread.
Returns
true on success. false on failure with a message logged.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.

◆ Is64Bit()

virtual bool crashpad::PtraceConnection::Is64Bit ( )
pure virtual

Returns true if connected to a 64-bit process.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.

◆ Memory()

virtual ProcessMemoryLinux * crashpad::PtraceConnection::Memory ( )
pure virtual

Returns a memory reader for the connected process.

The caller does not take ownership of the reader. The reader is valid for the lifetime of the PtraceConnection that created it.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.

◆ ReadFileContents()

virtual bool crashpad::PtraceConnection::ReadFileContents ( const base::FilePath & path,
std::string * contents )
pure virtual

Reads the entire contents of a file.

Parameters
[in]pathThe path of the file to read.
[out]contentsThe file contents, valid if this method returns true.
Returns
true on success. false on failure with a message logged.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.

◆ ReadUpTo()

virtual ssize_t crashpad::PtraceConnection::ReadUpTo ( VMAddress address,
size_t size,
void * buffer )
pure virtual

Copies memory from the connected process into a caller-provided buffer in the current process, up to a maximum number of bytes.

Parameters
[in]addressThe address, in the connected process' address space, of the memory region to copy.
[in]sizeThe maximum size, in bytes, of the memory region to copy. buffer must be at least this size.
[out]bufferThe buffer into which the contents of the other process' memory will be copied.
Returns
the number of bytes copied, 0 if there is no more data to read, or -1 on failure with a message logged.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.

◆ Threads()

virtual bool crashpad::PtraceConnection::Threads ( std::vector< pid_t > * threads)
pure virtual

Determines the thread IDs of the threads in the connected process.

Parameters
[out]threadsThe list of thread IDs.
Returns
true on success, false on failure with a message logged. If this method returns false, threads may contain a partial list of thread IDs.

Implemented in crashpad::DirectPtraceConnection, crashpad::PtraceClient, and crashpad::test::FakePtraceConnection.


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