1106 Commits

Author SHA1 Message Date
Scott Graham
15c4fff902 Get crashpad_client_test and crashpad_handler_test building
Stubs a variety of classes (CrashReportExceptionHandler,
ExceptionHandlerServer, HTTPTransport, CrashReportDatabase).

Bug: crashpad:196
Change-Id: I4772f90d0d2ad07cc2f3c2ef119e92fde5c7acef
Reviewed-on: https://chromium-review.googlesource.com/809940
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-12-06 18:39:24 +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
Mark Mentovai
612237a032 android: Fix 32-bit test to build at API [21, 24) with unified headers
Although API 21 introduced support for 64-bit off_t in many system calls
or their wrappers, <stdio.h> support for 64-bit off_t is absent until
API 24.

This is a partial revert of 5969d6b1eb22, because with this more
targeted fix applying only to gtest, the rest of Crashpad will work with
a 64-bit off_t even at API levels lacking NDK support by going through
the mmap() shim in compat.

This includes a mini_chromium update to 96e32dd499a4.

85cbec19ffc0 fuchsia: Make EINTR macros no-ops
fbf410cd4d40 fuchsia: Use koid instead of getpid() for process field in
             logging
96e32dd499a4 Revert "android: Don’t use _FILE_OFFSET_BITS=64 until API
             21"

Bug: crashpad:211
Change-Id: I34c3c8b42eb315605e6775962b44c3c4573b7462
Reviewed-on: https://chromium-review.googlesource.com/811204
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-12-06 18:05:37 +00:00
Scott Graham
6719610b8c fuchsia: Get crashpad_snapshot_test building
ProcessSnapshotFuchsia is just a stub, so running fails immediately.

Bug: crashpad:196
Change-Id: Ie281cc13c4ff4a6e9699e882dbd6207daaab346d
Reviewed-on: https://chromium-review.googlesource.com/809234
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-12-06 17:31:57 +00:00
Scott Graham
bfeb194b01 fuchsia: Get crashpad_util_test building
Links, but various tests fail.

Also adds support to run_tests.py to run a single binary, likely only
useful on Fuchsia.

Bug: crashpad:196
Change-Id: Ie82ef26ec214ff4262194e877469953aa8fb367e
Reviewed-on: https://chromium-review.googlesource.com/809467
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-05 23:23:30 +00:00
Scott Graham
2403d066c4 fuchsia: Support runtime_deps of directories
This is necessary for crashpad_util_test, which has a GN data
specification that includes "net/util/testdata/".

Bug: crashpad:196
Change-Id: I7e03c8cbe448fd90c2481ad6a7e541827efebb0d
Reviewed-on: https://chromium-review.googlesource.com/809328
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-12-05 20:14:57 +00:00
Joshua Peraza
7a0daa6989 Enable reading notes from ELF images
Bug: crashpad:30
Change-Id: Ie6c594b05c6d39a869ed30b7a7b49e6a6301cc65
Reviewed-on: https://chromium-review.googlesource.com/792539
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-12-05 19:27:37 +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
Mark Mentovai
5969d6b1eb android: NDK r16 compatibility
This updates build/gyp_crashpad_android.py to define the
android_api_level GYP variable whenver unified headers are in use.
Previously, it was only set when compiling with GCC and using unified
headers. This pairs with https://crrev.com/c/804574 to allow proper
detection of when _FILE_OFFSET_BITS=64 would be inappropriate.

Since there’s no longer any possibility of using a 64-bit off_t with API
< 21, this also drops the compatibility wrapper for mmap() that allowed
this configuration to work. Too bad, I liked this, but it’s pointless to
carry now.

The development documentation is also updated to refer to NDK r16.

mini_chromium is updated to 88e056258a01450b07414642fa5fb98493c1f6ce.

f609089390cd fuchsia: Add ZX_LOG, et al. to mini_chromium
0a8c5de30c67 fuchsia: Fix RandBytes() ZX_CHECK message string
88e056258a01 android: Don’t use _FILE_OFFSET_BITS=64 until API 21

