51 Commits

Author SHA1 Message Date
Avi Drissman
9e37dc46b6 Convert Crashpad to use ARC
See
https://chromium.googlesource.com/chromium/src/+/main/docs/mac/arc.md
for information about this conversion.

Bug: chromium:1280726
Change-Id: I9ed10e9a255eb6b13035b05bcc587c4b6cb7b78e
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4651106
Reviewed-by: Mark Mentovai <mmentovai@google.com>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2023-06-30 15:55:24 +00:00
Mark Mentovai
6278690abe Update copyright boilerplate, 2022 edition (Crashpad)
sed -i '' -E -e 's/Copyright (.+) The Crashpad Authors\. All rights reserved\.$/Copyright \1 The Crashpad Authors/' $(git grep -El 'Copyright (.+) The Crashpad Authors\. All rights reserved\.$')

Bug: chromium:1098010
Change-Id: I8d6138469ddbe3d281a5d83f64cf918ec2491611
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3878262
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2022-09-06 23:54:07 +00:00
Ben Hamilton
ed8cfeb2cd [snapshot] Add support for thread names
This CL adds a new method ThreadSnapshot::ThreadName(), implements
it in each snapshot implementation, and adds tests for iOS, macOS,
Linux, Windows, and Fuchsia.

Bug: crashpad:327
Change-Id: I35031975223854c19d977e057dd026a40d33fd41
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3671776
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Ben Hamilton <benhamilton@google.com>
Reviewed-by: Ben Hamilton <benhamilton@google.com>
2022-06-13 20:58:37 +00:00
David Fang
d5d78c1469 [third_party] Make mini_chromium relocatable
This will accommodate moving third_party/mini_chromium around.
The default location is unchanged for now.

There are GN variables that may need to be updated when Fuchsia's source
re-organizes its layout:

* mini_chromium_source_parent : this contains a BUILD.gn with groups and
encloses the mini_chromium_source_root.  This is controlled by the
structure of the project that depends on this project.

* _mini_chromium_source_root : this is what is normally checked out from
git, the upstream source directory

* mini_chromium_import_root : points inside source_root to make GN files
accessible.

This first step breaks out case logic for "if (crashpad_is_in_fuchsia)"
even if the value is unchanged for now.  This will faciliate a smaller
change when Fuchsia re-structures third_party sources.

Change-Id: I09e5362f4be8fdb440e3891422881b1053052341
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3062424
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2021-08-11 15:26:03 +00:00
Nico Weber
0e03f8e7fa Remove now-no-op set_sources_assignment_filter calls
After https://chromium-review.googlesource.com/c/chromium/src/+/2426564,
not having a sources assignments filter is the default.

No behavior change.

Bug: chromium:1018739
Change-Id: Ia2e6af0d613d3cbdfe6595bfe1f688c1efd55f39
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2446269
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-10-02 17:43:39 +00:00
Suraj Malhotra
e3c94b87f0 [fuchsia] Move //zircon/system/ulib/fdio to //sdk/lib/fdio
Bug: fuchsia:54057
Change-Id: I58e2bbf7f3a1674d5b34d4bc502b85cee0bea347
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2253148
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2020-07-10 18:43:55 +00:00
Mark Mentovai
828095ac32 Clear the gn sources_assignment_filter when building in Chromium
Chromium relies on a global gn sources assignment filter, even though
it’s kind of discouraged. Crashpad doesn’t use this, instead selecting
which files to build entirely with the logic in its .gn files. In some
cases, Chromium’s filters prevent _linux files from building on Android,
and _mac files from building on iOS, even though Crashpad’s build has
explicitly requested these inclusions. To overcome this problem,
clear the gn sources_assignment_filter in all of Crashpad’s own .gn
files when building in Chromium.

Change-Id: Iab0af29f4e5aff4be8eec2ee12b2e3f991c0a86d
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2285959
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
2020-07-08 04:29:24 +00:00
Mark Mentovai
a45eea40fc Update gtest to e3f0319d89f4cbf32993de595d984183b1a9fc57
I’m most interested in picking up 1b3eb6ef3462, “Explicitly define copy
constructors used in googletest tests.”

This also reorganizes files and rewrites text to refer to this project
as Google Test and googletest (and Google Mock and googlemock), as it
prefers to be known. Some filenames are left at gtest_* following the
precedent set by gtest itself. For example, #include "gtest/gtest.h" is
still used, so #include "test/gtest_death.h" is retained too.
gtest_all_test OutputFileHelpersTest.GetCurrentExecutableName hard-codes
the expected executable name as gtest_all_test among other options that
do not include googletest_all_test, so test executables retain their
names as well.

