819 Commits

Author SHA1 Message Date
Scott Graham
83247fda60 Fix Mac after af3dc54f
CrashpadInfo not being initialized/propagated properly on Mac.

Change-Id: I5f33a16e4e18bb1b068e0d4aeb7f2032a6cb6278
Reviewed-on: https://chromium-review.googlesource.com/324500
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-01-28 21:16:16 +00:00
Scott Graham
af3dc54f2a Add a field to CrashpadInfo to control indirect memory capture
Change-Id: I6467aafba5d20f8a199bab0e2476f98a5318f84a
Reviewed-on: https://chromium-review.googlesource.com/322245
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-01-28 20:16:01 +00:00
Mark Mentovai
e18f6a6e66 Nest crashpad and mini_chromum deeper in the external-dependencies build
crashpad and mini_chromium both have top-level “build” directories.
These would conflict with top-level “BUILD” files in google3 when
checked out on a case-sensitive filesystem. Although Crashpad’s “build”
directory can be moved easily, mini_chromium’s matches Chromium’s, which
is much more difficult to move. “build” is also the best and most
obvious name for these directories.

To avoid this problem, in the external-dependencies build, crashpad and
mini_chromium are placed one level deeper, just as crashpad is in
Chromium, and mini_chromium is in the standalone Crashpad build. This
allows true pristine unmodified copies to be checked in to google3,
without comingling locally-added files such as BUILD with external
source.

The directory structure adopted for the external-dependencies build is
now

      root/crashpad/crashpad[/README]
      root/gmock[/include/gmock/gmock.h]
      root/gtest[/include/gtest/gtest.h]
      root/gyp[/pylib/gyp]
      root/mini_chromium/mini_chromium[/build/common.gypi]

Change-Id: Idbc8f1b0d87da0cbceab3c15e059e839c1fb6a3f
Reviewed-on: https://chromium-review.googlesource.com/323991
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-01-27 21:59:50 +00:00
Mark Mentovai
88eea80ad3 Add an “external” mode for obtaining dependencies
This augments the standalone and in-Chromium models with an external
model, in which the dependencies and Crashpad are checked out as
siblings in the same directory, organized according to this structure:

  root/crashpad[/README]
  root/gmock[/include/gmock/gmock.h]
  root/gtest[/include/gtest/gtest.h]
  root/gyp[/pylib/gyp]
  root/mini_chromium[/build/common.gypi]

This is the directory structure used in google3.

Change-Id: Ie300ead7cd085265933e4ed891509ce050e995e2
Reviewed-on: https://chromium-review.googlesource.com/324230
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-01-27 21:13:28 +00:00
Mark Mentovai
82af299823 Update mini_chromium to 7c5b0c1ab44a4264b02f4c825a5b73d9173253e4
7c5b0c1ab44a Use Gerrit (Polygerrit) for mini_chromium code review

Change-Id: I883672b91dac5387031e913dd62a1802d2163e9f
Reviewed-on: https://chromium-review.googlesource.com/323140
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-01-27 16:45:44 +00:00
Patrick Monette
4794225f22 Adding an API to read module annotations in snapshot.gyp
Kasko needs a way to read crash keys from out of process. This API
reuses the functionality of PEImageAnnotationsReader.

Change-Id: I2f3bbc358212e6f50235183e9dbb4e5a2cf989cf

This is a reupload of https://codereview.chromium.org/1586433003/ but
for gerrit.

Change-Id: I2f3bbc358212e6f50235183e9dbb4e5a2cf989cf
Reviewed-on: https://chromium-review.googlesource.com/322550
Reviewed-by: Scott Graham <scottmg@chromium.org>
Tested-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Scott Graham <scottmg@google.com>
2016-01-18 20:35:42 +00:00
Andrew Bonventre
2e44832850 Remove CC_LIST from codereview.settings
It has no effect on Gerrit hosts. The notification settings within
Gerrit need to be configured.

Change-Id: I6ab9ed0d6f55742ebe934924cc9272efd7e2f3c6

BUG=

Change-Id: I592e0dcacfc41d90bf7c0e6800cd8e2c411c6c2c
Reviewed-on: https://chromium-review.googlesource.com/322190
Tested-by: Andrew Bonventre <andybons@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-01-14 16:19:50 +00:00
Andrew Bonventre
a4f3761de2 Switch to Gerrit for code review
Change-Id: I36baf766e17cf7f86d14fd28f8e6c22008c8f6f4
2016-01-13 17:47:41 -05:00
Scott Graham
417097b91f win: Better setting of DI for register capture test
The previous approach was nice for its simplicity, but unfortunately
didn't work when the compiler decided to do some of its confounded
"optimization".

