aboutsummaryrefslogtreecommitdiff
path: root/src/common/linux/elf_core_dump_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Linux breakpad_unittests: fix ThreadSanitizer problemsMark Mentovai2019-04-261-2/+11
| | | | | | | | | | | | | | | | Some tests were failing because they had expectations about the number of threads in a process, but TSan, and in some cases, ASan, introduce their own threads. Where a sanitizer affects this, the expectations are now used as minimum thread counts, not exact thread counts. See https://www.brooklinen.com/blogs/brookliving/best-thread-count-for-sheets. These problems were detected by ThreadSanitizer at https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8915151099544583616/+/steps/breakpad_unittests__with_patch_/0/stdout Bug: chromium:949098 Change-Id: Ie40f1766bea27e9bcb112bf9e0b8b846fb343012 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1585948 Reviewed-by: Robert Sesek <rsesek@chromium.org>
* Chrome on Android now supports loading the shared library directly from the ↵rmcilroy@chromium.org2014-07-221-10/+11
| | | | | | | | | | | | | | | | | | | | | | APK file. This patch makes two changes to breakpad to enable crash reporting to work correctly when the library is inside another file (an archive): - Do not filter mappings which map an executable at a non-zero offset. - If such an executable is mapped look in the ELF information for the shared object name and use that name in the minidump. Note this change doesn't care about the archive format and isn't Android specific (though loading the shared library this way is currently only done on Android). BUG=390618 R=thestig@chromium.org Review URL: https://breakpad.appspot.com/7684002 Patch from Anton Carver <anton@chromium.org>. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1355 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Skip ElfCoreDumpTest and LinuxCoreDumperTest on Android if no core file is ↵rmcilroy@chromium.org2014-04-231-0/+9
| | | | | | | | | | | | | | | dumped. On certain versions of Android (specifically JellyBean MR2 on Nexus 7, possibly others too) no ELF core dump is created for crashing processes. Check for this and skip the test if so. BUG=364943 R=thestig@chromium.org Review URL: https://breakpad.appspot.com/1624003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1318 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix ElfCoreDumpTest.ValidCoreFile unit test.benchan@chromium.org2014-04-031-2/+5
| | | | | | | | | | | | | | | | | | | The ElfCoreDumpTest.ValidCoreFile unit test assumed that the number of NT_FPREGSET / NT_PRXFPREG notes in the core dump file equals to the number of threads of the crashed process. This assumption isn't always true as the kernel skips filling the NT_FPREGSET / NT_PRXFPREG note of a thread if the FPU state isn't available. The kernel indicates the availability of NT_FPREGSET / NT_PRXFPREG via the pr_fpvalid field of the NT_PRSTATUS note. This CL modifies the ElfCoreDumpTest.ValidCoreFile unit test to verify the number of NT_FPREGSET and NT_PRXFPREG notes based on the pr_fpvalid field of the NT_PRSTATUS notes. BUG=577 TEST=Run unit tests on x86 and x86_64 Linux platform. R=vapier@chromium.org Review URL: https://breakpad.appspot.com/1404002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1303 4c0a9323-5329-0410-9bdc-e9ce6186880e
* fix races in CrashGenerator::CreateChildCrashvapier@chromium.org2014-04-021-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current CreateChildCrash logic is racy when it comes to creating a crash dump for two reasons: The main thread that calls kill() on a different thread is guaranteed the signal will be *queued* when it returns, but not *delivered*. If the kernel doesn't automatically schedule the receiving thread, but instead lets the main thread run to the exit() call, then the signal never triggers a coredump and the whole process simply exits. The main thread is using kill() to try to deliver a signal to a specific thread, but that function is for sending signals to a process. That means the kernel is free to deliver the signal to any thread in the process and not just the one requested. This manifests itself as the pr_pid in the coredump not being the one expected. Instead, we must use tkill() with the tid (which we already took care of gathering) to deliver to a specific thread. These are a lot easier to see on a UMP system as contention is heavier. BUG=chromium:207918 TEST=`dumper_unittest` still passes, and doesn't flake out in a UMP system TEST=`linux_client_unittest` still passes R=benchan@chromium.org Review URL: https://breakpad.appspot.com/1304005 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1299 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Cleaning up google-breakpad source code of signed-unsigned comparison warningsivan.penkov@gmail.com2012-11-211-3/+3
| | | | | | | | http://breakpad.appspot.com/488002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1083 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fix Breakpad unit tests build for Android.digit@chromium.org2012-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains the source-related fixes to ensure that the Breakpad unit tests build properly when targetting Android. Calling 'make check' still fails because there is still no way to run the unit test programs on a device. This will be addressed by a future patch. Important notes: - You must target Android API level 9 (Gingerbread) or higher to build the unit tests. This requirement is due to the current GTest revision used in the breakpad source tree. - This patch adds headers providing inlined C library functions missing from the NDK (see src/common/android/testing). They are inlined to avoid modifying Makefile.am and other build files. - Similarly, the <wchar.h> header-fix under src/common/android/testing/include is only required by GTest's current revision. E.g. it's not needed when building Breakpad as part of Chromium which uses a more up-to-date revision. Review URL: https://breakpad.appspot.com/439002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1020 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Fixing various compiler warnings and applying minor tweaks to allow running ofivan.penkov@gmail.com2012-07-021-4/+6
| | | | | | | | | | the mojority of breakpad unittests in Google. http://breakpad.appspot.com/399002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@978 4c0a9323-5329-0410-9bdc-e9ce6186880e
* This change allows compiling the google-breakpad code using a global ↵ivan.penkov@gmail.com2012-06-281-1/+1
| | | | | | ::string class instead of std::string. For more details take a look at common/using_std_string.h git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@974 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Implement core dump to minidump conversion.benchan@chromium.org2012-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Skip ElfCoreDumpTest.ValidCoreFile test if no core dump is generated.benchan@chromium.org2012-01-111-3/+10
| | | | | | | | | | | | | | | CrashGenerator::CreateChildCrash() may have some flakiness. This patch changes ElfCoreDumpTest to temporarily skip the ValidCoreFile test if no core dump is generated by CrashGenerator::CreateChildCrash(), but print out the error message to help debug the flakiness. BUG=chromium-os:24982 TEST=Tested the following: 1. Build on 32-bit and 64-bit Linux with gcc 4.6. 2. All unit tests pass. Review URL: http://breakpad.appspot.com/342001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@904 4c0a9323-5329-0410-9bdc-e9ce6186880e
* Add utilities for processing Linux core dump files.benchan@chromium.org2012-01-071-0/+238
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. Add an ElfCoreDump class for processing Linux core dump files, which will later be used to implement the core dump to minidump conversion. 2. Add a CrashGenerator class for generating a crash with a core dump file for testing the functionalities of ElfCoreDump. 3. Move some utility functions for reading/writing files to file_utils.h. 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. Review URL: http://breakpad.appspot.com/337001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@900 4c0a9323-5329-0410-9bdc-e9ce6186880e