fb19f57880f6 Add GTEST_BRIEF option
3549237957a1 Ensure that gtest/gmock pkgconfig requirements specify
             version
189299e957bb Merge branch 'master' into quiet-flag
5504ded3ab5c Fix a typo in .travis.yml
6ed4e7168f54 Replace the last instance of `throw()` with `noexcept`. NFC
879fd9b45299 Remove duplicate codes existed in get-nprocessors.sh
644f3a992c28 gtest-unittest-api_test - fix warning in clang build
0b6d567619fe Remove redundant .c_str()
be3ac45cf673 fix signed/unsigned comparison issue (on OpenBSD)
b51a49e0cb82 Merge pull request #2773 from Quuxplusone:replace-noexcept
c2032090f373 Merge pull request #2772 from Quuxplusone:travis
4fe5ac53337e Merge pull request #2756 from Conan-Kudo:fix-pkgconfig-reqs
373d72b6986f Googletest export
4c8e6a9fe1c8 Merge pull request #2810 from ptahmose:master
71d5df6c6b67 Merge pull request #2802 from e-i-n-s:fix_clang_warning
dcc92d0ab6c4 Merge pull request #2805 from pepsiman:patch-1
4f002f1e236c VariadicMatcher needs a non-defaulted move constructor for
             compile-time performance
9d580ea80592 Enable protobuf printing for open-source proto messages
766ac2e1a413 Remove all uses of GTEST_DISALLOW_{MOVE_,}ASSIGN_
11b3cec177b1 Fix a -Wdeprecated warning
01c0ff5e2373 Fix a -Wdeprecated warning
c7d8ec72cc4b Fix a -Wdeprecated warning
1b066f4edfd5 Add -Wdeprecated to the build configuration
4bab55dc54b4 Removed a typo in README.md
a67701056425 Googletest export
fb5d9b66c5b0 Googletest export
1b3eb6ef3462 Googletest export
b0e53e2d64db Merge pull request #2797 from Jyun-Neng:master
d7ca9af0049e Googletest export
955552518b4e Googletest export
ef25d27d4604 Merge pull request #2815 from Quuxplusone:simple
129329787429 Googletest export
b99b421d8d68 Merge pull request #2818 from inazarenko:master
472cd8fd8b1c Merge pull request #2818 from inazarenko:master
3cfb4117f7e5 Googletest export
0eea2e9fc634 Googletest export
a9f6c1ed1401 Googletest export
1a9c3e441407 Merge pull request #2830 from keshavgbpecdelhi:patch-1
e589a3371705 Merge pull request #2751 from calumr:quiet-flag

Change-Id: Id788a27aa884ef68a21bae6c178cd456f5f6f2b0
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2186009
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-05-07 14:56:07 +00:00
Mark Mentovai
ba24acb86c ios: Split bootstrap out from mach_extensions
mach_extensions is sensible on iOS, but bootstrap is not available
outside of macOS. To allow mach_extensions to be used cleanly on iOS,
the bootstrap code is moved into its own macOS-specific file.

Bug: crashpad:31
Change-Id: I7bf9d5194253b563954a1e55fbf67a16f686e8ff
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154529
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-17 20:54:47 +00:00
Mark Mentovai
122a400d7b ios: Enable (and test!) more of util and test
This builds some code in the util and test libraries on iOS that was
previously excluded. It also enables tests for this code, and other
tests that it was possible to enable either previously or as a result of
this change.

Previously, crashpad_util_test ran 178 tests from 46 test suites, and
crashpad_test_test ran 2 tests from 2 test suites. Now,
crashpad_util_test runs 284 tests from 62 test suites, and
crashpad_test_test runs 6 tests from 4 test suites.

The related .gn files also suffered through a slight cleanup.

Bug: crashpad:31
Change-Id: I84cdda5631f0ea4888ada902a8462776ac46fd2a
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2154526
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2020-04-17 20:54:17 +00:00
Joshua Peraza
c4cc4e6ac9 android: initialize signal dispositions
Bionic installs signal handlers which request crash
dumps from Android's debuggerd, but there are errors
in how signals which aren't automatically re-raised
are handled on Marshmallow (API 23).

Before requesting a dump, Bionic acquires a lock to
communicate with debuggerd and expecting imminent
death, never releases it.

While handling the dump request, debuggerd allows
the dying process to continue before
ptrace-detaching it. So, when Bionic manually
re-raises a signal, it is intercepted by debuggerd
and the dying process is allowed to live.