R=mark@chromium.org
BUG=crashpad:86, chromium:571144

Review URL: https://codereview.chromium.org/1563273004 .
2016-01-10 13:32:20 -08:00
Scott Graham
5af9c42638 win: Capture some memory pointed at by context
R=mark@chromium.org
BUG=crashpad:86, chromium:571144

Review URL: https://codereview.chromium.org/1533183002 .
2016-01-08 17:24:04 -08:00
Mark Mentovai
142b139305 package.h, man_footer.ad: Update copyright year to 2016
For perceived freshness of command-line tools

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1567723003 .
2016-01-06 16:25:49 -05:00
Scott Graham
330adfb029 Allow disabling upload rate-limiting in crashpad_handler
This is a temporary measure to try to account for lower than expected
upload volume from Chrome in the wild. So this doesn't fix bug 23, but
is related. The ability to delimit the upload rate is useful when
testing locally too.

R=mark@chromium.org
BUG=crashpad:23

Review URL: https://codereview.chromium.org/1563683002 .
2016-01-06 09:59:54 -08:00
Mark Mentovai
54048cfd78 Don’t suppress_wildcard crashpad.gyp:All on platforms where it works
This matches Chromium 01e379fac955.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1566763002 .
2016-01-06 12:37:01 -05:00
Mark Mentovai
b7e4564ff2 Update mini_chromium to a43fee120b10ed71df4e55a370948ca461d78232
a43fee120b10 Sync Mac scopers with upstream Chromium

This adapts to updated Mac scopers from Chromium cfd6ed5600d8, including
the changes from that commit and Chromium f39d4ffc6c32.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1565873002 .
2016-01-06 12:31:59 -05:00
Mark Mentovai
6d2d31d2d1 Use base/macros.h instead of base/basictypes.h
This was done in Chromium’s local copy of Crashpad in 562827afb599. This
change is similar to that one, except more care was taken to avoid
including headers from a .cc or _test.cc when already included by the
associated .h. Rather than using <stddef.h> for size_t, Crashpad has
always used <sys/types.h>, so that’s used here as well.

This updates mini_chromium to 8a2363f486e3a0dc562a68884832d06d28d38dcc,
which removes base/basictypes.h.

e128dcf10122 Remove base/move.h; use std::move() instead of Pass()
8a2363f486e3 Move basictypes.h to macros.h

R=avi@chromium.org

Review URL: https://codereview.chromium.org/1566713002 .
2016-01-06 12:22:50 -05:00
Mark Mentovai
c46a676624 Use std::move() in PruneCrashReportThread
Crashpad uses std::move() as of 6bebb1082933. scoped_ptr<>::Pass() will
be unavailable once mini_chromium is updated to or past e128dcf10122.

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1562793002 .
2016-01-06 12:15:00 -05:00
Robert Sesek
18a2941305 Create the PruneCrashReportsThread in the handler.
This will prune the database on a daily basis, in accordance with the specified
condition.

BUG=crashpad:22
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1534503002 .
2016-01-05 15:09:00 -05:00
Robert Sesek
5e24471188 Fix build break after 6d829e9af7d7630422d8095747905015d347b3be.
../../handler/crash_report_upload_thread.cc:142:7: error: field 'database_' will be initialized after field 'thread_' [-Werror,-Wreorder]
      database_(database),
      ^
1 error generated.

And:

..\util\thread\worker_thread_test.cc(25) : warning C4244: 'initializing' : conversion from 'double' to 'const uint64_t', possible loss of data

BUG=crashpad:22
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1556043005 .
2016-01-04 17:42:04 -05:00
Robert Sesek
6d829e9af7 Create WorkerThread, an abstraction to perform some work on an interval.
This was extracted from CrashReportUploadThread and will be re-used for the
database pruning thread.

BUG=crashpad:22
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1526563003 .
2016-01-04 17:10:58 -05:00
Bruce Dawson
b0394744cc Fix some VS 2015 warnings
Fix some warnings when compiling crashpad with VC++ 2015 Update 1.