Change-Id: I932116e0c01bcddd5719f9091a070d504eae600f
Reviewed-on: https://chromium-review.googlesource.com/804555
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-12-04 16:26:00 +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
Mark Mentovai
593ede52e0 Fixes for drive-by review comments after ef3ce94fbfbb
Change-Id: I28edc00549d51576ab553f401235aa1d9f669232
Reviewed-on: https://chromium-review.googlesource.com/797335
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-29 19:52:08 +00:00
Scott Graham
3f5c939c84 gn: Next step in getting compilation working
- Correctly sets target_cpu and current_cpu so correct toolchain
  can be used on Fuchsia.
- Introduces GN argument "crashpad_in_chromium" which defaults to
  false. Used to set CRASHPAD_IN_CHROMIUM define, determine which
  zlib path to use, and how to package the test targets into
  binaries (one big one in Chromium, separate in Crashpad).

Bug: crashpad:79, crashpad:196
Change-Id: If6560dc064308ed6f8bf7c75cf74f684a3522e8b
Reviewed-on: https://chromium-review.googlesource.com/797354
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-11-29 19:46:08 +00:00
Mark Mentovai
ef3ce94fbf Python 3 support for Python scripts (without compromising Python 2)
It’s better to be prepared for the future than…to not be.

This is mostly the result of running 2to3 on all .py files, with some
small shims to maintain compatibility with Python 2.
http_transport_test_server.py was slightly more involved, requiring many
objects to change from “str” to “bytes”.

The #! lines and invokers still haven’t changed, so these scripts will
still normally be interpreted by Python 2.

Change-Id: Idda3c5650f967401a5942c4d8abee86151642a2e
Reviewed-on: https://chromium-review.googlesource.com/797434
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-29 18:47:38 +00:00
Mark Mentovai
1ee9fee37c Update buildtools, gtest, and gyp
Update buildtools to 505de88083136eefd056e5ee4ca0f01fe9b33de8

97d73b1a3ddb Do not apply clang coverage to libc++ and libc++abi
e043d81e9185 Roll gn 87530f977a..2c6f9299ed (r503394:r509075)
3275a099f3c1 Output warning only in verbose mode in Java deps checker
011c39ca57fa Roll libcxx, libcxxabi, and libunwind
df36429e1847 Add vector.cpp to libc++ sources
b0f94d04e26f Java checker only warns multiple definitions of touched
             files
c79d52ba0fb4 Merge "Java checker only warns multiple definitions of
             touched files"
817a502753ff Prepare Android for building libc++ in-tree
05f9bc9b8599 Fix undefined deps on arm64
2a2f666c35b7 Update libc++, libc++abi, and libunwind READMEs
73ddd64be624 Roll gn 2c6f9299ed..157d5de447 (r509075:r514519)
93a751e41bd9 Fix git cl presubmit failure caused by java_checker.py scan
             deleted files
6cce6ca960b9 Fix libc++ build when using gcc
7f134c70f0f8 Allow java file multiple definition for excluded paths in
             java checker
9c40f80c9998 Merge "Fix libc++ build when using gcc"
8c7174c87fd6 Always hide libunwind symbols on desktop Linux
3196d83d5c1f Fix typo: fuschia -> fuchsia
461b345a815c Add migration code for no_exceptions configs
505de8808313 Finish migration to exceptions configs

Update gtest to d175c8bf823e709d570772b038757fadf63bc632

509f7fe84094 Update googletest README.md
24696c3958f0 Merge branch 'master' into master
3eaba9f07c5f Merge branch 'master' into master
4597ec587ca2 Updated README with information about C runtime
             dynamic/static linking issues in Windows
ecb1c3ddb6cf #1282: Doc typo fix
963932e7f37b Merge pull request #1292 from DariuszOstolski/master
3282f9ae018f Merge pull request #1288 from joealam/master
dfed97a69ac3 Workaround for Travis issue https://github.com/travis-ci
             /travis-ci/issues/8552
