Refactor MemorySnapshotGeneric to use ProcessMemory instead of ProcessReader

Also remove MemorySnapshotWin since the code is identical to
MemorySnapshotGeneric now.

Bug: crashpad:95
Change-Id: I9a631f8eb206dd72a69158021db87e8db41c5913
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1642148
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
This commit is contained in:
Clark DuVall 2019-06-10 12:15:46 -07:00 committed by Commit Bot
parent e0e83ad18a
commit d85f898a69
21 changed files with 72 additions and 237 deletions

View File

@ -170,8 +170,6 @@ static_library("snapshot") {
"win/exception_snapshot_win.h",
"win/memory_map_region_snapshot_win.cc",
"win/memory_map_region_snapshot_win.h",
"win/memory_snapshot_win.cc",
"win/memory_snapshot_win.h",
"win/module_snapshot_win.cc",
"win/module_snapshot_win.h",
"win/pe_image_annotations_reader.cc",

View File

@ -52,9 +52,9 @@ bool ThreadSnapshotFuchsia::Initialize(
#endif
if (thread.stack_regions.empty()) {
stack_.Initialize(process_reader, 0, 0);
stack_.Initialize(process_reader->Memory(), 0, 0);
} else {
stack_.Initialize(process_reader,
stack_.Initialize(process_reader->Memory(),
thread.stack_regions[0].base(),
thread.stack_regions[0].size());
// TODO(scottmg): Handle split stack by adding other parts to ExtraMemory().

View File

@ -67,7 +67,7 @@ class ThreadSnapshotFuchsia final : public ThreadSnapshot {
#error Port.
#endif
CPUContext context_;
MemorySnapshotGeneric<ProcessReaderFuchsia> stack_;
MemorySnapshotGeneric stack_;
zx_koid_t thread_id_;
zx_vaddr_t thread_specific_data_address_;
InitializationStateDcheck initialized_;

View File

@ -190,8 +190,9 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
#error Port.
#endif
stack_.Initialize(
process_reader, thread.stack_region_address, thread.stack_region_size);
stack_.Initialize(process_reader->Memory(),
thread.stack_region_address,
thread.stack_region_size);
thread_specific_data_address_ =
thread.thread_info.thread_specific_data_address;

View File

@ -73,7 +73,7 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
#endif // ARCH_CPU_X86_FAMILY
} context_union_;
CPUContext context_;
MemorySnapshotGeneric<ProcessReaderLinux> stack_;
MemorySnapshotGeneric stack_;
LinuxVMAddress thread_specific_data_address_;
pid_t thread_id_;
int priority_;

View File

@ -49,7 +49,7 @@ bool ThreadSnapshotMac::Initialize(
thread_specific_data_address_ =
process_reader_thread.thread_specific_data_address;
stack_.Initialize(process_reader,
stack_.Initialize(process_reader->Memory(),
process_reader_thread.stack_region_address,
process_reader_thread.stack_region_size);

View File

@ -70,7 +70,7 @@ class ThreadSnapshotMac final : public ThreadSnapshot {
} context_union_;
#endif
CPUContext context_;
MemorySnapshotGeneric<ProcessReaderMac> stack_;
MemorySnapshotGeneric stack_;
uint64_t thread_id_;
uint64_t thread_specific_data_address_;
thread_t thread_;

View File

@ -111,31 +111,6 @@ bool DetermineMergedRange(const MemorySnapshot* a,
const MemorySnapshot* b,
CheckedRange<uint64_t, size_t>* merged);
namespace internal {
//! \brief A standard implementation of MemorySnapshot::MergeWithOtherSnapshot()
//! for concrete MemorySnapshot implementations that use a
//! `process_reader_`.
template <class T>
const MemorySnapshot* MergeWithOtherSnapshotImpl(const T* self,
const MemorySnapshot* other) {
const T* other_as_memory_snapshot_concrete =
reinterpret_cast<const T*>(other);
if (self->process_reader_ !=
other_as_memory_snapshot_concrete->process_reader_) {
LOG(ERROR) << "different process_reader_ for snapshots";
return nullptr;
}
CheckedRange<uint64_t, size_t> merged(0, 0);
if (!LoggingDetermineMergedRange(self, other, &merged))
return nullptr;
std::unique_ptr<T> result(new T());
result->Initialize(self->process_reader_, merged.base(), merged.size());
return result.release();
}
} // namespace internal
} // namespace crashpad
#endif // CRASHPAD_SNAPSHOT_MEMORY_SNAPSHOT_H_

View File

@ -19,6 +19,7 @@
#include <sys/types.h>
#include "base/macros.h"
#include "base/numerics/safe_math.h"
#include "snapshot/memory_snapshot.h"
#include "util/misc/address_types.h"
#include "util/misc/initialization_state_dcheck.h"
@ -30,7 +31,6 @@ namespace internal {
//! \brief A MemorySnapshot of a memory region in a process on the running
//! system. Used on Mac, Linux, Android, and Fuchsia, templated on the
//! platform-specific ProcessReader type.
template <class ProcessReaderType>
class MemorySnapshotGeneric final : public MemorySnapshot {
public:
MemorySnapshotGeneric() = default;
@ -42,25 +42,25 @@ class MemorySnapshotGeneric final : public MemorySnapshot {
//! until Read() is called, and the memory snapshot data is discared when
//! Read() returns.
//!
//! \param[in] process_reader A reader for the process being snapshotted.
//! \param[in] process_memory A reader for the process being snapshotted.
//! \param[in] address The base address of the memory region to snapshot, in
//! the snapshot process address space.
//! \param[in] size The size of the memory region to snapshot.
void Initialize(ProcessReaderType* process_reader,
void Initialize(const ProcessMemory* process_memory,
VMAddress address,
VMSize size) {
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
process_reader_ = process_reader;
process_memory_ = process_memory;
address_ = address;
size_ = size;
size_ = base::checked_cast<size_t>(size);
INITIALIZATION_STATE_SET_VALID(initialized_);
}
// MemorySnapshot:
uint64_t Address() const override {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
return address_;
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
return address_;
}
size_t Size() const override {
@ -76,7 +76,7 @@ class MemorySnapshotGeneric final : public MemorySnapshot {
}
std::unique_ptr<uint8_t[]> buffer(new uint8_t[size_]);
if (!process_reader_->Memory()->Read(address_, size_, buffer.get())) {
if (!process_memory_->Read(address_, size_, buffer.get())) {
return false;
}
return delegate->MemorySnapshotDelegateRead(buffer.get(), size_);
@ -84,7 +84,19 @@ class MemorySnapshotGeneric final : public MemorySnapshot {
const MemorySnapshot* MergeWithOtherSnapshot(
const MemorySnapshot* other) const override {
return MergeWithOtherSnapshotImpl(this, other);
const MemorySnapshotGeneric* other_as_memory_snapshot_concrete =
reinterpret_cast<const MemorySnapshotGeneric*>(other);
if (process_memory_ != other_as_memory_snapshot_concrete->process_memory_) {
LOG(ERROR) << "different process_memory_ for snapshots";
return nullptr;
}
CheckedRange<uint64_t, size_t> merged(0, 0);
if (!LoggingDetermineMergedRange(this, other, &merged))
return nullptr;
auto result = std::make_unique<MemorySnapshotGeneric>();
result->Initialize(process_memory_, merged.base(), merged.size());
return result.release();
}
private:
@ -93,9 +105,9 @@ class MemorySnapshotGeneric final : public MemorySnapshot {
const T* self,
const MemorySnapshot* other);
ProcessReaderType* process_reader_; // weak
uint64_t address_;
uint64_t size_;
const ProcessMemory* process_memory_; // weak
VMAddress address_;
size_t size_;
InitializationStateDcheck initialized_;
DISALLOW_COPY_AND_ASSIGN(MemorySnapshotGeneric);

View File

@ -155,8 +155,6 @@
'win/capture_memory_delegate_win.h',
'win/memory_map_region_snapshot_win.cc',
'win/memory_map_region_snapshot_win.h',
'win/memory_snapshot_win.cc',
'win/memory_snapshot_win.h',
'win/module_snapshot_win.cc',
'win/module_snapshot_win.h',
'win/pe_image_annotations_reader.cc',

View File

@ -17,7 +17,7 @@
#include <utility>
#include "base/numerics/safe_conversions.h"
#include "snapshot/win/memory_snapshot_win.h"
#include "snapshot/memory_snapshot_generic.h"
namespace crashpad {
namespace internal {
@ -25,7 +25,7 @@ namespace internal {
CaptureMemoryDelegateWin::CaptureMemoryDelegateWin(
ProcessReaderWin* process_reader,
const ProcessReaderWin::Thread& thread,
std::vector<std::unique_ptr<MemorySnapshotWin>>* snapshots,
std::vector<std::unique_ptr<MemorySnapshotGeneric>>* snapshots,
uint32_t* budget_remaining)
: stack_(thread.stack_region_address, thread.stack_region_size),
process_reader_(process_reader),
@ -57,9 +57,9 @@ void CaptureMemoryDelegateWin::AddNewMemorySnapshot(
return;
if (budget_remaining_ && *budget_remaining_ == 0)
return;
snapshots_->push_back(std::make_unique<internal::MemorySnapshotWin>());
internal::MemorySnapshotWin* snapshot = snapshots_->back().get();
snapshot->Initialize(process_reader_, range.base(), range.size());
snapshots_->push_back(std::make_unique<internal::MemorySnapshotGeneric>());
internal::MemorySnapshotGeneric* snapshot = snapshots_->back().get();
snapshot->Initialize(process_reader_->Memory(), range.base(), range.size());
if (budget_remaining_) {
if (!base::IsValueInRangeForNumericType<int64_t>(range.size())) {
*budget_remaining_ = 0;

View File

@ -28,7 +28,7 @@
namespace crashpad {
namespace internal {
class MemorySnapshotWin;
class MemorySnapshotGeneric;
class CaptureMemoryDelegateWin : public CaptureMemory::Delegate {
public:
@ -38,15 +38,15 @@ class CaptureMemoryDelegateWin : public CaptureMemory::Delegate {
//! \param[in] thread The thread being inspected. Memory ranges overlapping
//! this thread's stack will be ignored on the assumption that they're
//! already captured elsewhere.
//! \param[in] snapshots A vector of MemorySnapshotWin to which the captured
//! memory will be added.
//! \param[in] snapshots A vector of MemorySnapshotGeneric to which the
//! captured memory will be added.
//! \param[in] budget_remaining If non-null, a pointer to the remaining number
//! of bytes to capture. If this is `0`, no further memory will be
//! captured.
CaptureMemoryDelegateWin(
ProcessReaderWin* process_reader,
const ProcessReaderWin::Thread& thread,
std::vector<std::unique_ptr<MemorySnapshotWin>>* snapshots,
std::vector<std::unique_ptr<MemorySnapshotGeneric>>* snapshots,
uint32_t* budget_remaining);
// MemoryCaptureDelegate:
@ -60,7 +60,7 @@ class CaptureMemoryDelegateWin : public CaptureMemory::Delegate {
private:
CheckedRange<uint64_t, uint64_t> stack_;
ProcessReaderWin* process_reader_; // weak
std::vector<std::unique_ptr<MemorySnapshotWin>>* snapshots_; // weak
std::vector<std::unique_ptr<MemorySnapshotGeneric>>* snapshots_; // weak
uint32_t* budget_remaining_;
};

View File

@ -17,9 +17,9 @@
#include "client/crashpad_client.h"
#include "snapshot/capture_memory.h"
#include "snapshot/memory_snapshot.h"
#include "snapshot/win/cpu_context_win.h"
#include "snapshot/memory_snapshot_generic.h"
#include "snapshot/win/capture_memory_delegate_win.h"
#include "snapshot/win/memory_snapshot_win.h"
#include "snapshot/win/cpu_context_win.h"
#include "snapshot/win/process_reader_win.h"
#include "util/win/nt_internals.h"

View File

@ -36,7 +36,7 @@ class ProcessReaderWin;
namespace internal {
class MemorySnapshotWin;
class MemorySnapshotGeneric;
union CPUContextUnion {
#if defined(ARCH_CPU_X86_FAMILY)
@ -96,7 +96,7 @@ class ExceptionSnapshotWin final : public ExceptionSnapshot {
CPUContextUnion context_union_;
CPUContext context_;
std::vector<uint64_t> codes_;
std::vector<std::unique_ptr<internal::MemorySnapshotWin>> extra_memory_;
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>> extra_memory_;
uint64_t thread_id_;
uint64_t exception_address_;
uint32_t exception_flags_;

View File

@ -1,75 +0,0 @@
// Copyright 2015 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <memory>
#include "snapshot/win/memory_snapshot_win.h"
namespace crashpad {
namespace internal {
MemorySnapshotWin::MemorySnapshotWin()
: MemorySnapshot(),
process_reader_(nullptr),
address_(0),
size_(0),
initialized_() {
}
MemorySnapshotWin::~MemorySnapshotWin() {
}
void MemorySnapshotWin::Initialize(ProcessReaderWin* process_reader,
uint64_t address,
uint64_t size) {
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
process_reader_ = process_reader;
address_ = address;
DLOG_IF(WARNING, size >= std::numeric_limits<size_t>::max())
<< "size overflow";
size_ = static_cast<size_t>(size);
INITIALIZATION_STATE_SET_VALID(initialized_);
}
uint64_t MemorySnapshotWin::Address() const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
return address_;
}
size_t MemorySnapshotWin::Size() const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
return size_;
}
bool MemorySnapshotWin::Read(Delegate* delegate) const {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
if (size_ == 0) {
return delegate->MemorySnapshotDelegateRead(nullptr, size_);
}
std::unique_ptr<uint8_t[]> buffer(new uint8_t[size_]);
if (!process_reader_->Memory()->Read(address_, size_, buffer.get())) {
return false;
}
return delegate->MemorySnapshotDelegateRead(buffer.get(), size_);
}
const MemorySnapshot* MemorySnapshotWin::MergeWithOtherSnapshot(
const MemorySnapshot* other) const {
return MergeWithOtherSnapshotImpl(this, other);
}
} // namespace internal
} // namespace crashpad

View File

@ -1,75 +0,0 @@
// Copyright 2015 The Crashpad Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef CRASHPAD_SNAPSHOT_WIN_MEMORY_SNAPSHOT_WIN_H_
#define CRASHPAD_SNAPSHOT_WIN_MEMORY_SNAPSHOT_WIN_H_
#include <stdint.h>
#include <sys/types.h>
#include "base/macros.h"
#include "snapshot/memory_snapshot.h"
#include "snapshot/win/process_reader_win.h"
#include "util/misc/initialization_state_dcheck.h"
namespace crashpad {
namespace internal {
//! \brief A MemorySnapshot of a memory region in a process on the running
//! system, when the system runs Windows.
class MemorySnapshotWin final : public MemorySnapshot {
public:
MemorySnapshotWin();
~MemorySnapshotWin() override;
//! \brief Initializes the object.
//!
//! Memory is read lazily. No attempt is made to read the memory snapshot data
//! until Read() is called, and the memory snapshot data is discared when
//! Read() returns.
//!
//! \param[in] process_reader A reader for the process being snapshotted.
//! \param[in] address The base address of the memory region to snapshot, in
//! the snapshot process' address space.
//! \param[in] size The size of the memory region to snapshot.
void Initialize(ProcessReaderWin* process_reader,
uint64_t address,
uint64_t size);
// MemorySnapshot:
uint64_t Address() const override;
size_t Size() const override;
bool Read(Delegate* delegate) const override;
const MemorySnapshot* MergeWithOtherSnapshot(
const MemorySnapshot* other) const override;
private:
template <class T>
friend const MemorySnapshot* MergeWithOtherSnapshotImpl(
const T* self,
const MemorySnapshot* other);
ProcessReaderWin* process_reader_; // weak
uint64_t address_;
size_t size_;
InitializationStateDcheck initialized_;
DISALLOW_COPY_AND_ASSIGN(MemorySnapshotWin);
};
} // namespace internal
} // namespace crashpad
#endif // CRASHPAD_SNAPSHOT_WIN_MEMORY_SNAPSHOT_WIN_H_

View File

@ -19,7 +19,7 @@
#include "base/strings/utf_string_conversions.h"
#include "client/crashpad_info.h"
#include "client/simple_address_range_bag.h"
#include "snapshot/win/memory_snapshot_win.h"
#include "snapshot/memory_snapshot_generic.h"
#include "snapshot/win/pe_image_annotations_reader.h"
#include "snapshot/win/pe_image_reader.h"
#include "util/misc/tri_state.h"
@ -327,10 +327,10 @@ void ModuleSnapshotWin::GetCrashpadUserMinidumpStreams(
}
if (list_entry.size != 0) {
std::unique_ptr<internal::MemorySnapshotWin> memory(
new internal::MemorySnapshotWin());
std::unique_ptr<internal::MemorySnapshotGeneric> memory(
new internal::MemorySnapshotGeneric());
memory->Initialize(
process_reader_, list_entry.base_address, list_entry.size);
process_reader_->Memory(), list_entry.base_address, list_entry.size);
streams->push_back(std::make_unique<UserMinidumpStream>(
list_entry.stream_type, memory.release()));
}

View File

@ -459,7 +459,7 @@ void ProcessSnapshotWin::InitializePebData(
void ProcessSnapshotWin::AddMemorySnapshot(
WinVMAddress address,
WinVMSize size,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into) {
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into) {
if (size == 0)
return;
@ -480,14 +480,14 @@ void ProcessSnapshotWin::AddMemorySnapshot(
}
}
into->push_back(std::make_unique<internal::MemorySnapshotWin>());
into->back()->Initialize(&process_reader_, address, size);
into->push_back(std::make_unique<internal::MemorySnapshotGeneric>());
into->back()->Initialize(process_reader_.Memory(), address, size);
}
template <class Traits>
void ProcessSnapshotWin::AddMemorySnapshotForUNICODE_STRING(
const process_types::UNICODE_STRING<Traits>& us,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into) {
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into) {
AddMemorySnapshot(us.Buffer, us.Length, into);
}
@ -495,7 +495,7 @@ template <class Traits>
void ProcessSnapshotWin::AddMemorySnapshotForLdrLIST_ENTRY(
const process_types::LIST_ENTRY<Traits>& le,
size_t offset_of_member,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into) {
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into) {
// Walk the doubly-linked list of entries, adding the list memory itself, as
// well as pointed-to strings.
typename Traits::Pointer last = le.Blink;
@ -545,7 +545,7 @@ WinVMSize ProcessSnapshotWin::DetermineSizeOfEnvironmentBlock(
template <class Traits>
void ProcessSnapshotWin::ReadLock(
WinVMAddress start,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into) {
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into) {
// We're walking the RTL_CRITICAL_SECTION_DEBUG ProcessLocksList, but starting
// from an actual RTL_CRITICAL_SECTION, so start by getting to the first
// RTL_CRITICAL_SECTION_DEBUG.

View File

@ -31,6 +31,7 @@
#include "snapshot/exception_snapshot.h"
#include "snapshot/memory_map_region_snapshot.h"
#include "snapshot/memory_snapshot.h"
#include "snapshot/memory_snapshot_generic.h"
#include "snapshot/module_snapshot.h"
#include "snapshot/process_snapshot.h"
#include "snapshot/system_snapshot.h"
@ -38,7 +39,6 @@
#include "snapshot/unloaded_module_snapshot.h"
#include "snapshot/win/exception_snapshot_win.h"
#include "snapshot/win/memory_map_region_snapshot_win.h"
#include "snapshot/win/memory_snapshot_win.h"
#include "snapshot/win/module_snapshot_win.h"
#include "snapshot/win/system_snapshot_win.h"
#include "snapshot/win/thread_snapshot_win.h"
@ -154,18 +154,18 @@ class ProcessSnapshotWin final : public ProcessSnapshot {
void AddMemorySnapshot(
WinVMAddress address,
WinVMSize size,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into);
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into);
template <class Traits>
void AddMemorySnapshotForUNICODE_STRING(
const process_types::UNICODE_STRING<Traits>& us,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into);
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into);
template <class Traits>
void AddMemorySnapshotForLdrLIST_ENTRY(
const process_types::LIST_ENTRY<Traits>& le,
size_t offset_of_member,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into);
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into);
WinVMSize DetermineSizeOfEnvironmentBlock(
WinVMAddress start_of_environment_block);
@ -175,10 +175,10 @@ class ProcessSnapshotWin final : public ProcessSnapshot {
template <class Traits>
void ReadLock(
WinVMAddress start,
std::vector<std::unique_ptr<internal::MemorySnapshotWin>>* into);
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>>* into);
internal::SystemSnapshotWin system_;
std::vector<std::unique_ptr<internal::MemorySnapshotWin>> extra_memory_;
std::vector<std::unique_ptr<internal::MemorySnapshotGeneric>> extra_memory_;
std::vector<std::unique_ptr<internal::ThreadSnapshotWin>> threads_;
std::vector<std::unique_ptr<internal::ModuleSnapshotWin>> modules_;
std::vector<UnloadedModuleSnapshot> unloaded_modules_;

View File

@ -48,19 +48,20 @@ bool ThreadSnapshotWin::Initialize(
if (process_reader->GetProcessInfo().LoggingRangeIsFullyReadable(
CheckedRange<WinVMAddress, WinVMSize>(thread_.stack_region_address,
thread_.stack_region_size))) {
stack_.Initialize(process_reader,
stack_.Initialize(process_reader->Memory(),
thread_.stack_region_address,
thread_.stack_region_size);
} else {
stack_.Initialize(process_reader, 0, 0);
stack_.Initialize(process_reader->Memory(), 0, 0);
}
if (process_reader->GetProcessInfo().LoggingRangeIsFullyReadable(
CheckedRange<WinVMAddress, WinVMSize>(thread_.teb_address,
thread_.teb_size))) {
teb_.Initialize(process_reader, thread_.teb_address, thread_.teb_size);
teb_.Initialize(
process_reader->Memory(), thread_.teb_address, thread_.teb_size);
} else {
teb_.Initialize(process_reader, 0, 0);
teb_.Initialize(process_reader->Memory(), 0, 0);
}
#if defined(ARCH_CPU_X86)

View File

@ -24,8 +24,8 @@
#include "build/build_config.h"
#include "snapshot/cpu_context.h"
#include "snapshot/memory_snapshot.h"
#include "snapshot/memory_snapshot_generic.h"
#include "snapshot/thread_snapshot.h"
#include "snapshot/win/memory_snapshot_win.h"
#include "snapshot/win/process_reader_win.h"
#include "util/misc/initialization_state_dcheck.h"
@ -82,11 +82,11 @@ class ThreadSnapshotWin final : public ThreadSnapshot {
#endif
} context_union_;
CPUContext context_;
MemorySnapshotWin stack_;
MemorySnapshotWin teb_;
MemorySnapshotGeneric stack_;
MemorySnapshotGeneric teb_;
ProcessReaderWin::Thread thread_;
InitializationStateDcheck initialized_;
std::vector<std::unique_ptr<MemorySnapshotWin>> pointed_to_memory_;
std::vector<std::unique_ptr<MemorySnapshotGeneric>> pointed_to_memory_;
DISALLOW_COPY_AND_ASSIGN(ThreadSnapshotWin);
};