Implement ProcessSnapshotMac::Memory()

Plumb ProcessReaderMac::Memory() through to ProcessSnapshotMac::Memory()
and add consts where necessary to accomodate the type signature of
ProcessSnapshot::Memory().

Bug: crashpad:263
Change-Id: I2608979918bc201ae3561483ea52ed2092cbc1e2
Reviewed-on: https://chromium-review.googlesource.com/c/1387924
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
This commit is contained in:
Vlad Tsyrklevich 2018-12-20 13:40:53 -08:00 committed by Commit Bot
parent 3b9e3aad1b
commit fccd9c09c0
3 changed files with 5 additions and 6 deletions

View File

@ -138,7 +138,7 @@ class ProcessReaderMac {
bool CPUTimes(timeval* user_time, timeval* system_time) const;
//! \return Accesses the memory of the target task.
ProcessMemoryMac* Memory() { return &process_memory_; }
const ProcessMemoryMac* Memory() const { return &process_memory_; }
//! \return The threads that are in the task (process). The first element (at
//! index `0`) corresponds to the main thread.

View File

@ -219,8 +219,7 @@ std::vector<const MemorySnapshot*> ProcessSnapshotMac::ExtraMemory() const {
const ProcessMemory* ProcessSnapshotMac::Memory() const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
NOTREACHED(); // https://crashpad.chromium.org/bug/263
return nullptr;
return process_reader_.Memory();
}
void ProcessSnapshotMac::InitializeThreads() {

View File

@ -36,7 +36,7 @@ namespace internal {
namespace {
template <typename T>
bool ReadIntoAndZero(ProcessMemoryMac* process_memory,
bool ReadIntoAndZero(const ProcessMemoryMac* process_memory,
mach_vm_address_t address,
mach_vm_size_t size,
T* specific) {
@ -84,7 +84,7 @@ bool ReadIntoVersioned(ProcessReaderMac* process_reader,
return false;
}
ProcessMemoryMac* process_memory = process_reader->Memory();
const ProcessMemoryMac* process_memory = process_reader->Memory();
decltype(specific->version) version;
if (!process_memory->Read(field_address, sizeof(version), &version)) {
return false;
@ -103,7 +103,7 @@ bool ReadIntoSized(ProcessReaderMac* process_reader,
return false;
}
ProcessMemoryMac* process_memory = process_reader->Memory();
const ProcessMemoryMac* process_memory = process_reader->Memory();
decltype(specific->size) size;
if (!process_memory->Read(address + offsetof(T, size), sizeof(size), &size)) {
return false;