Warning 4302 occurs if you convert from a pointer to a <sizeof(void*)
integer in one cast, because this often indicates an accidental pointer
truncation which can be a bug in 64-bit builds.

Warning 4577 warns that noexcept will not be enforced, but we don't want
it to be enforced anyway, so I disabled it. The full warning is:

warning C4577: 'noexcept' used with no exception handling mode specified
termination on exception is not guaranteed. Specify /EHsc

BUG=440500
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1527803002 .

Patch from Bruce Dawson <brucedawson@chromium.org>.
2015-12-14 20:01:05 -05:00
Mark Mentovai
583d1dc3ef Provide std::move() in compat instead of using crashpad::move()
This more-natural spelling doesn’t require Crashpad developers to have
to remember anything special when writing code in Crashpad. It’s easier
to grep for and it’s easier to remove the “compat” part when pre-C++11
libraries are no longer relevant.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1513573005 .
2015-12-09 17:36:32 -05:00
Mark Mentovai
8f3b0af215 client: Depend on compat
The upcoming https://codereview.chromium.org/1513573005/ requires that
std::move() in compat be available to callers in client.

crashpad_client_mac.cc uses macros not available in all SDK versions.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1510243002 .
2015-12-09 17:31:10 -05:00
Mark Mentovai
a33736dd0d Fix AlignedAllocator for pre-C++11 libraries
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1511233002 .
2015-12-09 17:25:05 -05:00
Scott Graham
e9a843c626 win: Set shutdown order to make the handler shutdown as late as possible
At the default level, we might be terminated before the process we're
watching, which would mean missing shutdown crashes.

R=mark@chromium.org
BUG=crashpad:84

Review URL: https://codereview.chromium.org/1505423002 .
2015-12-08 16:55:02 -08:00
Scott Graham
b9e732d318 win: Fix a few sign mismatch warnings in crashpad.
BUG=chromium:567877
R=mark@chromium.org, scottmg@chromium.org

Review URL: https://codereview.chromium.org/1503403003 .
2015-12-08 14:21:29 -08:00
Mark Mentovai
7efdc94f59 Fixes for Chromium checkperms.py PRESUBMIT
BUG=chromium:472900
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1508193002 .
2015-12-08 16:24:54 -05:00
Mark Mentovai
f55d18ade6 Add AlignedVector and use it for vector<MEMORY_BASIC_INFORMATION64>
MEMORY_BASIC_INFORMATION64 specifies an alignment of 16, but the
standard allocator used by containers doesn't honor this. Although 16
is the default alignment size used on Windows for x86_64, it's not for
32-bit x86. clang assumed that the alignment of the structure was as
declared, and used an SSE load sequence that required this alignment.

AlignedAllocator is a replacement for std::allocator that allows the
alignment to be specified. AlignedVector is an std::vector<> that uses
AlignedAllocator instead of std::allocator.

BUG=chromium:564691
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1498133002 .
2015-12-08 15:38:17 -05:00
Scott Graham
fabcd79057 Add missing comma in compat.gyp
Causes a warning in the gyp-msvs generator.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/1490073005 .
2015-12-02 15:31:44 -08:00
Mark Mentovai
47fbac4ae1 win: Placate more OS versions in the PEImageReader test
The BaseName() was added because system DLLs were being reported by
GetFileVersionInfo()/VerQueryValue() as having major file versions of
6.2 instead of 10.0 on Windows 10 when accessed by full path, but not
by BaseName(). The PEImageReader gets the correct version from the
in-memory images, 10.0.

This trick didn't work on Windows XP, where two copies of comctl32.dll
were found loaded into the process, one with a major file version of
5.82 and the other with 6.0. Giving GetFileVersionInfo() the BaseName()
would result in it returning information from one of these, which would
cause the version to not match when the PEImageReader was looking at the
other.

All of these GetFileVersionInfo() quirks make me glad that we're not
using it anymore (outside of the test).

Because of the version numbers involved (NT 6.2 = Windows 8, where
GetVersion()/GetVersionEx() start behaving differently for
non-manifested applications) and the fact that GetFileVersionInfo()
and VerQueryValue() seem to report 10.0 even with full paths on Windows
10 in applications manifested to run on that OS, the BaseName() thing is
restricted to Windows 8 and higher.

TEST=crashpad_snapshot_test PEImageReader.VSFixedFileInfo_AllModules
BUG=crashpad:78
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1493933002 .
2015-12-02 17:48:20 -05:00
Scott Graham
894a06070e win: Fix some warnings reported by /analyze
Reported by brucedawson@chromium.org.