5c9543547e5f Merge pull request #1297 from gennadiycivil/master
34aaf58c8b1b Revert "Workaround for Travis issue https://github.com
             /travis-ci/travis-ci/is…"
27be0dfb53a1 Merge pull request #1298 from google/revert-1297-master
54c2648bff0e Workaround for Travis issue https://goo.gl/d5eV8o
48986f9d4c8e Merge branch 'master' into master
69e48e92de43 Merge pull request #1300 from gennadiycivil/master
c208d8df23d6 Merge branch 'master' into master
1beff241c359 googletest: Add GTEST_API_ attribute to ThreadLocal class
6d0bb75c81bc Merge pull request #1139 from chehsunliu/master
77380cddf771 Enable C++11 features for VS2015 and VS2017
2641b021fc2a Fix tests with VS2015 and VS2017
840c711e7bd7 Fix gmock tests when std::unary_function unavailable
7684db32712e Merge pull request #1218 from KindDragon/vs-build-fix
20e2de7d8bba Remove gcc 6 misleading indentations
060783b7d2b7 Merge branch 'master' into gtestapifix
e93a15c5a59e Merge pull request #913 from Romain-Geissler/fix-gcc-
             misleading-indentation-warning
3121b2049e30 Merge pull request #1304 from m-gupta/gtestapifix
b153bfd8f503 Enable CI for VS2017
8866af0386d7 remove markdown stars (bold) from code examples
43d6ad75bc4f Merge pull request #1308 from KindDragon/vs2017-ci
d175c8bf823e Merge pull request #1313 from aninf-wo/heth/fix-faq-stars-
             issue-1312

Update gyp to 5e2b3ddde7cda5eb6bc09a5546a76b00e49d888f

365ffa057dc3 Flip to LUCI for tryjobs
5e2b3ddde7cd Remove Rietveld CQ config

Change-Id: I20ca6d84ac79cb85d73934392ff1655de2f147c5
Reviewed-on: https://chromium-review.googlesource.com/797011
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-29 18:27:20 +00:00
Mark Mentovai
5e16410ad4 fuchsia: Download the toolchain to distinct directories per build host
I like to share a single Crashpad checkout between my non-virtual
machine and some virtual machines. Downloaded toolchains, which vary by
build host configuration, must go in paths named for the build host.
(Chromium doesn’t do this, and it bugs me.)

Rather than downloading the Fuchsia toolchain to
third_party/fuchsia/clang, this puts it in
third_party/fuchsia/clang/{mac,linux}-amd64.

The Fuchsia SDK is only published on cipd for linux-amd64, but the
sysroot that it contains ought to be perfectly functional on any
suitably-equipped build host, so this also checks out that package
unconditionally.

Bug: crashpad:196
Change-Id: Iabd4f2dd1e2c06a3f7208b5c40432619983919ea
Reviewed-on: https://chromium-review.googlesource.com/794537
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2017-11-29 15:19:17 +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
Robert Sesek
af28b83eb7 In Annotation::SetSize, use AnnotationList::Register rather than Get.
In Chromium, the AnnotationList is registered in the main executable
module. However, when using the component build, the individual shared
libraries do not explicitly initialize the CrashpadInfo nor
AnnotationList. This causes annotations to NULL-dereference the
uninitialized AnnotationList when using the component build.

By using the Register method instead, the AnnotationList will be lazily
created. In Chromium's static/release build, the AnnotationList will
still be initialized deterministically during startup.

Bug: crashpad:192
Change-Id: I8599b52630f4d7608e5028b14264a8eed49a9176
Reviewed-on: https://chromium-review.googlesource.com/793981
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-28 18:35:06 +00:00
Scott Graham
0d05b0d59e fuchsia: Use RandBytes UUID generator
There's no particular UUID generator on Fuchsia, so use the RandBytes()
version. (That won't work either yet, but will once RandBytes() is
implemented.)

