aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux
diff options
context:
space:
mode:
authorbenchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-01-19 07:14:51 +0000
committerbenchan@chromium.org <benchan@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-01-19 07:14:51 +0000
commit30566abed8d95b752f31f67fde94c0ae0a1502d2 (patch)
tree90f98f074cebf21102ad8f8717a2e70e9f4438a9 /src/common/linux
parentSkip ElfCoreDumpTest.ValidCoreFile test if no core dump is generated. (diff)
downloadbreakpad-30566abed8d95b752f31f67fde94c0ae0a1502d2.tar.xz
Implement core dump to minidump conversion.
This patch is part of a bigger patch that helps merging the breakpad code with the modified version in Chromium OS. Specifically, this patch makes the following changes: 1. Turn the LinuxDumper class into a base class and move ptrace related code into a new derived class, LinuxPtraceDumper. 2. Add a LinuxCoreDumper class, which is derived from LinuxDumper, to extract information from a crashed process via a core dump file instead of ptrace. 3. Add a WriteMinidumpFromCore function to src/client/linux/minidump_writer/minidump_writer.h, which uses LinuxCoreDumper to extract information from a core dump file. 4. Add a core2md utility, which simply wraps WriteMinidumpFromCore, for converting a core dump to a minidump. BUG=455 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. 4. Run Chromium OS tests to test core2md. Review URL: http://breakpad.appspot.com/343001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@905 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/linux')
-rw-r--r--src/common/linux/elf_core_dump_unittest.cc2
-rw-r--r--src/common/linux/tests/crash_generator.cc6
-rw-r--r--src/common/linux/tests/crash_generator.h2
3 files changed, 7 insertions, 3 deletions
diff --git a/src/common/linux/elf_core_dump_unittest.cc b/src/common/linux/elf_core_dump_unittest.cc
index 89496ab9..11920f25 100644
--- a/src/common/linux/elf_core_dump_unittest.cc
+++ b/src/common/linux/elf_core_dump_unittest.cc
@@ -141,7 +141,7 @@ TEST(ElfCoreDumpTest, ValidCoreFile) {
// TODO(benchan): Revert to use ASSERT_TRUE once the flakiness in
// CrashGenerator is identified and fixed.
if (!crash_generator.CreateChildCrash(kNumOfThreads, kCrashThread,
- kCrashSignal)) {
+ kCrashSignal, NULL)) {
fprintf(stderr, "ElfCoreDumpTest.ValidCoreFile test is skipped "
"due to no core dump generated");
return;
diff --git a/src/common/linux/tests/crash_generator.cc b/src/common/linux/tests/crash_generator.cc
index fd96e6ca..7274acf9 100644
--- a/src/common/linux/tests/crash_generator.cc
+++ b/src/common/linux/tests/crash_generator.cc
@@ -144,7 +144,8 @@ bool CrashGenerator::SetCoreFileSizeLimit(rlim_t limit) const {
}
bool CrashGenerator::CreateChildCrash(
- unsigned num_threads, unsigned crash_thread, int crash_signal) {
+ unsigned num_threads, unsigned crash_thread, int crash_signal,
+ pid_t* child_pid) {
if (num_threads == 0 || crash_thread >= num_threads)
return false;
@@ -178,6 +179,9 @@ bool CrashGenerator::CreateChildCrash(
perror("CrashGenerator: Child process not killed by the expected signal");
return false;
}
+
+ if (child_pid)
+ *child_pid = pid;
return true;
}
diff --git a/src/common/linux/tests/crash_generator.h b/src/common/linux/tests/crash_generator.h
index c88a8920..874b15cd 100644
--- a/src/common/linux/tests/crash_generator.h
+++ b/src/common/linux/tests/crash_generator.h
@@ -70,7 +70,7 @@ class CrashGenerator {
// a signal with number |crash_signal| to the |crash_thread|-th thread.
// Returns true on success.
bool CreateChildCrash(unsigned num_threads, unsigned crash_thread,
- int crash_signal);
+ int crash_signal, pid_t* child_pid);
// Creates |num_threads| threads in the child process.
void CreateThreadsInChildProcess(unsigned num_threads);