Bionic restores SIG_DFL for the signal it's just
handled, but if a different crash signal is later
recieved, Bionic attempts to reacquire the lock to
communicate with debuggerd and blocks forever.

Disable Bionic's signal handlers for these signals
on Marshmallow.

Bug: chromium:1050178
Change-Id: Ia1fc5a24161a95931684d092ba8fee2f0dfbbdbb
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2134513
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-04-08 17:21:05 +00:00
Rohit Rao
39116ab723 Adds support for running iOS unittests via XCTest.
Using XCTest allows us to drive tests from the commandline via
xcodebuild, and it also simplifies running tests on physical devices.

Tests put themselves into "XCTest-mode" if the
"XCTestConfigurationFilePath" environment variable is present.  This
variable is only set when XCTests are running.

Change-Id: If55199a7470f0479f107097eef1dfb1a705015e9
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2033427
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-31 20:14:04 +00:00
Nico Weber
2fd16e3392 Reformat all gn files
Port of chromium-side
https://chromium-review.googlesource.com/c/chromium/src/+/1997899

Bug: chromium:1041419
Change-Id: Ic7afefa0dea024da37fe4bb0f965840a160e2166
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2015428
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-23 13:59:00 +00:00
Rohit Rao
54bbd7d0d5 Adds support for running GTests on iOS.
iOS needs to run tests from within the context of a UIApplication, and
it needs to periodically spin the runloop to ensure that the watchdog
does not kill the app for being unresponsive.

BUG=crashpad:31

Change-Id: Ia1d881e478d4f83c236b475a21529760c06100c7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1904226
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2020-01-07 17:08:53 +00:00
Rohit Rao
bd1aa246ca Starts compiling the crashpad_test_test target on iOS.
Brings up the subset of tests that pass on iOS without any modifications.
Additional tests will be added later as they are updated to pass on iOS.

Excludes non-compiling targets from the iOS build so that the default target
compiles cleanly.

Rolls mini_chromium to cdab1e6263ec7f3f61763efc1dac863f8dc07c80.
  2019-11-01 rohitrao Adds GN support for XCTest on iOS.
  2019-10-29 rohitrao Fixes for iOS compilation and running on iOS devices.

BUG=crashpad:31

Change-Id: I918f10fc941b37fa89b08ce87828dd4299437096
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1895905
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
2019-11-07 16:55:37 +00:00
Mark Mentovai
c009b85449 Use GTEST_SKIP() instead of custom DISABLED_TEST()
Since gtest 00938b2b228f, gtest has built-in first-class support for
skipping tests, which is functionally identical (at least in Crashpad’s
usage) to the home-grown support for run-time dynamically disabled tests
introduced in Crashpad 5e9ed4cb9f69.

Use the new standard pattern, and remove all vestiges of the custom
local one.

This was done previously in 79f4a3970a64, but was reverted in
bba9d0819c12 because Chromium’s test launcher did not support
GTEST_SKIP() at the time. The deficiency is on file as
https://crbug.com/912138.

While that bug was never specifically marked as “fixed” and I haven’t
found what changed in Chromium, I do now see some use of GTEST_SKIP() in
Chromium. I also prototyped this change in Chromium at
https://chromium-review.googlesource.com/c/1854691/ and found that
GTEST_SKIP() does indeed now appear to work.

Change-Id: I13fef8fe8bfd9854a40dfa5910a3282d1a85bc45
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1855380
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-10-11 16:45:34 +00:00
Francois Rousseau
0730f0c60c [fuchsia] rename gn group to fuchsia
now that we import fuchsia-sysinfo and fdio, this isn't really just zx anymore

Change-Id: Ic42359ce3d230e214ebdbbefb880ccb021434a0f
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1555533
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Francois Rousseau <frousseau@google.com>
2019-04-05 23:33:12 +00:00
Mark Mentovai
bba9d0819c Revert "Use GTEST_SKIP() instead of custom DISABLED_TEST()"
This reverts commit 79f4a3970a6425ef0475263974bf9a012279ba4f.

Chromium’s test launcher is not prepared to handle GTEST_SKIP().

Bug: chromium:912138
Change-Id: Iaeffaedcd92093ec61b013f2a919dc4670094581
Reviewed-on: https://chromium-review.googlesource.com/c/1464099
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2019-02-11 17:12:40 +00:00
Mark Mentovai
79f4a3970a Use GTEST_SKIP() instead of custom DISABLED_TEST()
Since gtest 00938b2b228f3, gtest has built-in first-class support for
skipping tests, which is functionally identical (at least in Crashpad’s
usage) to the home-grown support for run-time dynamically disabled tests
introduced in Crashpad 5e9ed4cb9f69.

