Stands-in where real PtraceConnections aren't available. More...
#include "test/linux/fake_ptrace_connection.h"
Public Member Functions | |
FakePtraceConnection (const FakePtraceConnection &)=delete | |
FakePtraceConnection & | operator= (const FakePtraceConnection &)=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 the current process is 64-bit. | |
bool | GetThreadInfo (pid_t tid, ThreadInfo *info) override |
Does not modify info. | |
bool | ReadFileContents (const base::FilePath &path, std::string *contents) override |
Reads the entire contents of a file. | |
ProcessMemoryLinux * | Memory () override |
Attempts to create a ProcessMemory when called, calling ADD_FAILURE() and returning nullptr on failure. | |
bool | Threads (std::vector< pid_t > *threads) override |
ssize_t | ReadUpTo (VMAddress address, size_t size, void *buffer) override |
\todo Not yet implemented. | |
Stands-in where real PtraceConnections aren't available.
This class performs basic EXPECTs that it is used correctly, but does not execute any real ptrace
calls or attachments.
|
overridevirtual |
Adds a new thread to this connection.
[in] | tid | The thread ID of the thread to attach. |
true
on success. false
on failure with a message logged. Implements crashpad::PtraceConnection.
|
overridevirtual |
Returns the process ID of the connected process.
Implements crashpad::PtraceConnection.
|
overridevirtual |
Does not modify info.
Implements crashpad::PtraceConnection.
bool crashpad::test::FakePtraceConnection::Initialize | ( | pid_t | pid | ) |
Initializes this connection for the process whose process ID is pid.
[in] | pid | The process ID of the process to connect to. |
true
on success. false
on failure with a message logged.
|
overridevirtual |
Returns true
if the current process is 64-bit.
Implements crashpad::PtraceConnection.
|
overridevirtual |
Attempts to create a ProcessMemory when called, calling ADD_FAILURE() and returning nullptr
on failure.
Implements crashpad::PtraceConnection.
|
overridevirtual |
Reads the entire contents of a file.
[in] | path | The path of the file to read. |
[out] | contents | The file contents, valid if this method returns true . |
true
on success. false
on failure with a message logged. Implements crashpad::PtraceConnection.
|
overridevirtual |
\todo Not yet implemented.
Implements crashpad::PtraceConnection.
|
overridevirtual |
Implements crashpad::PtraceConnection.