win: Don't add zero-sized memory ranges to dump

One possible cause for this would be a register "pointing" to the edge of an
inaccessible range. Having these zero-sized ranges doesn't break the minidump,
but it causes a warning when opening in windbg.

Also drop user-supplied zero-length memory ranges for the same reason.

BUG=crashpad:104

Change-Id: I2c5acc54f04fb617806cecd87ac4ad5db93f3db8
Reviewed-on: https://chromium-review.googlesource.com/339210
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Scott Graham 2016-04-19 12:37:41 -07:00
parent 1fe622550d
commit 0d4438b2a5
3 changed files with 12 additions and 8 deletions

View File

@ -47,6 +47,8 @@ void CaptureMemoryDelegateWin::AddNewMemorySnapshot(
// Don't bother storing this memory if it points back into the stack.
if (stack_.ContainsRange(range))
return;
if (range.size() == 0)
return;
internal::MemorySnapshotWin* snapshot = new internal::MemorySnapshotWin();
snapshot->Initialize(process_reader_, range.base(), range.size());
snapshots_->push_back(snapshot);

View File

@ -298,12 +298,14 @@ void ModuleSnapshotWin::GetCrashpadUserMinidumpStreams(
return;
}
scoped_ptr<internal::MemorySnapshotWin> memory(
new internal::MemorySnapshotWin());
memory->Initialize(
process_reader_, list_entry.base_address, list_entry.size);
streams->push_back(
new UserMinidumpStream(list_entry.stream_type, memory.release()));
if (list_entry.size != 0) {
scoped_ptr<internal::MemorySnapshotWin> memory(
new internal::MemorySnapshotWin());
memory->Initialize(
process_reader_, list_entry.base_address, list_entry.size);
streams->push_back(
new UserMinidumpStream(list_entry.stream_type, memory.release()));
}
cur = list_entry.next;
}

View File

@ -76,10 +76,10 @@ class ThreadSnapshotWin final : public ThreadSnapshot {
#endif
CPUContext context_;
MemorySnapshotWin stack_;
internal::MemorySnapshotWin teb_;
MemorySnapshotWin teb_;
ProcessReaderWin::Thread thread_;
InitializationStateDcheck initialized_;
PointerVector<internal::MemorySnapshotWin> pointed_to_memory_;
PointerVector<MemorySnapshotWin> pointed_to_memory_;
DISALLOW_COPY_AND_ASSIGN(ThreadSnapshotWin);
};