Use the new standard pattern, and remove all vestiges of the custom
local one.

Change-Id: Ia332136c356d523885fc5d86bc8f06fefbe6a792
Reviewed-on: https://chromium-review.googlesource.com/c/1427242
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2019-01-22 21:00:06 +00:00
Vlad Tsyrklevich
a9be1b1403 Add ProcessMemoryWin and re-factor tests
Currently, ProcessMemory is only implemented for Linux and Fuchsia.
Implement the interface for Windows as well and re-factor tests to
support it, mostly this consists of using a new ScopedGuardedPage class
instead of ScopedMmap in the ProcessMemory tests.

BUG=crashpad:262

Change-Id: I1b42718972be5ad838d12356d09f764053f09e4f
Reviewed-on: https://chromium-review.googlesource.com/c/1278829
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-11-05 21:33:35 +00:00
Wez
bc50af15a2 Migrate from ScopedZxHandle to libzx containers.
Bug: chromium:852541
Change-Id: Ie05c70f249e6f843183a02ec61fd09f6a0607598
Reviewed-on: https://chromium-review.googlesource.com/1148923
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
2018-08-01 17:38:19 +00:00
Adam Barth
1299754179 fuchsia: Migrate off launchpad
Rather than using liblaunchpad.so to create processes, we now use
fdio_spawn.

Bug: crashpad:196
Change-Id: I28a7c12c823f0a0d120962edfce2e2197302b9cb
Reviewed-on: https://chromium-review.googlesource.com/1080234
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2018-05-31 04:01:08 +00:00
Scott Graham
31703a585f fuchsia: When in Fuchsia tree, disable tests requiring external files
The package deployment/running is in flux at the moment. In order to get
all the other tests on to the main Fuchsia waterfall, disable the ~25
tests that require external files (for launching child processes,
loading modules, or data files) because those operations all fail on
Fuchsia-without-packages right now. Upstream this is PKG-46. Once test
packaging and running has been resolved, this can be reverted.

These tests are still run when building Crashpad standalone on Fuchsia
as the standalone build simply copies all the relevant data files to the
device in /tmp.

Bug: crashpad:196
Change-Id: I1677c394a2b9d709c59363ebeea8aff193d4c21d
Reviewed-on: https://chromium-review.googlesource.com/1045547
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-05-05 00:27:22 +00:00
Scott Graham
7274c9823f fuchsia: Various build fixes for building in Fuchsia tree
- Use "deprecated_system_image" (merging from downstream)
- Add package for crashpad_handler
- Depend on launchpad target instead of a lib when in tree, as launchpad
  is no longer in the sysroot.
- Don't try to remove the -Wexit_time_destructors unless building
  standalone, when it's added by mini_chromiums BUILDCONFIG.gn

Bug: crashpad:196
Change-Id: I08e0faaa989346b078a41896eb4ace69e7b1bcdc
Reviewed-on: https://chromium-review.googlesource.com/1026514
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-04-24 22:34:20 +00:00
Fabrice de Gans-Riberi
74a56c256b Prepare for removal of is_posix from the Fuchsia build
This also rolls crashpad/third_party/mini_chromium/mini_chromium/ d42eb4101..6e0fdb2e4 (2 commits)
d42eb41012..6e0fdb2e49

$ git log d42eb4101..6e0fdb2e4 --date=short --no-merges --format='%ad %ae %s'
2018-04-04 scottmg@chromium.org Repair Linux-with-sysroot build after clang update
2018-04-04 fdegans Prepare for |is_posix| switch in the Fuchsia build

Created with:
  roll-dep crashpad/third_party/mini_chromium/mini_chromium

Bug: chromium:812974
Change-Id: I3d8efc3124c97981eda63f104a7adfb670babab7
Reviewed-on: https://chromium-review.googlesource.com/988231
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-04-04 22:18:25 +00:00
Joshua Peraza
5754f608cb android: unset source filters to use linux files
Also disable testing reading AT_ENTRY on Android.

Bug: crashpad:30
Change-Id: I10353bbbb3ff28721a2c05d69463df5eac4df281
Reviewed-on: https://chromium-review.googlesource.com/980811
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-27 02:19:39 +00:00
Joshua Peraza
9c89cd99f3 gn: add templates for executables and loadable_modules
When building in chromium, executables and loadable_modules should
depend on:
//build/config:exe_and_shlib_deps
which, among other things, may be needed to introduce a
dependency on a custom libc++.