Bug: crashpad:196
Change-Id: Id740bbfc80e170d7ab19995ac88db5eed474c119
Reviewed-on: https://chromium-review.googlesource.com/786822
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-27 21:48:44 +00:00
Scott Graham
4ee20f5831 Add Fuchsia clang and sdk to DEPS
These use CIPD (from depot_tools) to download packages created by the
Fuchsia team. The .ensure file is passed to `cipd` which currently
include specificiations for the Fuchsia team's build of clang (which,
because it's close to HEAD includes support for targeting Fuchsia), as
well as the Fuchsia SDK.

Both packages are specified as "latest" rather than pinning to a
specific revision. At this early point in the process we don't have any
good reason to pin, but that can be accomplished later by replacing that
with a specific package's SHA1.

Due to the (relatively new) 'condition': 'checkout_fuchsia', this DEPS
step will only be run when .gclient includes 'fuchsia' in the target_os
block at the top_level, e.g.

$ cat .gclient
solutions = [
  { ...  },
]
target_os = ['fuchsia']

Bug: crashpad:196, crashpad:209
Change-Id: Id6d444a1c4450ffde8ee6665ff9720ce454c5cdf
Reviewed-on: https://chromium-review.googlesource.com/786092
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-27 21:42:44 +00:00
Scott Graham
050d111bf9 fuchsia: Set METRICS_OS_NAME
Bug: crashpad:196
Change-Id: I4f01c4f04c94a745b4c30bc41f66d2ae010e883a
Reviewed-on: https://chromium-review.googlesource.com/786817
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-27 21:28:04 +00:00
Scott Graham
1020a6147d fuchsia: Use crashpad_info section matching Linux/Android for now
I have no idea if this will work as not much is building yet, but it
seems plausible for the time being.

Bug: crashpad:196
Change-Id: Ie3a358512a968e9e777ed03c0bffc5e273a0f12e
Reviewed-on: https://chromium-review.googlesource.com/786777
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-27 21:22:04 +00:00
Scott Graham
ee84ce22bb fuchsia: Set kOS in MinidumpMiscInfoDebugBuildString
Bug: crashpad:196
Change-Id: I80c979967d95383e0f703a336a494f30ff583f1b
Reviewed-on: https://chromium-review.googlesource.com/786448
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-27 21:15:44 +00:00
Mark Mentovai
e9f40ae176 Remove double double words
I ran the thing below (piped to “grep -v namespace”), fixed things up,
and rewrapped comments in the affected file.

import re
import sys

LAST_WORD_RE = re.compile('^.*[\s]+([\w]+)$')
FIRST_WORD_RE = re.compile('^[^\w]+([\w]+).*$')

for path in sys.argv[1:]:
  with open(path) as file:
    line_number = 0
    last_word = None
    for line in file:
      line_number += 1
      first_word = FIRST_WORD_RE.match(line)
      if first_word and first_word.group(1) == last_word:
        print('%s:%u: %s' % (path, line_number - 1, last_word))
      last_word = LAST_WORD_RE.match(line)
      if last_word:
        last_word = last_word.group(1)

Change-Id: Iea9f2a6453d9d9ec17e2f238e09252535d7408bd
Reviewed-on: https://chromium-review.googlesource.com/780284
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-20 23:38:48 +00:00
Mark Mentovai
20e5aba1af URL cleanups: switch to HTTPS, fix dead ones, use canonical ones
Change-Id: I4b247d7fae1a212350f8ffcf2bf5ba1fa730f5c1
Reviewed-on: https://chromium-review.googlesource.com/780339
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-20 22:23:39 +00:00
Mark Mentovai
e935375fe9 Don’t check out lldb (or llvm or clang)
These are large, not pinned (floating at HEAD), and we’re not currently
using them.

Change-Id: I550f832aeb42db8404fdb764f78e83136a2a7ef6
Reviewed-on: https://chromium-review.googlesource.com/779668
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-20 22:05:29 +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
Scott Graham
d5ead4d70f Upstream lightly modified Chromium BUILD.gn files
Unreferenced, and not working at all in Crashpad-standalone.

