Crashpad
|
Provides an architecturally agnostic interface for collecting information with ptrace
.
More...
#include "util/linux/ptracer.h"
Public Member Functions | |
Ptracer (bool is_64_bit, bool can_log) | |
Constructs this object with a pre-determined bitness. More... | |
Ptracer (bool can_log) | |
Constructs this object without a pre-determined bitness. More... | |
bool | Initialize (pid_t pid) |
Initializes this object to the bitness of the process whose process ID is pid. More... | |
bool | Is64Bit () |
Return true if this object is configured for 64-bit. | |
bool | GetThreadInfo (pid_t tid, ThreadInfo *info) |
Uses ptrace to collect information about the thread with thread ID tid. More... | |
ssize_t | ReadUpTo (pid_t pid, LinuxVMAddress address, size_t size, char *buffer) |
Uses ptrace to read memory from the process with process ID pid, up to a maximum number of bytes. More... | |
Provides an architecturally agnostic interface for collecting information with ptrace
.
A ptracer is configured for a particular bitness. It is an error to make any calls via this object against a thread whose bitness does not match the bitness this object was initialized with.
crashpad::Ptracer::Ptracer | ( | bool | is_64_bit, |
bool | can_log | ||
) |
Constructs this object with a pre-determined bitness.
[in] | is_64_bit | true if this object is to be configured for 64-bit. |
[in] | can_log | Whether methods in this class can log error messages. |
|
explicit |
Constructs this object without a pre-determined bitness.
Initialize() must be successfully called before making any other calls on this object.
[in] | can_log | Whether methods in this class can log error messages. |
bool crashpad::Ptracer::GetThreadInfo | ( | pid_t | tid, |
ThreadInfo * | info | ||
) |
Uses ptrace
to collect information about the thread with thread ID tid.
The target thread should be attached before calling this method.
[in] | tid | The thread ID of the thread to collect information for. |
[out] | info | A ThreadInfo for the thread. |
true
on success. false
on failure with a message logged, if enabled. bool crashpad::Ptracer::Initialize | ( | pid_t | pid | ) |
Initializes this object to the bitness of the process whose process ID is pid.
[in] | pid | The process ID of the process to initialize with. |
true
on success. false
on failure with a message logged, if enabled. ssize_t crashpad::Ptracer::ReadUpTo | ( | pid_t | pid, |
LinuxVMAddress | address, | ||
size_t | size, | ||
char * | buffer | ||
) |
Uses ptrace
to read memory from the process with process ID pid, up to a maximum number of bytes.
The target process should already be attached before calling this method.
[in] | pid | The process ID whose memory to read. |
[in] | address | The base address of the region to read. |
[in] | size | The size of the memory region to read. buffer must be at least this size. |
[out] | buffer | The buffer to fill with the data read. |