Bug: crashpad:30
Change-Id: Ic46a3cf5b46bdac09cca22950f9236e0776ba44a
Reviewed-on: https://chromium-review.googlesource.com/974713
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-03-23 16:50:58 +00:00
Joshua Peraza
0520fdff1e linux: Move ScopedPrSetPtracer to util/
CrashpadClient will need ScopedPrSetPtracer when launching a handler
process in response to a crash.

Bug: crashpad:30
Change-Id: I35bc784b948349ca771f9cd65ef1089e626976bb
Reviewed-on: https://chromium-review.googlesource.com/927352
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2018-02-20 21:26:42 +00:00
Scott Graham
f9d160ffc6 Revert "Reset CrashpadInfo after CrashpadInfoReader tests"
This reverts commit 4717300fa4cefadeabef64346ba65aa8759d43b8.

Reason for revert: When used in with the size-testing fake CrashpadInfo's, this can overwrite past the end of them.

Original change's description:
> Reset CrashpadInfo after CrashpadInfoReader tests
> 
> Not resetting these was causing CrashpadInfoClientOptions tests to fail
> on Fuchsia, because dlclose() [legally] doesn't do anything, so
> modifying the current binaries CrashpadInfo caused the expected values
> from child .sos to be ignored. That could be worked around in that test
> too, but it's probably better to clean up the global state in this test
> anyway.
> 
> Bug: crashpad:196
> Change-Id: Ia8119ac7c554bea81e8373e2547faf192c629122
> Reviewed-on: https://chromium-review.googlesource.com/923178
> Commit-Queue: Scott Graham <scottmg@chromium.org>
> Reviewed-by: Joshua Peraza <jperaza@chromium.org>

TBR=scottmg@chromium.org,jperaza@chromium.org

Change-Id: Ia6d8db1ba24c82bb9346210ac8b66d80f42a6925
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: crashpad:196
Reviewed-on: https://chromium-review.googlesource.com/923541
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-02-16 03:41:10 +00:00
Scott Graham
4717300fa4 Reset CrashpadInfo after CrashpadInfoReader tests
Not resetting these was causing CrashpadInfoClientOptions tests to fail
on Fuchsia, because dlclose() [legally] doesn't do anything, so
modifying the current binaries CrashpadInfo caused the expected values
from child .sos to be ignored. That could be worked around in that test
too, but it's probably better to clean up the global state in this test
anyway.

Bug: crashpad:196
Change-Id: Ia8119ac7c554bea81e8373e2547faf192c629122
Reviewed-on: https://chromium-review.googlesource.com/923178
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2018-02-16 03:20:59 +00:00
Scott Graham
14dbd3531d gn win: Get main test binaries building
- default to subsystem:console
- don't build posix/timezone.*
- add some missing libs

This gets all the main binaries building and running. Most configs pass,
but there's some offsets that seem different in some builds; need to
investigate more. Additionally, the binaries used by end_to_end_test.py
aren't yet built, so that script fails.

Includes mini_chromium roll to 46eeaf9:
46eea49 gn win: Add debug info and pdb to cc/cxx
902a29f gn win: Various fixes towards making GN build work

Bug: crashpad:79
Change-Id: Ie56a469b84bed7b0330172cec9f1a8aeb95f702e
Reviewed-on: https://chromium-review.googlesource.com/902403
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-02-06 19:12:18 +00:00
Scott Graham
48abd4a60f Add CRASHPAD_CHILD_TEST_MAIN() helper for multiprocess tests
Extends MultiprocessExec to support running functions registered via
CRASHPAD_CHILD_TEST_MAIN() as the main of a new child process.

Additionally, implements Fuchsia exit code checking, and adds a
CRASHPAD_CHILD_TEST_MAIN()-based test for that.

Bug: crashpad:196, crashpad:215
Change-Id: I49ce3f4d95a3b9823813e6df5a602cee2583bcf8
Reviewed-on: https://chromium-review.googlesource.com/879563
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-25 22:59:20 +00:00
Scott Graham
dea19c7374 fuchsia: Port ElfImageReader and (some of) its tests
(Still need to avoid fork()-dependence for the non-self tests.)

Bug: crashpad:196
Change-Id: Ib34fe33c7ec295881c1f555995072d9ff742647f
Reviewed-on: https://chromium-review.googlesource.com/876650
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-19 22:22:21 +00:00
Scott Graham
f62a30e977 fuchsia: Implementation of MultiprocessExec
This supports multiprocess tests of the non-fork() variety.

Also, improve directory finding so that the
crashpad_test_test_multiprocess_exec_test_child binary can be located
correctly on Fuchsia.

Doc ref for launchpad:
https://fuchsia.googlesource.com/zircon/+/master/system/ulib/launchpad/include/launchpad/launchpad.h#23

