Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1383)

Unified Diff: minidump/minidump_file_writer_test.cc

Issue 1364053002: win: Save contents of PEB to minidump (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@save-teb
Patch Set: fixes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: minidump/minidump_file_writer_test.cc
diff --git a/minidump/minidump_file_writer_test.cc b/minidump/minidump_file_writer_test.cc
index 147d5c8a0b3c7937e915af8030a0107c5cc41c46..44c395306fc78057629d678a9c74042bcc851f1e 100644
--- a/minidump/minidump_file_writer_test.cc
+++ b/minidump/minidump_file_writer_test.cc
@@ -28,6 +28,7 @@
#include "minidump/test/minidump_writable_test_util.h"
#include "snapshot/test/test_cpu_context.h"
#include "snapshot/test/test_exception_snapshot.h"
+#include "snapshot/test/test_memory_snapshot.h"
#include "snapshot/test/test_module_snapshot.h"
#include "snapshot/test/test_process_snapshot.h"
#include "snapshot/test/test_system_snapshot.h"
@@ -252,6 +253,14 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
process_snapshot.SetSystem(system_snapshot.Pass());
+ auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
+ const uint64_t kPebAddress = 0x07f90000;
+ peb_snapshot->SetAddress(kPebAddress);
+ const size_t kPebSize = 0x280;
+ peb_snapshot->SetSize(kPebSize);
+ peb_snapshot->SetValue('p');
+ process_snapshot.AddExtraMemory(peb_snapshot.Pass());
+
MinidumpFileWriter minidump_file_writer;
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
@@ -283,6 +292,13 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
EXPECT_EQ(kMinidumpStreamTypeMemoryList, directory[4].StreamType);
EXPECT_TRUE(MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
string_file.string(), directory[4].Location));
+
+ const MINIDUMP_MEMORY_LIST* memory_list =
+ MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
+ string_file.string(), directory[4].Location);
+ EXPECT_EQ(1u, memory_list->NumberOfMemoryRanges);
+ EXPECT_EQ(kPebAddress, memory_list->MemoryRanges[0].StartOfMemoryRange);
+ EXPECT_EQ(kPebSize, memory_list->MemoryRanges[0].Memory.DataSize);
}
TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {

Powered by Google App Engine
This is Rietveld 408576698