aboutsummaryrefslogtreecommitdiff
path: root/src/client
Commit message (Collapse)AuthorAgeFilesLines
* Use standard header locations for poll.h and signal.hMichael Forney2020-03-104-4/+3
| | | | | | | | | | | | | | | | sys/poll.h and sys/signal.h just redirect to the standardized location for these headers, poll.h and signal.h. On musl libc, including the incorrect header path results in a warning, and since breakpad is built with -Werror, this is an error. In exception_handler.cc, signal.h is already included earlier, so we can drop the sys/signal.h include. Bug: google-breakpad:631 Change-Id: If36d326453e3267d38a5b92ed1301f828e46befe Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2097344 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Update Xcode project files to fix build errors.Ivan Penkov2020-01-292-23/+28
| | | | | | | | | | | * Renamed convert_UTF.c to convert_UTF.cc * Enabled to use C++17 for [[clang::fallthrough]] defined in src/common/macros.h Patch by Hiro Komatsu Change-Id: I5de7f7dd4c8bf231a004144a5c82828c59ddcfd6 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2026761 Reviewed-by: Mark Mentovai <mark@chromium.org>
* ios: build for arm64eJoshua Peraza2020-01-032-3/+20
| | | | | | | | | | | | | | When __DARWIN_OPAQUE_ARM_THREAD_STATE64 is set (by default when building for arm64e), fp, lr, sp, pc, and flags (but not x or cpsr) in thread state are prepended with "__opaque" and intended to be accessed via supplied getters which may also authenticate pointers. We don't want to authenticate those pointers (since we expect they may be invalid and want to recover those invalid values) so access them directly. Bug: b/140375065 Change-Id: Ibe6c1dbfb5d68a9d350614445fa06d48873f8549 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1986868 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Remove dependency of uploader.mm on GTMLoggerSylvain Defresne2019-11-121-12/+12
| | | | | | | | | | | | | | | The file GTMLogger shipped with breakpad is a copy of the version from google_toolbox_for_mac. Having uploader.mm depend on GTMLogger causes pain to iOS projects that want to integrate both breakpad and google_toolbox_for_mac. Since the file uploader.mm mixed uses of fprintf and GTMLogger to log errors and warning, convert it to only use fprintf to stderr. Bug: none Change-Id: I68313ccf6951676a2859f44225281813722096ba Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1911755 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Revert "Remove use of "register" keyword, deprecated in C++17"Mark Mentovai2019-11-011-1/+1
| | | | | | | | | | | | | | This reverts commit 07411862eaa9a9a38e84caed2e97e836e456656f. We were a bit overzealous in removing “register” here. Both clang and GCC correctly disallow “register” as a storage class specifier in C++17 mode by producing an error in ordinary use. However, they require “register” to be specified for explicit register variables, and do not produce an error in this case. Change-Id: I223f2652c6da4215d6e8788d902e767c94b8c29d Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1894875 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux, client: set module name from DT_SONAMEJoshua Peraza2019-10-301-17/+27
| | | | | | | | | | | | | | | | | | 3e56ef9d changed dump_syms to set the module name from DT_SONAME expecting that clients were already using DT_SONAME when it was present. The Breakpad client previously only used DT_SONAME as the name for a module if it detected that it was likely mapped from a zip file. This patch updates the Breakpad Linux client to always use the DT_SONAME in minidumps if it's present. Also included are changes to address comments that were missed from that review. Bug: 1016924 Change-Id: I4aae8c05e6793d4b0598049a8964ddd4cb0c6194 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1889231 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* linux, dump_syms: set module name from DT_SONAMEJoshua Peraza2019-10-241-43/+0
| | | | | | | | | | | | | The Breakpad and Crashpad clients will use an object's DT_SONAME as the name for a module if it exists. Previously, linux dump_syms would assume the basename of an input elf file matches that value, causing symbol lookups to fail if they were mismatched. This patch updates dump_syms to use DT_SONAME as the module name, if present. Bug: 1016924 Change-Id: I5eff0cf06c703841df3fb552cb5a8e1e50a20c64 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1876763 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* convert_UTF: rewrite in C++Mike Frysinger2019-09-042-5/+4
| | | | | | | | | This allows us to namespace the symbols properly. Bug: google-breakpad:725 Change-Id: Iea8052547eef6c0acb299c1995781735c6d8994f Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1769236 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Remove use of "register" keyword, deprecated in C++17Mark Mentovai2019-08-121-1/+1
| | | | | | | | | | "register" as a storage class specifier has been deprecated since C++11, and has been removed from C++17 while remaining a reserved word. See C++17 5.11 and C.4.3. Change-Id: I2dbab8a7061cb680d902644d39ea1a7fbc930e5c Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1749329 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Fix breakpad client build.Nelson Billing2019-06-241-1/+1
| | | | | | | | - Was broken by a rename in http upload util code. Change-Id: I72c275fe45638c83e535901e79817893b00ee62e Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1673138 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* Fix 'debug_file' in PESourceLineWriter.Nelson Billing2019-06-191-4/+4
| | | | | | | | | | | - Add a #define to testing.gyp to avoid warnings about TR1 deprecation. - PESourceLineWriter now reads debug_file from CodeView record instead of using code_file value. - Updated PE-only MD reading unit test. Change-Id: Ib4e6201df3e3fd651e160f310584b5a67b16c842 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1668347 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* linux: fix broken testsJoshua Peraza2019-06-042-4/+4
| | | | | | | | Fixes errors for comparisons between signed and unsigned ints. Change-Id: I7ef151ba84a48a0c8cc449cfaf12b9fef775d5a7 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1642361 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix a build break with SDK 10.14.Ivan Penkov2019-05-291-2/+2
| | | | | | | | | | | | * Updated the minimal target version from 10.5 to 10.7. * Reference for the similar issue: https://github.com/uglide/RedisDesktopManager/issues/4284 Fix provided by Hiroyuki Komatsu. Change-Id: Ie08f8f6084e66d439d8b6282f1f4734b2dfe778f Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1633390 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix orphaned crash reports.John Z Wu2019-05-151-1/+13
| | | | | | | | | | | The path NSCachesDirectory may change across app updates and sometimes even across app launches. As a result, the Config-XXX files may end up with an outdated path to the associated minidump file. Change-Id: I0befde26b2ac406c154ce7c7e9be0063ee99892d Bug:850379 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1592561 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Linux breakpad_unittests: fix ThreadSanitizer problemsMark Mentovai2019-04-264-7/+41
| | | | | | | | | | | | | | | | 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>
* Linux MinidumpWriter: fix stack-use-after-scope violationMark Mentovai2019-04-261-2/+4
| | | | | | | | | | | | | | | | | | One form of google_breakpad::WriteMinidump() passed MappingList and AppMemoryList objects by reference to a MinidumpWriter object, instantiating them directly as constructor parameters. The MinidumpWriter stored these objects internally as references, and the underlying objects went out of scope after MinidumpWriter construction. The MinidumpWriter outlived them, causing a violation on any attempt to access them following construction. This bug was detected by AddressSanitizer at https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8915150848087289472/+/steps/breakpad_unittests__with_patch_/0/stdout Bug: chromium:949098 Change-Id: I072ea9f1b64e1eae3e89d4a2b158764ff7970db5 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1585946 Reviewed-by: Robert Sesek <rsesek@chromium.org>
* [Breakpad iOS] Add a callback on report upload completion.Olivier Robin2019-04-236-23/+88
| | | | | | | | | | | | | This CL adds a result callback on report upload completion. On failure, Breakpad deletes the configuration file and does retry to upload a report. Using this callback, the client will be able to log some metrics and to act on upload failure. Bug: 954175 Change-Id: I95a3264b65d4c06ba5d8dde8377440d23f1e2081 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1572661 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Make breakpad_unittests work with Chrome's test runner instead of gtest'sMark Mentovai2019-04-192-3/+7
| | | | | | | | | | | | | | | | | | | Chrome's test runner on Linux installs its own StackDumpSignalHandler which swallows signals and doesn't re-raise them. This is sloppy, but apparently there are reasons (https://crbug.com/551681). For breakpad_unittests, it causes problems where a test process expects (via waitpid()) to observe a child crash. Deal with those cases by explicitly restoring the default signal handler. In another case, Chrome's test runner seems to have been arriving at the conclusion that it was to expect output from a child. Transitioning from exit() to _exit() fixes this problem, and it's not necessarily a bad idea to do this in post-fork() children without an execve() anyway. Bug: chromium:949098 Change-Id: I5a6af0c2a09cd8eac9998358f6d5ea665288236f Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1575670 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Use correct c++ standard library in Xcode project.John Z Wu2019-04-191-0/+2
| | | | | | | | This makes it build again for Xcode 10. Change-Id: Ia28b8c0b131ac2862a8c17e223d1d7b1f0f59134 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1574177 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: add missing newline to Android test-disabled messageMark Mentovai2019-04-091-3/+3
| | | | | | | | | | | | | | The [ OK ] LinuxCoreDumperTest.VerifyExceptionDetails line does not appear at the beginning of a line, hiding it from Chromium’s test infrastructure. This causes the test to have an unknown result, which is treated as a failure. https://ci.chromium.org/p/chromium/builders/try/android-kitkat-arm-rel/233129 Bug: google-breakpad:791 Change-Id: I0eb646a219fa40347db884fd28ace647328c5e49 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1558893 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* linux_core_dumper: partially disable test on AndroidMike Frysinger2019-04-071-0/+9
| | | | | | | | | | | | | | | | | | | | | Running this test on android-kitkat-arm-rel fails for some reason: [ RUN ] LinuxCoreDumperTest.VerifyExceptionDetails linux_core_dumper_unittest.cc:170: Failure Expected: (0U) != (dumper.crash_address()), actual: 0 vs 0 linux_core_dumper_unittest.cc:178: Failure Expected equality of these values: 2U Which is: 2 info.size() Which is: 0 [ FAILED ] LinuxCoreDumperTest.VerifyExceptionDetails (7 ms) Disable it for now on Android until someone can look into it. Bug: google-breakpad:791 Change-Id: I40a5e3dbeeb44e5eb0df187e61d55e07d8ad3613 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1546778 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: add explicit casts for exception fieldsMike Frysinger2019-03-301-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the fields we save might have signed types depending on the system (e.g. `typedef int pid_t`). Depending on the toolchain, we can trip -Werror=narrowing failures like: src/client/linux/minidump_writer/linux_core_dumper.cc:248:66: error: narrowing conversion of ‘(__pid_t)info->siginfo_t::_sifields.siginfo_t::<anonymous union>::_kill.siginfo_t::<anonymous union>::<anonymous struct>::si_pid’ from ‘__pid_t {aka int}’ to ‘long unsigned int’ inside { } [-Werror=narrowing] set_crash_exception_info({info->si_pid, info->si_uid}); ^^^^^^ src/client/linux/minidump_writer/linux_core_dumper.cc:252:71: error: narrowing conversion of ‘(int)info->siginfo_t::_sifields.siginfo_t::<anonymous union>::_sigsys.siginfo_t::<anonymous union>::<anonymous struct>::_syscall’ from ‘int’ to ‘long unsigned int’ inside { } [-Werror=narrowing] set_crash_exception_info({info->si_syscall, info->si_arch}); ^^^^^^^^^^ Since the exception info fields are all uint64_t which should be large enough to handle all the fields in the siginfo_t structure, add casts for all the assignments to avoid these errors. We have implicit casts even without them, so we aren't changing behavior. Bug: google-breakpad:791 Bug: chromium:945653 Change-Id: Ib04e015998f08b857159ac13e9a065a66d228d49 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1544862 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: handle missing SIGSYS supportMike Frysinger2019-03-142-0/+8
| | | | | | | | | | | | If the kernel/C library headers are old, they might not have the fields needed for SIGSYS decoding. Add ifdef checks for that and skip the logic entirely. Easier than adding arch-specific siginfo structs to the codebase. Bug: google-breakpad:791 Change-Id: Ia473e3ffa61fce4c42cf4c1e73a9df044599bc5c Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1524447 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: support setting exception_informationMike Frysinger2019-03-124-1/+76
| | | | | | | | | | | | | | Many signals in Linux support additional metadata on a per-signal basis. We can extract that from NT_SIGINFO and pass it through in the exception_information fields. The current core dumper logic doesn't set exception_information at all, so this is an improvement. Bug: google-breakpad:791 Change-Id: I38b78d6494e9bc682441750d98ac9be5b0656f5a Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1497662 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: add a fallback definition for NT_SIGINFOMike Frysinger2019-03-071-0/+1
| | | | | | | | | | When building on an old system with outdated headers, this define might not be available. Add a fallback to our existing elf header. Bug: google-breakpad:790 Change-Id: I4dfe7a5cebd414cca3582a1a9cfc983503d5a779 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1507073 Reviewed-by: Mark Mentovai <mark@chromium.org>
* linux_core_dumper: support NT_SIGINFO for reading crashing addressMike Frysinger2019-03-031-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | The current core dumper only parses NT_PRSTATUS notes. With signal details, this note only includes three fields: signo, code, and errno. We set exception_code to signo and exception_flag to code. The errno value isn't set by the kernel, so there's no need to save it. However, we never fill in exception_address which means all converted crashes look like they happen at address 0. This implies a NULL jump which is usually not the case, so it's just confusing. The prstatus structure doesn't offer anything directly that tracks this. Starting with linux-3.7, the kernel writes out the full siginfo structure in the NT_SIGINFO note. So lets support that to pull out si_addr which, for a bunch of common signals, is the value we want in exception_address. The size of the siginfo_t structure should be locked to 128 bytes at build time for all architectures, so this should hopefully be stable. Bug: google-breakpad:790 Change-Id: I458bad4787b1a8b73fad8fe068e9f23bec957599 Reviewed-on: https://chromium-review.googlesource.com/c/1497661 Reviewed-by: Mark Mentovai <mark@chromium.org>
* breakpad: Remove semicolons, iOS edition.Nico Weber2019-02-251-1/+1
| | | | | | | Bug: chromium:926235 Change-Id: I237e7b7d89e5746beea80754675a232c881f25f6 Reviewed-on: https://chromium-review.googlesource.com/c/1487336 Reviewed-by: Mark Mentovai <mark@chromium.org>
* breakpad: Remove semicolons, mac edition.Nico Weber2019-02-225-7/+7
| | | | | | | Bug: chromium:926235 Change-Id: I473a7727c1831717b92a582c50d98256ea41d854 Reviewed-on: https://chromium-review.googlesource.com/c/1482716 Reviewed-by: Mark Mentovai <mark@chromium.org>
* breakpad: Remove semicolons.Nico Weber2019-02-211-1/+1
| | | | | | | Bug: chromium:926235 Change-Id: I7f0795ebd651303b6f7fb6981c2f639e17a536bb Reviewed-on: https://chromium-review.googlesource.com/c/1481232 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Delete deprecated SetFirstChanceExceptionHandler functionAndreas Haas2019-02-193-38/+0
| | | | | | | | | | | | | | | This CL removes the code I marked as deprecated in https://crrev.com/c/1411776. I could not delete the code in that CL before I removed all uses in Chrome in https://crrev.com/c/1411643. The tracking bug contains more information. R=mark@chromium.org Bug: chromium:921971 Change-Id: I77597826ef6e69a13ece529a5d24702bc72aa436 Reviewed-on: https://chromium-review.googlesource.com/c/1412353 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Introduce SetFirstChanceHandler with more strict signatureAndreas Haas2019-01-153-3/+40
| | | | | | | | | | | | | | | | | | | Eventually, I want to remove the current version of SetFirstChanceHandler. That is why I changed the name of the current callback type to FirstChanceHandlerDeprecated. I also made sure that it is not possible to have two different FirstChanceHandlers set at the same time. This is the first of a set of CLs to clean up the API between Chrome, BreakPad, and V8. See more information in the tracking bug. R=mark@chromium.org Bug: chromium:921971 Change-Id: Ia8c2fd9bd875c36dd7ae8bb4a02e538556bc67a1 Reviewed-on: https://chromium-review.googlesource.com/c/1411776 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Extract intruction pointer correctly for Windows ARM64Tom Tan2019-01-031-1/+3
| | | | | | | Bug: 893460 Change-Id: Ibbdf734e72c29c4779b6a701dceec1626056a9ba Reviewed-on: https://chromium-review.googlesource.com/c/1393763 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
* Adds method to get the date of the most recent iOS crash report.Evan Bernstein2018-10-084-0/+63
| | | | | | | | Also adds method to determine if breakpad is started. Change-Id: I272765e7ac6bbc07d77ca2d8dcc34d51c205116e Reviewed-on: https://chromium-review.googlesource.com/c/1260625 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
* win: fix formatting after 21c98747Joshua Peraza2018-08-271-1/+1
| | | | | | Change-Id: If50c3563fec7a8a9edf05c22f7d157201184df38 Reviewed-on: https://chromium-review.googlesource.com/1191671 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* win: replace a while loop with a for loopJoshua Peraza2018-08-271-1/+1
| | | | | | | | | This is the recommended resolution to warning C4127. https://msdn.microsoft.com/en-us/library/6t66728h.aspx Change-Id: Ifcffe68e21d9a6383bb9aef07503cbb034caca19 Reviewed-on: https://chromium-review.googlesource.com/1191661 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* Fix Windows client_tests GYP build after 88d8114fda3eMark Mentovai2018-08-151-0/+1
| | | | | | | | Bug: google-breakpad:770 Change-Id: I5539cda6053c39a11c354fba7f3e689ae02d3019 Reviewed-on: https://chromium-review.googlesource.com/1176126 Reviewed-by: Joshua Peraza <jperaza@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Define and use a a new MDRawContextARM64Joshua Peraza2018-08-011-0/+10
| | | | | | | | | | | This struct matches the layout defined by Microsoft and replaces Breakpad's MDRawContextARM64_Old. This CL updates the processor to understand either the old or new structs, but clients continue to write the old structs. Change-Id: I8dedd9ddb2ec083b802723b9ac87beb18d98edbd Reviewed-on: https://chromium-review.googlesource.com/1155938 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Rename MDRawContextARM64 and its context flagsJoshua Peraza2018-08-016-11/+11
| | | | | | | | | | This makes way for the addition of a struct matching Microsoft's layout for ARM64. Change-Id: I115f25290863e7438852691d1ec3c9324a42f7a5 Reviewed-on: https://chromium-review.googlesource.com/1152158 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* mac: Fix broken xcode projectsJoshua Peraza2018-07-311-55/+51
| | | | | | Change-Id: I1cd8f0b0224c9b629dda720c11f6c081b175f8bd Reviewed-on: https://chromium-review.googlesource.com/1157121 Reviewed-by: Mark Mentovai <mark@chromium.org>
* ios: Fix build of exception_handler_no_machJoshua Peraza2018-07-091-1/+1
| | | | | | Change-Id: I2a9f85e78f6d3189f018824ad98e39af30d2ecf8 Reviewed-on: https://chromium-review.googlesource.com/1129465 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
* Initialize variables for MSANSergey Abbakumov2018-04-102-2/+2
| | | | | | | | | | The variables in the CL are not initialized. Even if it's safe not to initialize them here, MSAN doesn't know that. Bug: 394028 Change-Id: I597a7d76aa19d5789decd0f85150fa31c9655269 Reviewed-on: https://chromium-review.googlesource.com/1001573 Reviewed-by: Lei Zhang <thestig@chromium.org>
* Linux: Write out si_code for SIGBUS exceptions.Lei Zhang2018-04-035-11/+26
| | | | | | | | | Store the information in the exception record's exception_information field. Change-Id: Ie215cae2f070fdab63c3d05cc1bc4fb4b7b095fa Reviewed-on: https://chromium-review.googlesource.com/990799 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fixing incorrect include guard (missing #define)Daniel Bratell2018-02-231-0/+1
| | | | | | | | | Noticed while adding an include guard presubmit check in Chromium. Change-Id: I9e677412d881b32a58d695208045b575bb8f8be6 Reviewed-on: https://chromium-review.googlesource.com/934448 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Fix crash when an NSException is thrown.Adam Harrison2018-02-022-11/+10
| | | | | | | | old_handlers is zeroish whenever an NSException is thrown. This caused PROT_WRITE to never be set and resulted in an EXC_BAD_ACCESS when trying to set the handler to NULL. Change-Id: Ibb7da448204431c7602b1001f3a5216303c4c9d1 Reviewed-on: https://chromium-review.googlesource.com/899907 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Extend ifdef to include helper functionsLars Volker2018-01-311-2/+2
| | | | | | | | | | The previous change to fix compiling on Android < N forgot to include a helper in the ifdef, thus not fixing the problem. This change extends the ifdef to include all helpers used by the test. Change-Id: Ibb3030f54a81b5609a0b55ccef387a3cba22d088 Reviewed-on: https://chromium-review.googlesource.com/895240 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Remove barrier to fix Android build.Lars Volker2018-01-311-1/+3
| | | | | | | | | | | The unittest for #752 made use of pthread_barrier_t, which is not supported on Android. This change replaces the barrier code with a simple sleep, which proved sufficient to trigger the race. It only affects the test and does not affect the original fix for #752. Change-Id: I82c32cf00899176fa09089e716ed85850b8711e6 Reviewed-on: https://chromium-review.googlesource.com/895168 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Do not use non-standard stdext::checked_array_iterator with libc++.Peter Collingbourne2018-01-181-1/+1
| | | | | | | Bug: chromium:801780 Change-Id: Id1b0b2330d7d609bda62869bcda5bb2f6fde12bd Reviewed-on: https://chromium-review.googlesource.com/872458 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Only restore the signal handler if sigaction has not changedLars Volker2018-01-092-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restoring the signal handler in ExceptionHandler::SignalHandler() can lead to a race in scenarios where multiple threads crash within a short time. This can cause threads to alternately try to write a minidump without ever terminating the process. The first thread to write a minidump will reset the signal handler to the SIG_DFL using signal() in InstallDefaultHandler(). The next thread to execute SignalHandler() will detect this and will reset the signal handler to SignalHandler(). If the first thread takes too long to write its minidump (e.g. when there are many threads), the chances increase that the second thread will enter SignalHandler() before the first one leaves the critical section. After resetting the signal handler, the second thread will fail to write a minidump (since the file already exists) and will try to reset the signal handler to the default by calling RestoreHandlersLocked(). However, in the meantime the first thread will have entered SignalHandler() again and will overwrite it one more time. After that, no further attempts will be made to restore the default signal handler and both threads will continue to re-raise the signal and attempt to write minidump files. This change adds a check to make sure that cur_handler.sa_sigaction is still pointing to SignalHandler() before re-installing the handler. To test this we start a large number of sleeping threads and two threads that will crash simultaneously. Without the fix, this would reproducibly lead to a loop between the two crashing threads. Bug: 752 Change-Id: I784328cfff17ddc7476d6668354570ab867ba405 Reviewed-on: https://chromium-review.googlesource.com/855137 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Fix minidump on ChromeOSYunlian Jiang2017-12-201-8/+25
| | | | | | | | | | | | | Chrome somehow changed the memory mapping with hugepage enabled. This makes the hack in CrOSPostProcessMappings more general. BUG=chromium:793452 TEST=with this patch on Chromium, minidump_dump *dmp shows the right information on chrome Change-Id: Iff58bf1a712a6e66cbd2d813422db7549a3080a5 Reviewed-on: https://chromium-review.googlesource.com/837963 Reviewed-by: Mark Mentovai <mark@chromium.org>
* Reconcile -[BreakpadController withBreakpadRef:] with its documentation.Robert Sesek2017-12-151-3/+1
| | | | | | | | | | The header states that if the controller is not -start:'ed that it will call the block with a NULL BreakpadRef. As previously implemented, it asserted if it was not started. Change-Id: I3a329a773c0484dc1b74013717b68426758ea2cd Reviewed-on: https://chromium-review.googlesource.com/829834 Reviewed-by: Mark Mentovai <mark@chromium.org>