Copied from Chromium at 52a9831d81f2099ef9f50fcdaca5853019262c35 to have
a point where a roll back into Chromium should be a no-op (with Chromium's
build/secondary/third_party/crashpad/... removed).

I'm not sure what we want to do about the various gni references into
Chromium (e.g. //build/config/sanitizers/sanitizers.gni, //testing/test.gni,
etc.) but I guess the sooner they live in Crashpad rather than in Chromium
the sooner we can figure out the sort of knobs and dials we need.

Bug: crashpad:79
Change-Id: Id99c29123bcd4174ee2bcc128c2be87e3c94fa3f
Reviewed-on: https://chromium-review.googlesource.com/777819
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Scott Graham <scottmg@chromium.org>
2017-11-20 18:08:23 +00:00
Robert Sesek
a7453394d6 Provide a StringPiece getter and setter for StringAnnotation.
Bug: crashpad:192
Change-Id: Ia8957a1b6f0076257ef385a9299d9b5895cc17be
Reviewed-on: https://chromium-review.googlesource.com/775140
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-16 20:36:41 +00:00
Robert Sesek
f09257b17c Remove more unneeded MIG server stubs.
These were missed with the mig.py change in
6dd2be7c44a9c8bbea5df918e7ebe46d76da97df.

Change-Id: I7ad066cd9425cab26e56a8b3dfb90f5f54a6648d
Reviewed-on: https://chromium-review.googlesource.com/774999
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2017-11-16 17:37:23 +00:00
Robert Sesek
6dd2be7c44 Stop providing unimplemented stubs for util/mach/exc_server_variants.cc.
Rather than providing these stubs to make the linker happy, use the
mig.py script to modify the _Xserver_routine functions to not even call
server_routine.

Change-Id: I5a2f5cd228462e38dddbf899d0ad8033a6f817bd
Reviewed-on: https://chromium-review.googlesource.com/773359
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-16 00:09:23 +00:00
Mark Mentovai
d7798a4e28 Tolerate safe size mismatches in the CrashpadInfo struct
The handler will now be less strict about checking CrashpadInfo struct
sizes. Assuming the signature and version fields match:

 - If the handler sees a struct smaller than it’s expecting, the module
   was likely built with an earlier version of the client library, and
   it’s safe to treat the unknown fields as though they were zero or
   other suitable default values.
 - If the handler sees a struct larger than it’s expecting, the module
   was likely built with a later version of the client library. In that
   case, actions desired by the client will not be performed, but this
   is not otherwise an error condition.

The CrashpadInfo struct must always be at least large enough to contain
at least the size field. The signature and version fields are always
checked.

The section size must be at least as large as the size carried within
the struct. To account for possible section padding, strict equality is
not required.

