Manages a direct ptrace
connection to a process.
More...
#include "util/linux/direct_ptrace_connection.h"
|
| DirectPtraceConnection (const DirectPtraceConnection &)=delete |
|
DirectPtraceConnection & | operator= (const DirectPtraceConnection &)=delete |
|
bool | Initialize (pid_t pid) |
| Initializes this connection for the process whose process ID is pid.
|
|
pid_t | GetProcessID () override |
| Returns the process ID of the connected process.
|
|
bool | Attach (pid_t tid) override |
| Adds a new thread to this connection.
|
|
bool | Is64Bit () override |
| Returns true if connected to a 64-bit process.
|
|
bool | GetThreadInfo (pid_t tid, ThreadInfo *info) override |
| Retrieves a ThreadInfo for a target thread.
|
|
bool | ReadFileContents (const base::FilePath &path, std::string *contents) override |
| Reads the entire contents of a file.
|
|
ProcessMemoryLinux * | Memory () override |
| Returns a memory reader for the connected process.
|
|
bool | Threads (std::vector< pid_t > *threads) override |
| Determines the thread IDs of the threads in the connected process.
|
|
ssize_t | ReadUpTo (VMAddress, size_t size, void *buffer) override |
| Copies memory from the connected process into a caller-provided buffer in the current process, up to a maximum number of bytes.
|
|
Manages a direct ptrace
connection to a process.
This class is used when the current process has ptrace
capabilities for the target process.
◆ Attach()
bool crashpad::DirectPtraceConnection::Attach |
( |
pid_t | tid | ) |
|
|
overridevirtual |
Adds a new thread to this connection.
- Parameters
-
[in] | tid | The thread ID of the thread to attach. |
- Returns
true
on success. false
on failure with a message logged.
Implements crashpad::PtraceConnection.
◆ GetProcessID()
pid_t crashpad::DirectPtraceConnection::GetProcessID |
( |
| ) |
|
|
overridevirtual |
◆ GetThreadInfo()
bool crashpad::DirectPtraceConnection::GetThreadInfo |
( |
pid_t | tid, |
|
|
ThreadInfo * | info ) |
|
overridevirtual |
Retrieves a ThreadInfo for a target thread.
- Parameters
-
[in] | tid | The thread ID of the target thread. |
[out] | info | Information about the thread. |
- Returns
true
on success. false
on failure with a message logged.
Implements crashpad::PtraceConnection.
◆ Initialize()
bool crashpad::DirectPtraceConnection::Initialize |
( |
pid_t | pid | ) |
|
Initializes this connection for the process whose process ID is pid.
The main thread of the process is automatically attached by this call.
- Parameters
-
[in] | pid | The process ID of the process to connect to. |
- Returns
true
on success. false
on failure with a message logged.
◆ Is64Bit()
bool crashpad::DirectPtraceConnection::Is64Bit |
( |
| ) |
|
|
overridevirtual |
◆ Memory()
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.
Implements crashpad::PtraceConnection.
◆ ReadFileContents()
bool crashpad::DirectPtraceConnection::ReadFileContents |
( |
const base::FilePath & | path, |
|
|
std::string * | contents ) |
|
overridevirtual |
Reads the entire contents of a file.
- Parameters
-
[in] | path | The path of the file to read. |
[out] | contents | The file contents, valid if this method returns true . |
- Returns
true
on success. false
on failure with a message logged.
Implements crashpad::PtraceConnection.
◆ ReadUpTo()
ssize_t crashpad::DirectPtraceConnection::ReadUpTo |
( |
VMAddress | address, |
|
|
size_t | size, |
|
|
void * | buffer ) |
|
overridevirtual |
Copies memory from the connected process into a caller-provided buffer in the current process, up to a maximum number of bytes.
- Parameters
-
[in] | address | The address, in the connected process' address space, of the memory region to copy. |
[in] | size | The maximum size, in bytes, of the memory region to copy. buffer must be at least this size. |
[out] | buffer | The 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.
Implements crashpad::PtraceConnection.
◆ Threads()
bool crashpad::DirectPtraceConnection::Threads |
( |
std::vector< pid_t > * | threads | ) |
|
|
overridevirtual |
Determines the thread IDs of the threads in the connected process.
- Parameters
-
[out] | threads | The 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.
Implements crashpad::PtraceConnection.
The documentation for this class was generated from the following files:
- util/linux/direct_ptrace_connection.h
- util/linux/direct_ptrace_connection.cc