Also, roll mini_chromium to pick up ScopedZxHandle addition. Includes:
a19ef08 Merge ScopedZxHandle from Chromium base
f21c900 fuchsia: Move zircon libs dep to base, rather than global

Bug: crashpad:196
Change-Id: Id01dee43f2d04e682e70c12777aff41f8dd848d6
Reviewed-on: https://chromium-review.googlesource.com/868967
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2018-01-17 23:45:42 +00:00
Scott Graham
380a1e9eaf Make multiprocess_exec_test_child depend on base to get OS_ defines
Some doofus really wanted to shoot himself in the foot (
https://codereview.chromium.org/808493003/diff/80001/util/test/multiprocess_exec_test_child.cc
), and it worked.

Depend on base to get build_config.h instead, so that OS_POSIX is also
set on Fuchsia.

Also, don't call getrlimit() on Fuchsia.

Bug: crashpad:196
Change-Id: I102de22751fd90889bfb59b6c4a577e99357094b
Reviewed-on: https://chromium-review.googlesource.com/868742
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2018-01-17 18:28:22 +00:00
Mark Mentovai
7a285816e9 gn, android: Build for Android with GN
With a companion mini_chromium change at https://crrev.com/c/841203,
it’s possible to configure via “gn args” as follows:

android_ndk = "/android/android-ndk-r16"
target_cpu = "x86_64"
target_os = "android"

Note that a standalone toolchain is not required.

Bug: crashpad:30, crashpad:79
Change-Id: Ica55bdcb82c730909c05dd9fecb40a74eca78c8a
Reviewed-on: https://chromium-review.googlesource.com/841286
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-12-22 21:23:31 +00:00
Scott Graham
ab153f7e1b gn: Avoid depending on BUILDCONFIG.gn globals
Goes with https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/834648.

Includes mini_chromium DEPS roll to pull in edfe51ce81

Bug: crashpad:79, crashpad:196
Change-Id: Ib45cc738aecf9ae727f8faeff81f3b71e2dc9de8
Reviewed-on: https://chromium-review.googlesource.com/834543
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-19 23:38:36 +00:00
Mark Mentovai
3a41c51668 gn, linux: Update build after 9b2ba587f618
Bug: crashpad:30, crashpad:79
Change-Id: Ib50352cfd36d40786b9732e7c4ab50781963369b
Reviewed-on: https://chromium-review.googlesource.com/835028
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-12-19 22:36:22 +00:00
Mark Mentovai
99b0030616 gn, linux: Build for Linux with GN
This is sufficient for a native Linux build using GN. Android is not yet
supported.

mini_chromium side: https://crrev.com/c/833407

This also updates mini_chromium to 404f6dbf9928.

c913ef97a236 gn, linux: Build for Linux with GN
404f6dbf9928 gn: Don’t use .rsp files; rationalize descriptions and
             output dirs

Bug: crashpad:79
Change-Id: I4f3b72fd02884d77812e520fb95231b35815677d
Reviewed-on: https://chromium-review.googlesource.com/833408
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-12-19 19:31:20 +00:00
Scott Graham
1bc07b76ed gn: Use mini_chromium_is_posix in preference to global is_posix
Goes with
https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/833328.

Also roll mini_chromium:

scottmg@around:/work/crashpad/crashpad/third_party/mini_chromium/mini_chromium$ git log 20182dd263312db9fad52042fc92c33331ec6904..e182031 --oneline
e182031 gn: Add is_posix.gni to define local is_posix variable
4cb1344 gn: Enable proper release-mode optimizations for POSIX-non-Mac
9c0eb0c Remove reference to ptr_util.h
c5ae5aa gn: Configure the sysroot in target_sysroot, not sysroot
f7e5654 gn, mac: Honor mac_sdk_min, sysroot, and mac_deployment_target
7701901 Remove the deprecated sparse_histogram.h header.
e2f0160 Use Chromium copyright notice and BSD license in mini_chromium


Bug: crashpad:79, crashpad:196
Change-Id: Ie41d971e0e769db2ed18861da07021c071f6c650
Reviewed-on: https://chromium-review.googlesource.com/833329
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-19 00:07:06 +00:00
Scott Graham
457cc6a34f gn: Refactor build files to avoid build/secondary
In doing standalone bringup of Crashpad targeting Fuchsia, it seemed
tidy to keep the same literal paths to the dependencies that Chromium
needed and add stubs/forwarding to build/secondary in the Crashpad tree
as required to make those work.