Bug: chromium:784427
Test: crashpad_snapshot_test CrashpadInfoSizes_ClientOptions/*.*
Change-Id: Ibb0690ca6ed5e7619d1278a68ba7e893d55f19fb
Reviewed-on: https://chromium-review.googlesource.com/767709
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2017-11-15 18:09:23 +00:00
Mark Mentovai
22e8c33b21 linux: Provide PTRACE_GET_THREAD_AREA for 32-bit x86 with glibc
glibc’s own <sys/ptrace.h> should provide this but doesn’t. See
https://sourceware.org/bugzilla/show_bug.cgi?id=22433.

The copy in compat provided it when targeting x86-64 and using glibc.
util/linux/ptracer.cc uses it when targeting both 32-bit x86 and x86-64,
so the compat definition must be made to apply to 32-bit x86 too.

This also provides a #define using the same name as the constant, which
is what glibc’s <sys/ptrace.h> does for other constants.

Bug: crashpad:30
Change-Id: I5a0734a236d1c25398fb69e66f58dfe118658b68
Reviewed-on: https://chromium-review.googlesource.com/765257
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2017-11-13 22:36:45 +00:00
Joshua Peraza
b8f61fdc8b Add TimevalToTimespec and use it to get CurrentTime on macOS
A follow-up to:
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/744298/35/util/file/filesystem_test.cc#31

Bug: crashpad:206
Change-Id: I2f711839ae7746104f1fee9685f2ab9059d9c2b3
Reviewed-on: https://chromium-review.googlesource.com/762479
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-10 01:49:05 +00:00
Mark Mentovai
0e3c38a4ca win: Make ProcessSnapshotTest.CrashpadInfoChild use a loaded module
When this test examines a module that doesn’t have a CodeView PDB link,
it will fail. Such a link may be missing when linking with Lexan
ld-link.exe without /DEBUG. The test had been examining the executable
as its module. Since it’s easier to provide a single small module linked
with /DEBUG than it is to require that the test executable always be
linked with /DEBUG, the test is revised to always load a module and
operate on it. The module used is the existing
crashpad_snapshot_test_image_reader_module.dll. It was chosen because
it’s also used by PEImageReader.DebugDirectory, which also requires a
CodeView PDB link.

It’s the build system’s responsibility to ensure that
crashpad_snapshot_test_image_reader_module.dll is linked appropriately.
Crashpad’s own GYP-based build always links with /DEBUG. Chrome’s
GN-based Crashpad build will require additional attention at
symbol_level = 0.

Bug: chromium:782781
Change-Id: I0dda8cd13278b82842263e76bcc46362bd3998df
Reviewed-on: https://chromium-review.googlesource.com/761501
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-11-09 23:18:51 +00:00
Mark Mentovai
e2b9ab3ed2 win: Tests shouldn’t freak out when CodeView PDB links are absent
crashpad_snapshot_test PEImageReader.DebugDirectory was hanging when
crashpad_snapshot_test_image_reader.exe did not have a CodeView PDB
link. This occurred when linked by Lexan ld-link.exe without /DEBUG.

Bug: chromium:782781
Change-Id: I8fbc4d8decf6ac5e19f7ffeb230fd15d7c40fd51
Reviewed-on: https://chromium-review.googlesource.com/761320
Reviewed-by: Leonard Mosescu <mosescu@chromium.org>
2017-11-09 23:17:27 +00:00
Joshua Peraza
13e17bf90f Fix FileModificationTime for Android
Traditional NDK headers provide the nanoseconds field of modification
time as st_mtime_nsec, rather than contained in a timespec st_mtim.
Unified headers do provide the timespec st_mtim.

Bug: crashpad:206
Change-Id: I701ac2d5e357a13855a2a674f1355f2ea125ee4e
Reviewed-on: https://chromium-review.googlesource.com/760618
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-09 19:08:57 +00:00
Joshua Peraza
6f6f8a144d Add FileModificationTime
FileModificationTime gets the last write time for files, directories,
or symbolic links. Symbolic links may point to files, directories, or
be dangling.

Bug: crashpad:206
Change-Id: Ic83b5a7d318502ad5db5c01731d06c8624925e15
Reviewed-on: https://chromium-review.googlesource.com/744298
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-09 06:27:46 +00:00
Mark Mentovai
2d077a2c57 win: Use “long” format modifier for DWORD
Change-Id: Ibecedd195224ea53ff36f376897a6ff3c4e773d2
Reviewed-on: https://chromium-review.googlesource.com/757085
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-07 21:46:36 +00:00
Mark Mentovai
d3b7463c7a win: Recognize nsi.dll presenting as VFT_DRV/VFT2_DRV_NETWORK
This was previously proposed at
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/339103/2/util/win/pe_image_reader_test.cc#84.
It didn’t land because the change was abandoned for other reasons, but
the fix was valid. nsi.dll is not VFT_APP or VFT_DLL, and if it’s
loaded, crashpad_snapshot_test PEImageReader.VSFixedFileInfo_AllModules
fails.

Although I can’t reproduce nsi.dll being loaded spontaneously in local
testing or on trybots, it occurred in the monolithic crashpad_tests at
https://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%281%29/builds/64492:

[ RUN      ] PEImageReader.VSFixedFileInfo_AllModules
../../third_party/crashpad/crashpad/snapshot/win/pe_image_reader_test.cc(90): error: Value of: observed.dwFileType == VFT_APP || observed.dwFileType == VFT_DLL
  Actual: false
Expected: true
Google Test trace:
../../third_party/crashpad/crashpad/snapshot/win/pe_image_reader_test.cc(164): C:\Windows\syswow64\NSI.dll
[  FAILED  ] PEImageReader.VSFixedFileInfo_AllModules (11 ms)

I can also reproduce locally by calling LoadLibrary(L"nsi.dll").

Bug: chromium:779790, chromium:782011
Test: crashpad_snapshot_test PEImageReader.VSFixedFileInfo_AllModules
Change-Id: I361c7d6521645913277a441ce38779aaa4a182c2
Reviewed-on: https://chromium-review.googlesource.com/757077
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-07 17:42:18 +00:00
Mark Mentovai
34f5e8d513 Only disable -Wconstant-conversion for Clang, not GCC
The warning suppression was recently added in a51e912004a6, and I don’t
know what I was thinking. I went out of my way to make it apply to both
Clang and GCC, but GCC doesn’t recognize this warning at all, nor does
it need any other warning suppressed.

Change-Id: I50341bfe81ee4799b3f6278d2e31ec31741952ac
Reviewed-on: https://chromium-review.googlesource.com/755654
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-07 00:25:09 +00:00
Joshua Peraza
18726100ed Move win/time to misc/time and add more conversion functions
This CL pulls together similar time conversion functions and adds
conversions between `FILETIME`s and `timespec`s.

Bug: crashpad:206
Change-Id: I1d9b1560884ffde2364af0092114f82e1534ad1c
Reviewed-on: https://chromium-review.googlesource.com/752574
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-06 22:37:27 +00:00
Mark Mentovai
b851b2590b Update mini_chromium to dd0c3e9680ae3c4c22f2221a2a75e48dd4a562ec
7f523b111c8c win: Don’t define c16*() functions in
             base/strings/string16.{cc,h}
dd0c3e9680ae Use ICU 60.1 as the basis for base/third_party/icu

Change-Id: I21b921c36a3ee1f989fa9786f60d980724577f64
Reviewed-on: https://chromium-review.googlesource.com/755215
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
2017-11-06 20:16:15 +00:00
Joshua Peraza
d768538e39 Add ProcessSnapshotLinux
Bug: crashpad:30
Change-Id: Ie03592aeb91741d957b98716e4d4bb19695a42cf
Reviewed-on: https://chromium-review.googlesource.com/604627
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
2017-11-03 16:49:28 +00:00
Robert Sesek
b6a3d91342 Read annotation objects from the client when producing snapshots.
This wires up the annotation objects system of the client to the
snapshot production and minidump writing facilities.

Bug: crashpad:192
Change-Id: If7bb7625b140d71a15b84729372cbd0fd4bc63ef
Reviewed-on: https://chromium-review.googlesource.com/749870
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2017-11-02 16:40:48 +00:00
Robert Sesek
79e2dd843e Include string annotation objects when uploading crash reports.
This extracts string annotation objects from the minidumps and includes
them as form POST key-value pairs.

This change also starts building a crashpad_handler_test binary on Mac.

Bug: crashpad:192
Change-Id: I68cbf6fda6f1e57c1e621d5e3de8717cfaea65bf
Reviewed-on: https://chromium-review.googlesource.com/749793
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2017-11-02 16:39:06 +00:00
Robert Sesek
4d7d4dd56c Flip gtest _EQ parameter order in minidump_annotation_writer_test.cc
Bug: crashpad:192
Change-Id: I82dddda5ba3d4fe5bf843572e6a793131cb6fa40
Reviewed-on: https://chromium-review.googlesource.com/751441
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
2017-11-02 16:17:06 +00:00