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

Unified Diff: breakpad/linux/linux_dumper_unittest.cc

Issue 147032: Add linux-gate.so to the minidump mappings list by checking for the load addr.... Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « breakpad/linux/linux_dumper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: breakpad/linux/linux_dumper_unittest.cc
===================================================================
--- breakpad/linux/linux_dumper_unittest.cc (revision 18569)
+++ breakpad/linux/linux_dumper_unittest.cc (working copy)
@@ -64,3 +64,55 @@
}
}
}
+
+TEST(LinuxDumperTest, BuildProcPath) {
+ const pid_t pid = getpid();
+ LinuxDumper dumper(pid);
+
+ char maps_path[256] = "dummymappath";
+ char maps_path_expected[256];
+ snprintf(maps_path_expected, sizeof(maps_path_expected),
+ "/proc/%d/maps", pid);
+ dumper.BuildProcPath(maps_path, pid, "maps");
+ ASSERT_STREQ(maps_path, maps_path_expected);
+
+ // In release mode, we expect BuildProcPath to handle the invalid
+ // parameters correctly and fill map_path with an empty
+ // NULL-terminated string.
+#ifdef NDEBUG
+ snprintf(maps_path, sizeof(maps_path), "dummymappath");
+ dumper.BuildProcPath(maps_path, 0, "maps");
+ EXPECT_STREQ(maps_path, "");
+
+ snprintf(maps_path, sizeof(maps_path), "dummymappath");
+ dumper.BuildProcPath(maps_path, getpid(), "");
+ EXPECT_STREQ(maps_path, "");
+
+ snprintf(maps_path, sizeof(maps_path), "dummymappath");
+ dumper.BuildProcPath(maps_path, getpid(), NULL);
+ EXPECT_STREQ(maps_path, "");
+#endif
+}
+
+TEST(LinuxDumperTest, MappingsIncludeLinuxGate) {
+ LinuxDumper dumper(getpid());
+ ASSERT_TRUE(dumper.Init());
+
+ void* linux_gate_loc = dumper.FindBeginningOfLinuxGateSharedLibrary(getpid());
+ if (linux_gate_loc) {
+ bool found_linux_gate = false;
+
+ const wasteful_vector<MappingInfo*> mappings = dumper.mappings();
+ const MappingInfo* mapping;
+ for (unsigned i = 0; i < mappings.size(); ++i) {
+ mapping = mappings[i];
+ if (!strcmp(mapping->name, kLinuxGateLibraryName)) {
+ found_linux_gate = true;
+ break;
+ }
+ }
+ EXPECT_TRUE(found_linux_gate);
+ EXPECT_EQ(linux_gate_loc, reinterpret_cast<void*>(mapping->start_addr));
+ EXPECT_EQ(0, memcmp(linux_gate_loc, ELFMAG, SELFMAG));
+ }
+}
« no previous file with comments | « breakpad/linux/linux_dumper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698