However, when trying to build Crashpad in the Fuchsia tree itself, that
would require adding forwarding files to the Fuchsia tree to match the
Chromium directory structure, which would be awkward. Instead, have
explicit dependencies in the Crashpad tree that select the locations
for various dependencies.

Bug: crashpad:79, crashpad:196
Change-Id: Ib506839f9c97d8ef823663cdc733cbdcfa126139
Reviewed-on: https://chromium-review.googlesource.com/826025
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-18 22:53:58 +00:00
Mark Mentovai
e0f3963131 Sever the connection between the test support library and snapshot
This dependency was created in 107fb7631788 for macOS, but it’s not used
on other platforms. Since the test support library is broadly used to
test all of Crashpad, it’s useful even during early-stage porting. The
snapshot library is a higher-level module that builds upon other
components, and is not likely to be functional until the later stages of
porting. Expressing this dependency artifically makes it difficult to
test ports in development.

Change-Id: I9dc2e2c473c8519b4c2b0d774acc9c146ee4e121
Reviewed-on: https://chromium-review.googlesource.com/811564
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-12-06 18:27:24 +00:00
Scott Graham
741a84a298 fuchsia: Add runner, get crashpad_test_test building and running
- Implement build/run_tests.py to run on Fuchsia device
- Implement paths_fuchsia.cc using standard Fuchsia namespace layout
- Exclude multiprocess tests, currently unimplemented
- Don't use unnecessary O_ flags on Fuchsia in open() call.

Bug: crashpad:196, chromium:726124, ZX-797
Change-Id: Ie59dce685b4c3fe54f3e36f357c1101d402ee8b7
Reviewed-on: https://chromium-review.googlesource.com/802180
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-05 18:59:26 +00:00
Scott Graham
eeb31321f7 gn, fuchsia: Add //testing forwarding and GN build file
third_party/gtest/BUILD.gn mostly written by rsesek.

Also includes DEPS roll of mini_chromium for Wexit_time_destructors config.

$ git log --oneline dd0c3e96..fa146c12
fa146c1 (HEAD, origin/master, origin/HEAD) gn: Extract Wexit-time-destructors into separate config
95bfddb fuchsia: Fix base::RandBytes() after 5a1c5f82ce75
b79608a fuchsia: Use llvm-ar from the Fuchsia clang package
c34725b fuchsia: Look for the toolchain and SDK in per-build-host directories
e8e1ee4 fuchsia: Don't assume that kernel will provide all requested rand bytes
5a1c5f8 fuchsia: Implement RandBytes()
df359ca fuchsia: Enable -fPIC
bd50c95 Restore accidentally changed license
a70db15 Improvements to GN build config
7de4d23 fuchsia: Fix compile of base/logging.cc
25a8b57 Add link GN rules to non-win build, set c++14 in CC flags.
7d15806 fuchsia: The very basics of compiling mini_chromium/base with GN

Bug: crashpad:79, crashpad:196
Change-Id: I3e741f185b028a96705eefc1f993037830d97448
Reviewed-on: https://chromium-review.googlesource.com/797414
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-11-30 20:58:46 +00:00
Scott Graham
7e9dbd53fb fuchsia: Misc fixes to get more pieces compiling
- Some missed set_sources_assignment_filters if'ing
- Exclude posix/symbolic_constants_posix.(h|cc) as they don't compile and
  won't be necessary
- Exclude a handful of other posix files that don't make sense on Fuchsia.

