diff options
author | benchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-02-23 18:50:08 +0000 |
---|---|---|
committer | benchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2012-02-23 18:50:08 +0000 |
commit | 907f95c5bda4144de54778769b7d51814b32c82a (patch) | |
tree | 6c15328998a67c7bdecc57898ca54ccbded496d8 /src/client/linux | |
parent | Fix an invalid cast in PostfixEvaluator<ValueType>::EvaluateInternal(). (diff) | |
download | breakpad-907f95c5bda4144de54778769b7d51814b32c82a.tar.xz |
Modify CrashGenerator::CreateChildCrash to copy proc files.
This patch is taken from the downstream version of breakpad in
Chromium OS: https://gerrit.chromium.org/gerrit/15148
LinuxCoreDumperTest previously assumes the proc files of the child
process created by CrashGenerator::CreateChildCrash() have the same
content as its parent process, which may not be true. This CL modifies
CrashGenerator to copy the proc files of the child process, created by
CreateChildCrash(), before crashing that process.
BUG=chromium-os:25252
TEST=Verified the following:
TEST=Tested the following:
1. Build on 32-bit and 64-bit Linux with gcc 4.4.3 and gcc 4.6.
2. Build on Mac OS X 10.6.8 with gcc 4.2 and clang 3.0 (with latest gmock).
3. All unit tests pass.
Review URL: https://breakpad.appspot.com/353001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@925 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux')
-rw-r--r-- | src/client/linux/minidump_writer/linux_core_dumper_unittest.cc | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc index e335413b..1fb26ede 100644 --- a/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc +++ b/src/client/linux/minidump_writer/linux_core_dumper_unittest.cc @@ -63,7 +63,7 @@ TEST(LinuxCoreDumperTest, BuildProcPath) { TEST(LinuxCoreDumperTest, VerifyDumpWithMultipleThreads) { CrashGenerator crash_generator; if (!crash_generator.HasDefaultCorePattern()) { - fprintf(stderr, "LinuxCoreDumperTest.VerifyDumpWithMultipleThreads test" + fprintf(stderr, "LinuxCoreDumperTest.VerifyDumpWithMultipleThreads test " "is skipped due to non-default core pattern\n"); return; } @@ -76,23 +76,15 @@ TEST(LinuxCoreDumperTest, VerifyDumpWithMultipleThreads) { // CrashGenerator is identified and fixed. if (!crash_generator.CreateChildCrash(kNumOfThreads, kCrashThread, kCrashSignal, &child_pid)) { - fprintf(stderr, "LinuxCoreDumperTest.VerifyDumpWithMultipleThreads test" + fprintf(stderr, "LinuxCoreDumperTest.VerifyDumpWithMultipleThreads test " "is skipped due to no core dump generated\n"); return; } pid_t pid = getpid(); - const char* core_file = crash_generator.GetCoreFilePath().c_str(); - - // Since CrashGenerator::CreateChildCrash() simply crashed a fork of - // this process, we expect that those proc files, which are used by - // LinuxCoreDumper, of crashed child process have the same content of - // this process. So we simply pass the proc files of this process to - // LinuxCoreDumper. - char procfs_path[NAME_MAX]; - snprintf(procfs_path, NAME_MAX, "/proc/%d", pid); - - LinuxCoreDumper dumper(child_pid, core_file, procfs_path); + const string core_file = crash_generator.GetCoreFilePath(); + const string procfs_path = crash_generator.GetDirectoryOfProcFilesCopy(); + LinuxCoreDumper dumper(child_pid, core_file.c_str(), procfs_path.c_str()); dumper.Init(); EXPECT_TRUE(dumper.IsPostMortem()); |