crashpad::PtraceClient Class Reference

Implements a PtraceConnection over a socket. More...

`#include "util/linux/ptrace_client.h"`

Inheritance diagram for crashpad::PtraceClient:

## Public Member Functions

bool | Initialize (int sock, pid_t pid, bool try_direct_memory=true)
| Initializes this object. More...
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. More...
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. More...
bool | ReadFileContents (const base::FilePath &path, std::string *contents) override
| Reads the entire contents of a file. More...
ProcessMemory * | Memory () override
| Returns a memory reader for the connected process. More...

## Detailed Description

Implements a PtraceConnection over a socket.

This class forms the client half of the connection and is typically used when the current process does not have `ptrace` capabilities on the target process. It should be created with a socket connected to a PtraceBroker.

## Member Function Documentation

## Attach()

bool crashpad::PtraceClient::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.

## GetThreadInfo()

bool crashpad::PtraceClient::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::PtraceClient::Initialize | ( | int | sock,
|  | pid_t | pid,
|  | bool | try_direct_memory = `true`
| ) |  |

Initializes this object.

This method must be successfully called before any other method in this class.

Parameters

  [in] | sock | A socket connected to a PtraceBroker. Does not take ownership of the socket.
  [in] | pid | The process ID of the process to form a PtraceConnection with.
  [in] | try_direct_memory | If `true` the client will attempt to support memory reading operations by directly acessing the target process' /proc/[pid]/mem file.

Returns
  `true` on success. `false` on failure with a message logged.

## Memory()

ProcessMemory * crashpad::PtraceClient::Memory | ( |  | ) |

overridevirtual

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::PtraceClient::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.

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

- util/linux/ptrace_client.h
- util/linux/ptrace_client.cc