R=mark@chromium.org
BUG=chromium:427616

Review URL: https://codereview.chromium.org/1489293004 .
2015-12-02 13:52:03 -08:00
Mark Mentovai
384fd93d6d win: Add a VSFixedFileInfo test to check all modules
BUG=crashpad:78
TEST=crashpad_snapshot_test PEImageReader.VSFixedFileInfo_AllModules
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1485333002 .
2015-12-02 11:11:54 -05:00
Mark Mentovai
5be8ce4ea0 Get module versions and types from in-memory images
Don't call GetFileVersionInfo(), which calls LoadLibrary() to be able to
access the module's resources. Loading modules from the crashy process
into the handler process can cause trouble. The Crashpad handler
definitely doesn't want to run arbitrary modules' module initializer
code.

Since the VS_FIXEDFILEINFO needed is already in memory in the remote
process' address space, just access it from there.

BUG=crashpad:78
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1475023004 .
2015-12-01 17:06:37 -05:00
Mark Mentovai
d81d83661d package.h: Update version number to 0.8.0
Per https://codereview.chromium.org/998653002/, we were going to call
the Windows client milestone 0.8.0. Now that the Crashpad client has
successfully shipped in a Chrome Windows canary, I think we can say that
we’re there. Or here.

Congratulations!

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1484013004 .
2015-12-01 15:08:27 -05:00
Scott Graham
72d6be5cb9 win: Fix debug iterator failure on empty database read/write
R=mark@chromium.org, rsesek@chromium.org
BUG=crashpad:80

Review URL: https://codereview.chromium.org/1492503002 .
2015-12-01 10:33:24 -08:00
Mark Mentovai
7764fa1144 Remove errant double-semicolons
R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/1489063002 .
2015-12-01 12:56:03 -05:00
Dana Jansens
6bebb10829 Replace use of .Pass() with crashpad::move().
Since C++11 library support isn't available everywhere crashpad is
compiled, add our own move() method in the crashpad namespace to replace
std::move() for now. Replace uses of .Pass() with this method.

R=mark@chromium.org, scottmg@chromium.org
BUG=chromium:557422

Review URL: https://codereview.chromium.org/1483073004 .
2015-11-30 14:20:54 -08:00
Scott Graham
1f3ced1846 win: Only capture the loader lock for now
On Win 7 in a debug configuration, walking all locks was gathering
hundreds of thousands of locks, causing test timeouts to be exceeded in
debug. On user machines, UnhandledExceptionHandler() could have timed
out too. For now, only grab the loader lock as it's the most interesting
one. Unfortunately, this means that !locks won't work for now.

In the future, we may want to figure out a signalling mechanism so that
the client can note other interesting locks to be grabbed, and just
avoid walking the list entirely.

R=mark@chromium.org
BUG=chromium:546288

Review URL: https://codereview.chromium.org/1475033005 .
2015-11-30 12:29:21 -08:00
Scott Graham
866cffce8a Revert "win: Cap number of locks gathered"
This reverts commit b3464d96f5fc0d82f860651b7918626dfbd80d65.

It was temporarily landed to be able to run as the DEPS version in Chrome.

BUG=

Review URL: https://codereview.chromium.org/1474223002 .
2015-11-26 12:23:12 -08:00
Scott Graham
b3464d96f5 win: Cap number of locks gathered
On Win 7 in a debug configuration, this was gathering hundreds of
thousands of locks, causing test timeouts to be exceeded. On user
machines, UnhandledExceptionHandler() probably would have timed out
also. Arbitrarily cap the number of locks captured, as we don't have a
pressing need for anything other than the LoaderLock anyway.

In the future, we may want to figure out a signalling mechanism so that
the client can note other interesting locks to be grabbed, and just
avoid walking the list entirely.

R=mark@chromium.org
BUG=chromium:546288

Review URL: https://codereview.chromium.org/1475033005 .
2015-11-26 12:19:26 -08:00
Hans Wennborg
33414779e1 Build fixes for Clang on Windows
See e.g. http://build.chromium.org/p/chromium.fyi/builders/CrWinClang/builds/4502/steps/compile/logs/stdio

BUG=chromium:82385
R=mark@chromium.org

Review URL: https://codereview.chromium.org/1473073008 .