Bug: crashpad:196
Change-Id: I9ec985f00488267dc104164445c6cc5bca36a1fc
Reviewed-on: https://chromium-review.googlesource.com/798220
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-30 18:33:55 +00:00
Mark Mentovai
d25b0242c6 gn: Fix a couple of things after 9465fc72ad90 and 2bb56fafe3bd
When I redid the Crashpad GN build a few weeks ago
(https://chromium-review.googlesource.com/c/chromium/src/+/751403), I
tried to order things according to the GN style guide
(https://chromium.googlesource.com/chromium/src/tools/gn/+/HEAD/docs/style_guide.md).
As for conditionals, I tried to stick to doing a set of conditionals
after “sources” for just “sources”, and then another one at the bottom
for everything else.

It turns out that this was a good idea because it’s an error to say
“deps += [something]” inside a conditional until you’ve already said
“deps = [something_else]” first. (Maybe that’s why I did it.)
9465fc72ad90 regressed this.

2bb56fafe3bd also left behind a couple of straggler paths that were
absolute to Chromium’s root but should have been made relative.

This also fixes a comment (about something that won’t yet work outside
of Chromium anyway, but still…)

Bug: crashpad:79
Change-Id: I8a6f84bfad368cbcdae4fbff11f1d00e2af14b93
Reviewed-on: https://chromium-review.googlesource.com/798172
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-11-29 23:40:18 +00:00
Scott Graham
9465fc72ad gn: Move sources out to explicit blocks
This avoids relying on set_sources_assignment_filter, and so gets closer
to a correct set of files to build on Fuchsia.

Bug: crashpad:79, crashpad:196
Change-Id: Ib7daa5137935113c6645b72eb1dedd943a9db96e
Reviewed-on: https://chromium-review.googlesource.com/797672
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-11-29 20:36:48 +00:00
Scott Graham
2bb56fafe3 Rework GN files to start to support building standalone, and also in Chromium
- Adds a .gn and a build/BUILDCONFIG.gn that uses mini_chromium's
  build/BUILD.gn.
- Adds some stub BUILD.gn files in locations where Chromium expects them
  (in //build, //testing, //third_party) containing empty targets/configs.
  These are no-ops in standalone builds, but add functionality when
  building in Chromium.  This is in preference to having a global bool
  that conditionally does Chromium-y things in the Crashpad build files.
  These stub files are all contained in a secondary source root in
  build/chromium_compatibility, referred to by //.gn.
- Adds //base/BUILD.gn which forwards to mini_chromium/base. This is
  only used when building standalone so that both Chromium and Crashpad
  can refer to it as "//base".
- Changes references to other Crashpad targets to be relatively
  specified so that they work when the root of the project is //, and also
  when it's //third_party/crashpad/crashpad as it is in Chromium.
- Moves any error-causing Mac/Win-specific files into explicit if (is_mac)
  or if (is_win) blocks as part of removing the dependency on
  set_sources_assignment_filter().

As yet unresolved:
- CRASHPAD_IN_CHROMIUM needs to be removed when standalone; to be tackled
  in a follow up.
- Not sure what to do with zlib yet, the build file currently assumes
  "in Chromium" too, and similarly having Crashpad //third_party/zlib:zlib
  pointing at itself doesn't work.

Bug: crashpad:79
Change-Id: I6a7dda214e4b3b14a60c1ed285267ab97432a1a8
Reviewed-on: https://chromium-review.googlesource.com/777410
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-11-28 20:29:35 +00:00
Mark Mentovai
cd1d773a40 mac: Run the exception swallower server in the parent test process
The exception swallower server’s design and interface are both
considerably simpler when the server runs in a thread in the parent test
process, as opposed to a separate process. The only caveat is that this
results in calls to fork() while threaded. Uses of gtest
{ASSERT,EXPECT}_DEATH with the default “fast” gtest death test style
result in this warning:

[WARNING] ../../third_party/gtest/gtest/googletest/src/gtest-death-test.cc:836:: Death tests use fork(), which is unsafe particularly in a threaded context. For this test, Google Test detected 2 threads.

Bug: crashpad:33
Change-Id: Ib8f418064ea4ab942859c3393cb15cf71365614d
Reviewed-on: https://chromium-review.googlesource.com/779481
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-11-20 19:42:14 +00:00
Mark Mentovai
94a5a72efa mac: Tests that crash intentionally shouldn’t go to ReportCrash
Crashpad has many tests that crash intentionally. Some of these are
gtest death tests, and others arrange for intentional crashes to test
Crashpad’s own crash-catching logic. On macOS, all of the gtest death
tests and some of the other intentional crashes were being logged by
ReportCrash, the system’s crash reporter. Since these reports
corresponded to intentional crashes, they were never useful, and served
only to clutter ~/Library/Logs/DiagnosticReports.

Since Crashpad is adept at handling exceptions on its own, this
introduces the “exception swallowing server”,
crashpad_exception_swallower, which is a Mach exception server that
implements a no-op exception handler routine for all exceptions
received. The exception swallowing server is established as the task
handler for EXC_CRASH and EXC_CORPSE_NOTIFY exceptions during gtest
death tests invoked by {ASSERT,EXPECT}_DEATH_{CHECK,CRASH}, and for all
child processes invoked by the Multiprocess test infrastructure. The
exception swallowing server is not in effect at other times, so
unexpected crashes in test code can still be handled by ReportCrash or
another crash reporter.

With this change in place, no new reports are generated in the
user-level ~/Library/Logs/DiagnosticReports or the system’s
/Library/Logs/DiagnosticReports during a run of Crashpad’s full test
suite on macOS.

Bug: crashpad:33
Change-Id: I13891853a7e25accc30da21fa7ea8bd7d1f3bd2f
Reviewed-on: https://chromium-review.googlesource.com/777859
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-11-20 18:58:34 +00:00