Patch from Hans Wennborg <hans@chromium.org>.
2015-11-25 23:50:31 -05:00
Scott Graham
9b92d2fb71 win: Don't try to inherit console handles in StartHandler()
FILE_TYPE_CHAR handles can't be inherited via
PROC_THREAD_ATTRIBUTE_HANDLE_LIST, or CreateProcess() fails with
GetLastError() == 1450 on Windows 7.

I confirmed that an fprintf(stderr, ...) in HandlerMain() does make it
to the console when running tests even after this.

See bug for more discussion.

R=mark@chromium.org
BUG=crashpad:77

Review URL: https://codereview.chromium.org/1473793002 .
2015-11-24 16:36:27 -08:00
Mark Mentovai
116e1087f0 win: Don't warn when no VERSIONINFO resource is present in a module
Modules will work without a VERSIONINFO resource. This happens in some
of Crashpad's tests.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1467993003 .
2015-11-23 16:17:50 -05:00
Mark Mentovai
f5c4273d4f win: Only call GetFileVersionInfo() once per module
This log spam from end_to_end_test.py indicated that
GetFileVersionInfo() was being called three times per module:

[3076:3424:20151123,102817.290:WARNING module_version.cc:29]
GetFileVersionInfoSize: ...\crashpad\out\Release_x64\crashy_program.exe:
The specified resource type cannot be found in the image file. (1813)
[3076:3424:20151123,102817.291:WARNING module_version.cc:29]
GetFileVersionInfoSize: ...\crashpad\out\Release_x64\crashy_program.exe:
The specified resource type cannot be found in the image file. (1813)
[3076:3424:20151123,102817.291:WARNING module_version.cc:29]
GetFileVersionInfoSize: ...\crashpad\out\Release_x64\crashy_program.exe:
The specified resource type cannot be found in the image file. (1813)

This is unnecessary. It only needs to be called once.

We may want to avoid logging in GetModuleVersionAndType() when
GetLastError() is ERROR_RESOURCE_TYPE_NOT_FOUND.

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1472963002 .
2015-11-23 16:04:25 -05:00
Mark Mentovai
c60ec9beeb Update gtest to 786564fa4a3c8e0f908acca32cce481de5481b9f
8b085f0d2168 Fix warnings encountered in MSVC build of gtest/gmock tests
322a4914a309 Better use of character constants
cbce23fb8670 Leave decltype(max_ulps_) alone and cast, not sure this is
             better
cfe466a0a753 Use a templated helper to wrap the cast
4a8e54401e49 Name the helper AsBits()
786564fa4a3c Merge pull request #627 from mark-chromium/tests_msvs

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1467283002 .
2015-11-23 13:17:11 -05:00
Mark Mentovai
e1dc5d6dbe Update mini_chromium to 43f04e7299621f708801bf475c84d9f294826ff9
43f04e729962 win: Compile with /bigobj

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1465083003 .
2015-11-23 12:52:06 -05:00
Scott Graham
74e69ed555 win: Avoid some more clang complaints
R=mark@chromium.org
BUG=chromium:82385

Review URL: https://codereview.chromium.org/1463633002 .
2015-11-19 15:09:59 -08:00
Scott Graham
0a717f0d27 win: class VM_COUNTERS -> struct
The fields aren't accessed anyway, but clang warns that they're
completely inaccessible. Also, matches all the other definitions in this
file.

R=mark@chromium.org

Review URL: https://codereview.chromium.org/1462203002 .
2015-11-19 14:26:36 -08:00
Scott Graham
3562fe4ccd win: Don't duplicate handles in handle restriction list
R=mark@chromium.org
BUG=crashpad:77

Review URL: https://codereview.chromium.org/1464473003 .
2015-11-19 11:25:52 -08:00
Mark Mentovai
4f09b58d1f Add RandomString() and its test, and use it everywhere it makes sense
This unifies several things that used a 16-character random string, and
a few other users of random identifiers where it also made sense to use
a 16-character random string.

TEST=crashpad_util_test RandomString.RandomString
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1451793002 .
2015-11-16 13:39:01 -05:00
Scott Graham
7a7d66ca89 win: Compile getopt as C++ and wrap in crashpad namespace
All our Main()s are in namespace crashpad already, so this just works.

R=mark@chromium.org
BUG=crashpad:76

Review URL: https://codereview.chromium.org/1439113002 .
2015-11-12 14:10:24 -08:00