766 Commits

Author SHA1 Message Date
Mark Mentovai
acabe35928 doc: Fix all Doxygen warnings, cleaning up some generated documentation
This makes Doxygen’s output more actionable by setting QUIET = YES to
suppress verbose progress spew, and WARN_IF_UNDOCUMENTED = NO to prevent
warnings for undocumented classes and members from being generated. The
latter is too noisy, producing 721 warnings in the current codebase.

The remaining warnings produced by Doxygen were useful and actionable.
They fell into two categories: abuses of Doxygen’s markup syntax, and
missing (or misspelled) parameter documentation. In a small number of
cases, pass-through parameters had intentionally been left undocumented.
In these cases, they are now given blank \param descriptions. This is
not optimal, but there doesn’t appear to be any other way to tell
Doxygen to allow a single parameter to be undocumented.

Some tricky Doxygen errors were resolved by asking it to not enter
directiores that we do not provide documentation in (such as the
“on-platform” compat directories, compat/mac and compat/win, as well as
compat/non_cxx11_lib) while allowing it to enter the
“off-platform” directories that we do document (compat/non_mac and
compat/non_win).

A Doxygen run (doc/support/generate_doxygen.sh) now produces no output
at all. It would produce warnings if any were triggered.

Not directly related, but still relevant to documentation,
doc/support/generate.sh is updated to remove temporary removals of
now-extinct files and directories. doc/appengine/README is updated so
that a consistent path to “goapp” is used throughout the file.

Change-Id: I300730c04de4d3340551ea3086ca70cc5ff862d1
Reviewed-on: https://chromium-review.googlesource.com/408812
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 19:24:05 +00:00
Mark Mentovai
952f787f4a doc: Standardize on “macOS” in comments
Use “macOS” as the generic unversioned name of the operating system in
comments. For version-specific references, use Mac OS X through 10.6, OS
X from 10.7 through 10.11, and macOS for 10.12.

Change-Id: I1ebee64fbf79200bc799d4a351725dd73257b54d
Reviewed-on: https://chromium-review.googlesource.com/408269
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-08 19:21:44 +00:00
Mark Mentovai
8e3e65178a Update Doxyfile to 1.8.12
$ doxygen -u doc/support/crashpad.doxy
Configuration file `doc/support/crashpad.doxy' updated.
$ doxygen -v
1.8.12

Change-Id: I1a04869f8d60d15e97de618cc084f5a1fa403103
Reviewed-on: https://chromium-review.googlesource.com/408632
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-07 20:20:21 +00:00
Mark Mentovai
f5e869c51f doc: Check in the man page index instead of generating it
The generated page’s benefit-to-complexity ratio was too low.

BUG=crashpad:138

Change-Id: I5324c33b6b7f83e973c40b256b06e25c763b23c4
Reviewed-on: https://chromium-review.googlesource.com/408268
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-07 18:45:58 +00:00
Mark Mentovai
1f2a2c82c6 doc: Small updates after Markdown migration
The strangest discovery relates to the # <h1> title in navbar.md.
Gitiles renders it small unless there’s a [home] reference, so use that.
This should only affect wrapping the site logo in the [home] link, but
it appears to control the size of the navbar title too. See
https://code.google.com/p/gitiles/issues/detail?id=130.

BUG=crashpad:138,gitiles:130

Change-Id: I11b3a79f045efa22358b3c3ef4b50ce2e6b3282e
Reviewed-on: https://chromium-review.googlesource.com/408458
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-07 18:43:18 +00:00
Mark Mentovai
05c89beaae doc: Another silly follow-up
BUG=crashpad:138

Change-Id: I5ed157b4521cc86fbc75208c3778314535d97ddf
Reviewed-on: https://chromium-review.googlesource.com/408376
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-04 22:16:16 +00:00
Mark Mentovai
6753ba5a5a catch_exception_tool.md: fix on_demand_service_tool link text
BUG=crashpad:138

Change-Id: Id0b8c99a065475181bb9484c4ecf23255d6311f8
Reviewed-on: https://chromium-review.googlesource.com/408356
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-04 22:13:27 +00:00
Mark Mentovai
3830e4e5c1 Update the link to mini_chromium’s README
Also, update mini_chromium to 414d59602ac38e24f1e93929fda3d79d72cea139

7bfe6cd9579b README→README.md; convert plain text to Markdown
414d59602ac3 Fix mailto: link in README.md

BUG=crashpad:138

Change-Id: Ibd3c054a3e7f08a740fe6aca408cf23797d992ae
Reviewed-on: https://chromium-review.googlesource.com/408316
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-04 21:53:31 +00:00
Mark Mentovai
0c41b15496 Convert AsciiDoc documentation to Markdown
Most of the world, including the Chromium universe, seems to be
standardizing on Markdown for documentation. Markdown provides the
benefit of automatic rendering on Gitiles (Gerrit), and on GitHub
mirrors as well. Crashpad should fit in with its surroundings.

There are two quirks that I was unable to resolve.

 - Markdown does not allow **emphasis** within a ```code fence```
   region. In blocks showing interactive examples, the AsciiDoc
   documentation used this to highlight what the user was expected to
   type.
 - Markdown does not have a “definition list” (<dl>). This would have
   been nice in man pages for the Options and Exit Status sections.
   In its place, I used unnumbered lists. This is a little ugly, but
   it’s not the end of the world.

The new Markdown-formatted documentation is largely identical to the
AsciiDoc that it replaces. Minor editorial revisions were made.
References to Mac OS X now mention macOS, and tool man pages describing
tools that that access task ports now mention System Integrity
Protection (SIP).

The AppEngine-based https://crashpad.chromium.org/ app in doc/appengine
is still necessary to serve Doxygen-generated documentation. This app is
updated to redirect existing generated-HTML URLs to Gitiles’ automatic
Markdown rendering.

Scripts in doc/support are updated to adapt to this change. All AsciiDoc
support files in doc/support have been removed.

BUG=crashpad:138

Change-Id: I15ad423d5b7aa1b7aa2ed1d2cb72639eec7c81aa
Reviewed-on: https://chromium-review.googlesource.com/408256
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-11-04 21:13:53 +00:00
Scott Graham
b47bf6c250 Fix tests when running on Win10
The Windows 10 loader starts a few extra threads before main(). In a few
of the test cases, the tests were relying on thread ordering (generally,
the test thread being at index #1). Instead, use other signals to find
the correct thread to verify.

R=mark@chromium.org

Change-Id: Icb1f5a8fdf3a0ea6d82ab65960dbcb650965f269
Reviewed-on: https://chromium-review.googlesource.com/407073
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-03 18:51:01 +00:00
Scott Graham
c4cdec3d72 Handle non-crashing cases for server failure to start
Follow up #4!

R=mark@chromium.org
BUG=chromium:567850,chromium:656800
TEST=tests added to crashpad_client_test

Change-Id: I2a53f2168988e620ce240750c6c2d544ba95c8b4
Reviewed-on: https://chromium-review.googlesource.com/406741
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-03 16:38:22 +00:00
Mark Mentovai
375082098d mac: Fix tests on 10.12.1
crashpad_snapshot_test MachOImageAnnotationsReader.CrashDyld was failing
on 10.12.1. In 10.12, dyld’s intentional crashes come through
abort_with_payload(). In 10.12.1, it appears that the task port sent
along with abort_with_payload() crashes is now a corpse port, which has
a different port name than the task port that it originated from.

https://openradar.appspot.com/29079442

TEST=crashpad_snapshot_test MachOImageAnnotationsReader.CrashDyld
BUG=crashpad:137

Change-Id: I43f89c0f595dd5614fc910fa1f19f21ddf0a7c4d
Reviewed-on: https://chromium-review.googlesource.com/407087
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-03 14:44:42 +00:00
Mark Mentovai
bb7d249d65 Partially port the crashpad_client library to Linux/Android
This defines the global (per-module) CrashpadInfo structure properly on
Linux/Android, located via the “crashpad_info” section name.

Per the ELF specification, section names with a leading dot are reserved
for the system. Reading that, I realized that the same is true of Mach-O
sections with leading underscores, so this renames the section as used
on Mach-O from __DATA,__crashpad_info to __DATA,crashpad_info.

This change is sufficient to successfully build crashpad_client as a
static library on Linux/Android, but the library is incomplete. There’s
no platform-specific database implementation, no CaptureContext() or
CRASHPAD_SIMULATE_CRASH() implementation, and most notably, no
CrashpadClient implementation.

BUG=crashpad:30

Change-Id: I29df7b0f8ee1c79bf8a19502812f59d4b1577b85
Reviewed-on: https://chromium-review.googlesource.com/406427
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-02 23:19:50 +00:00
Scott Graham
55ba6b6780 break; after handling --initial-client-data on command line
Not surprisingly,
"0x278,0x27c,0x280,0x274,0x288,0x978a70,0x978a80,0x978a90" is not a
valid directory to store metrics in.

Fortunately --metrics was processed before --initial-client-data in a
local build, otherwise this could have lurked for a long time. :(

R=mark@chromium.org
BUG=655788,656800

Change-Id: I3ac3d1b487f55ddf0172bac51f8d9efc411c3329
Reviewed-on: https://chromium-review.googlesource.com/406938
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-02 23:13:03 +00:00
Scott Graham
76ef9b5c2b win: Address failure-to-start-handler case for async startup
Second follow up to https://chromium-review.googlesource.com/c/400015/

The ideal would be that if we fail to start the handler, then we don't
end up passing through our unhandled exception filter at all.

In the case of the non-initial client (i.e. renderers) we can do this by
not setting our UnhandledExceptionFilter until after we know we've
connected successfully (because those connections are synchronous from
its point of view). We also change WaitForNamedPipe in the connection
message to block forever, so as long as the precreated pipe exists,
they'll wait to connect. After the initial client has passed the server
side of that pipe to the handler, the handler has the only handle to it.
So, if the handler has disappeared for whatever reason, pipe-connecting
clients will fail with FILE_NOT_FOUND, and will not stick around in the
connection loop. This means non-initial clients do not need additional
logic to avoid getting stuck in our UnhandledExceptionFilter.

For the initial client, it would be ideal to avoid passing through our
UEF too, but none of the 3 options are great:
1. Block until we find out if we started, and then install the filter.
   We don't want to do that, because we don't want to wait.
2. Restore the old filter if it turns out we failed to start. We can't
   do that because Chrome disables ::SetUnhandledExceptionFilter()
   immediately after StartHandler/SetHandlerIPCPipe returns.
3. Don't install our filter until we've successfully started. We don't
   want to do that because we'd miss early crashes, negating the benefit
   of deferred startup.

So, we do need to pass through our UnhandledExceptionFilter. I don't
want more Win32 API calls during the vulnerable filter function. So, at
any point during async startup where there's a failure, set a global
atomic that allows the filter function to abort without trying to signal
a handler that's known to not exist.

One further improvement we might want to look at is unexpected
termination of the handler (as opposed to a failure to start) which
would still result in a useless Sleep(60s). This isn't new behaviour,
but now we have a clear thing to do if we detect the handler is gone.

(Also a missing DWORD/size_t cast for the _x64 bots.)

R=mark@chromium.org
BUG=chromium:567850,chromium:656800

Change-Id: I5be831ca39bd8b2e5c962b9647c8bd469e2be878
Reviewed-on: https://chromium-review.googlesource.com/400985
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-11-02 21:39:52 +00:00
Mark Mentovai
c55e49c13d doc: Remove errant parenthesis
Also add a link to codereview.settings.

Change-Id: Id6676e16fa3e10e34805c47b2d41e82e524af09a
Reviewed-on: https://chromium-review.googlesource.com/406707
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-02 15:26:12 +00:00
Mark Mentovai
96b9857ace Fix the crashpad_minidump library for 32-bit ARM.
ARCH_CPU_ARMEL, not ARCH_CPU_ARM. This is probably going to bite again.

BUG=crashpad:30

Change-Id: Ifa6069638c72db13b7f6498471f9ca3ad7c45b90
Reviewed-on: https://chromium-review.googlesource.com/406407
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-01 21:17:39 +00:00
Mark Mentovai
88e3b6b022 Omit platform-specific assembler source from builds as needed
The default filename rules do not match .S or .asm, so the
platform-specific assembler implementations of CaptureContext() were not
being affirmatively excluded from other platforms’ builds. This
previously worked without causing problems because the Mac build
environment didn’t know what to do with .asm files, and the Windows
build environment didn’t know what to do with .S files. Now that another
platform that may understand .S files is being added, the rules for when
to build these files must be tailored a bit more tightly.

BUG=crashpad:30

Change-Id: Ib62e619c007320d45279c104b3e229d92698aa72
Reviewed-on: https://chromium-review.googlesource.com/406348
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-01 21:17:02 +00:00
Mark Mentovai
47a830465f Port the minidump library to Android and ARM
BUG=crashpad:30

Change-Id: I74212722b73f498c263f65d7599a8aca601c7ba0
Reviewed-on: https://chromium-review.googlesource.com/406387
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-01 20:32:37 +00:00
Mark Mentovai
e616638c9d Replace Rietveld with Gerrit in the developer documentation
Also, update a few links for good measure.

Change-Id: I47113a4f324e4ad6ba02aa46bae821eefd4d98ea
Reviewed-on: https://chromium-review.googlesource.com/406347
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-01 18:59:36 +00:00
Mark Mentovai
e7bd798af4 Update build/test and status documentation to reflect Android
BUG=crashpad:30

Change-Id: I0170e95e43146f6a2af6b6753c5197794bd83817
Reviewed-on: https://chromium-review.googlesource.com/406307
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-01 18:34:56 +00:00
Mark Mentovai
fd751f4708 Correct StringToUnsignedInt[64]()
StringToUnsignedInt[64]Traits::Convert() was returning in its failure
(negative input) case without touching *end. Its caller relies on *end
to detect failure.

Change-Id: I636f95471cd499434743e73f0e5e0b60c0871795
Reviewed-on: https://chromium-review.googlesource.com/405468
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-11-01 15:57:36 +00:00
Scott Graham
c2814e2519 Don't throttle explicitly requested uploads
R=mark@chromium.org
BUG=chromium:660955

Change-Id: Ia31846fe3487a52f4cad34859e23a7192ca4065e
Reviewed-on: https://chromium-review.googlesource.com/405533
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-31 21:17:45 +00:00
Mark Mentovai
b978b03fa1 Port most of crashpad_util_test to Linux/Android
- In the ProcessInfo test, port the global argc/argv getter to Linux by
   reading /proc/self/cmdline.
 - Use <inttypes.h> format macros for 64-bit types.
 - Only #include <sys/sysctl.h> on macOS.
 - #include <signal.h> instead of <sys/signal.h>.

In order to test on Linux/Android, the following changes to the
crashpad_util_test target must be made until more porting is complete:

 - Remove the dependency on crashpad_client because that library has not
   been ported yet.
 - Remove process_info_test.cc because it depends on crashpad_client and
   there is no implementation of ProcessInfo for Linux yet.
 - Remove http_transport_test.cc because there is no HTTPTransport
   implementation for Linux or Android yet.
 - Remove checked_address_range_test.cc because checked_address_range.cc
   does not yet expose a cross-bit usable type for addresses and sizes
   on Linux.

BUG=crashpad:30
TEST=crashpad_util_test

Change-Id: Ic17cf26bdf19b3eff3915bb1acdaa701f28222cd
Reviewed-on: https://chromium-review.googlesource.com/405647
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-10-31 21:07:06 +00:00
Mark Mentovai
d1aafe78ea Port the test library and crashpad_test_test to Linux/Android
- Linux (but not Android) provides __fpurge() instead of fpurge().
 - In multiprocess_exec_test_child, use getrlimit(RLIMIT_NOFILE) instead
   of max(sysconf(_SC_OPEN_MAX), OPEN_MAX, getdtablesize()). OPEN_MAX is
   not availble on Linux (but is in Android as a bogus value), and
   getdtablesize() is not available in Android since 5.0.0 (API 21).
   sysconf(_SC_OPEN_MAX) and getdtablesize() both return
   getrlimit(RLIMIT_NOFILE) on all relevant platforms.
 - Add a Linux/Android implementation of test::Paths::Executable().
 - Respect TMPDIR for all POSIX platforms in
   ScopedTempDir::CreateTemporaryDirectory(). If TMPDIR is unset or
   empty, use /tmp, except on Android, where /tmp does not exist and
   /data/local/tmp is used instead.

Also:

 - Fix the Mac and Windows implementations of test::Paths::Executable()
   to abort on fatal error, in line with the new Linux/Android version.

BUG=crashpad:30
TEST=crashpad_test_test

Change-Id: I98a50d8579b193c813ba79794be087649e94cc06
Reviewed-on: https://chromium-review.googlesource.com/405507
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-10-31 19:30:24 +00:00
Mark Mentovai
d5a759c900 Update mini_chromium to 8e8d3cc9a245f1bf63296e97fb6ac1c90f6d86f5
9f129335dbe5 Add Android and ARM support to mini_chromium base
1d3e5ef89ad0 Link Linux/Android executables with -pie for position
             independence
8e8d3cc9a245 Add Android to filename_rules.gypi

BUG=crashpad:30

Change-Id: Idace661e0ffa598f5c2a2a4af2d578355c101c56
Reviewed-on: https://chromium-review.googlesource.com/405567
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-10-31 17:42:54 +00:00
Mark Mentovai
e956a8252f Port the util library to Android
With this change, it is possible to build crashpad_util for Android with
clang. I built with NDK 13b (clang 3.8) at API 24 (current), API 21
(used by Chrome in 64-bit builds), and API 16 (used by Chrome in 32-bit
builds).

 - In WeakFileHandleFileWriter::WriteIoVec(): Android does not expose
   the IOV_MAX macro, but its value can be obtained by calling
   sysconf(_SC_IOV_MAX).
 - In CloseMultipleNowOrOnExec(): API 21 removes getdtablesize(). Skip
   it, because it returned the same thing as sysconf(_SC_OPEN_MAX),
   which is already consulted.
 - Throughout: Various #ifdefs checking for OS_LINUX have been extended
   to also check for OS_ANDROID. In Chrome’s build_config.h (and thus
   mini_chromium’s), OS_LINUX is not defined when OS_ANDROID is.

This has not been tested beyond building the crashpad_util target.

BUG=crashpad:30

Change-Id: Ieb0bed736029d2d776c534e30e534f186e6fb663
Reviewed-on: https://chromium-review.googlesource.com/405267
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-10-31 15:23:43 +00:00
Mark Mentovai
f735d050c4 Port the util library to Linux
With this change, it is possible to build crashpad_util on Linux. I
built with clang 3.8.1 and GCC 6.2.0.

 - For per-OS “exception code” metrics, Android and Linux are broken out
   distinctly.
 - Because Linux provides no standard UUID generator, base::RandBytes()
   is used to generate random UUIDs for the InitializeWithNew() form.
 - Multiple fixes for CloseMultipleNowOrOnExec():
    - readdir_r() is deprecated in glibc 2.24. Use readdir() on Linux.
    - Linux does not have OPEN_MAX. Use the fs.nr_open sysctl (via
      /proc/sys) to determine the maximum (currently-configured)
      possible number of file descriptors per process.
    - Use the {CTL_KERN, KERN_MAXFILESPERPROC} sysctl on Mac to
      determine the maximum (currently-configured) possible number of
      file descriptors per process. This is an improvement over using
      OPEN_MAX, which is still consulted.
 - ThreadLogMessages’ use of DCHECK_EQ() needs an address-of operator on
   function pointers to avoid confusing GCC.

One problem remains:

 - util/misc/pdb_structures.h produces -Wmultichar errors. -Wmultichar
   is enabled by default with GCC (but not clang). It is impossible to
   disable this warning with #pragma GCC diagnostic ignored. See
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

This has not been tested beyond building the crashpad_util target.

BUG=crashpad:30

Change-Id: I02e7a05da512ca312806d825b3fc9b2c5bf1a990
Reviewed-on: https://chromium-review.googlesource.com/404009
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-10-31 15:20:59 +00:00
Scott Graham
cc0b7deef2 Get VS2013 compilation working again for Crashpad
Follow up #1 to https://chromium-review.googlesource.com/c/400015/,
still pending further discussion on details of registration.

R=mark@chromium.org
BUG=chromium:567850,chromium:656800

Change-Id: Idfee3a3241d7cfe418fbf9e40f17f35e5dbefac9
Reviewed-on: https://chromium-review.googlesource.com/401182
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-22 00:05:02 +00:00
Scott Graham
2d87606bb5 win: Start crashpad_handler by inheriting connection data to it
Previously, StartHandler() launched the handler process, then connected
over a pipe to register for crash handling. Instead, the initial client
can create and inherit handles to the handler and pass those handle
values and other data (addresses, etc.) on the command line.

This should improve startup time as there's no need to synchronize with
the process at startup, and allows avoiding a call to CreateProcess()
directly in StartHandler(), which is important for registration for
crash reporting from DllMain().

Incidentally adds new utility functions for string/number conversion and
string splitting.

Note: API change; UseHandler() is removed for all platforms.

BUG=chromium:567850,chromium:656800

Change-Id: I1602724183cb107f805f109674c53e95841b24fd
Reviewed-on: https://chromium-review.googlesource.com/400015
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-21 20:35:58 +00:00
Erik Chen
1e6dbcb300 Support passing DEVELOPER_DIR to mig.py
BUG=chromium:651267

Change-Id: If02f9bac603237677d348869d05d7b4d0b31909e
Reviewed-on: https://chromium-review.googlesource.com/392486
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-10-04 14:50:45 +00:00
Scott Graham
a16a7fd4ef win: Make DumpAndCrash() always terminate, and tidy up special codes
Upstreaming with tidying up of
https://codereview.chromium.org/2377693002/.

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

Change-Id: Ie8b3b673c8d2a06c5cc918a034688aa9396cfbf4
Reviewed-on: https://chromium-review.googlesource.com/390436
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-29 04:44:20 +00:00
Scott Graham
5a6c961658 Add metric for handler crash on Windows
R=mark@chromium.org
BUG=crashpad:100

Change-Id: I80de83d133cd9968af17e50798d6a5c6bd121b4b
Reviewed-on: https://chromium-review.googlesource.com/390480
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-28 20:43:24 +00:00
Scott Graham
ac6c01b575 Add metrics for tracking uploads
Three new metrics:
- counting upload success/failure;
- enum tracking the reason upload was skipped;
- enum describing how an upload got to the pending state.

R=mark@chromium.org, asvitkine@chromium.org
BUG=crashpad:100

Change-Id: I5e0cbc1ac3424e974f3a51560e5cdad484ffc038
Reviewed-on: https://chromium-review.googlesource.com/388855
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-26 22:09:32 +00:00
Scott Graham
0aeca5f123 UMA changes based on Chromium-side review
Per comments in https://codereview.chromium.org/2350943003/:
- Increase the upper bound for Crashpad.CrashReportSize to 20M
- Make ExceptionEncountered a 2 enum bucket to track start/end.

R=asvitkine@chromium.org, mark@chromium.org
BUG=crashpad:100

Change-Id: Ie848b2e3744c58f6d669986d3e78e7391b0e9e68
Reviewed-on: https://chromium-review.googlesource.com/387685
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-21 18:05:14 +00:00
Scott Graham
007f790fe2 static const on const char[] for UMA string
By request on https://codereview.chromium.org/2350943003.

BUG=crashpad:100

Change-Id: I64292793dd51e72d102d90506181ae0fc7ef1c63
Reviewed-on: https://chromium-review.googlesource.com/387195
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-20 21:49:50 +00:00
Scott Graham
17167a1e57 static_cast UMA 'enum class's to int
Otherwise, the Chromium expansions complain about not being able to add
and needing explicit conversions.

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

Change-Id: I0540a8dabff61f2189d9532422adae5c2885ae03
Reviewed-on: https://chromium-review.googlesource.com/387166
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-20 00:24:54 +00:00
Scott Graham
72a12e2e94 Make UMA for exception code OS-specific
R=wfh@chromium.org, mark@chromium.org
BUG=crashpad:100

Change-Id: I9368168405d1bd761ae6205955968264543541c4
Reviewed-on: https://chromium-review.googlesource.com/386989
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-19 21:57:18 +00:00
Scott Graham
b48e9bfbab Add UMA to exception handler exception catching
Includes mini_chromium DEPS roll for:
88e0a3e Add stub of sparse_histogram.h

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

Change-Id: I4c541a33be0f7f47e972af638d4765bd06682acf
Reviewed-on: https://chromium-review.googlesource.com/386385
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-19 18:10:31 +00:00
Scott Graham
23d31c4fea Fix Mac build after 27aeb2c9
Oh yeah, that other platform.

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

Change-Id: Iaacd9a2a4a9754a26af9dd78f5b12cb1523ea19b
Reviewed-on: https://chromium-review.googlesource.com/386785
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-16 20:41:50 +00:00
Scott Graham
27aeb2c9da Upstream Chromium UMA integration
Unmodified from https://codereview.chromium.org/2308763002/ other than
to add empty arguments to test code (that doesn't build in Chrome).

Requires https://chromium-review.googlesource.com/c/386236/.

Rolls mini_chromium to include:
438bd4f4 Add stub of persistent_histogram_allocator.h

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

Change-Id: Ibc88338ae2fd40a5a4ade7ff098be2bc19511543
Reviewed-on: https://chromium-review.googlesource.com/386084
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-16 20:23:06 +00:00
Mark Mentovai
0c29022090 Update mini_chromium to 7800285e83df4286981bb933e3335edade7c8308
7800285e83df Don't #undef UMA_HISTOGRAM_UNUSED

Change-Id: I6a694ae17dcafb2663485a0fecc551dad661449c
Reviewed-on: https://chromium-review.googlesource.com/384031
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-09 22:18:52 +00:00
Scott Graham
afc177ee21 Pull metrics instrumentation out to central file
Solves two problems with having the macros inline:

1. Deduplicates some of the logic (in this case, the name of the
   histogram, and whether it should be divided by 1024);

2. More useful check for compilation. As the macros are no-ops in
   Crashpad, it was easy to use the wrong name for a variable in the
   arguments to the macros (see .mm!)

This way, we have some better chance of at least having code that
compiles when built in Chromium if all the arguments are passed to
Metrics::Something() in a standalone build.

Also rolls mini_chromium DEPS to include:
99213eb Mark histogram arguments as unused to avoid warnings

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

Change-Id: I9f7fc3b85854fd61c1ebdf0084d728a7b690c2f1
Reviewed-on: https://chromium-review.googlesource.com/380445
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-02 19:13:00 +00:00
Scott Graham
5f42313ed5 Test first integration of UMA plumbing
Add a first example of a UMA entry to have it available to try to plumb
through to Chromium.

Adds LoggingFileSizeByHandle() to util/file/file_io.* to retrieve the
size of on disk file to report to UMA.

Also rolls DEPS for mini_chromium to include:
b5ec9ce Add stub versions of histogram_macros.h

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

Change-Id: Ib8e96ad4b7d715b46d2c71810c95c92965a89821
Reviewed-on: https://chromium-review.googlesource.com/338821
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-09-02 00:04:29 +00:00
Scott Graham
c6f88d164e Have MinidumpMemoryListWriter deal directly in SnapshotMinidumpMemoryWriters
This is as a precursor to
https://chromium-review.googlesource.com/374539 which merges
MemorySnapshots and so needs to be able to update them from the minidump
code.

MinidumpMemoryWriter existed to be able to mock for tests; that
behaviour is wrapped up in TestMemorySnapshot now.

BUG=crashpad:61, chromium:638370

Change-Id: I825ec57493b12fc1848018585c14544faa7e66d4
Reviewed-on: https://chromium-review.googlesource.com/374019
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-25 22:09:20 +00:00
Scott Graham
357c7c7b7b win: Add some explanation of .com/.exe for crashpad_handler
R=mark@chromium.org
BUG=

Change-Id: Iedc42c7a157967c6fc316c04bb0bbb1f97dadf8d
Reviewed-on: https://chromium-review.googlesource.com/371963
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-24 23:01:15 +00:00
Scott Graham
866e60749c Add >nul to editbin command to suppress \n in build output
R=mark@chromium.org

Change-Id: Ie22b12e42196f3fa3ce797ad04ffc38981f6e9ac
Reviewed-on: https://chromium-review.googlesource.com/374084
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-24 22:54:27 +00:00
Gayane Petrosyan
b35ee1fca1 Adding support for on-demand uploads.
In order to allow on-demand uploads for crash reports, adding a
upload_explicitly_requested bit on 'pending' state and necessary support
for it.

BUG=chromium:620762

Change-Id: Ida38e483fe8d0e48eb5cbe95e8b8bfd96a2f8f00
Reviewed-on: https://chromium-review.googlesource.com/367328
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
2016-08-24 21:57:02 +00:00
Scott Graham
660a5e69d6 win: switch crashpad_handler.exe to /subsystem:windows and add .com
This switches the default behaviour of crashpad_handler.exe to be a
/subsystem:windows app, so that normal usage won't cause a console to be
popped up. At the same time, creates a copy of crashpad_handler.exe in
the output dir named crashpad_handler.com. The .com doesn't affect
normal operation, as the way StartHandler() uses CreateProcess()
requires a real path to a file. However, when run from a command prompt,
.com are found before .exe, so editbin the .com to be to a console app,
which will be run in preference to the exe when run as just
"crashpad_handler", as one tends to do from a command prompt when
debugging. That is:

  d:\src\crashpad\crashpad\out\Debug>where crashpad_handler
  d:\src\crashpad\crashpad\out\Debug\crashpad_handler.com
  d:\src\crashpad\crashpad\out\Debug\crashpad_handler.exe

  d:\src\crashpad\crashpad\out\Debug>crashpad_handler --help
  Usage: crashpad_handler [OPTION]...
  ...

  d:\src\crashpad\crashpad\out\Debug>crashpad_handler.exe --help
  <no output>

  d:\src\crashpad\crashpad\out\Debug>crashpad_handler.com --help
  Usage: crashpad_handler.com [OPTION]...
  ...

We also use the .com file in test invocations so that output streams
will be visible.

R=mark@chromium.org

Change-Id: I1a27f88472d491b2a1d76e63c45e6415d9f679c0
Reviewed-on: https://chromium-review.googlesource.com/371578
Reviewed-by: Mark Mentovai <mark@chromium.org>
2016-08-17 20:50:47 +00:00
Mark Mentovai
9807cba2f4 end_to_end_test: accept mangled anonymous namespaces from cdb
When crashy_test_program's SomeCrashyFunction is inlined into
CrashyMain, cdb doesn't demangle the decorated form of an anonymous
namespace (?A0x12345678) into the expected `anonymous namespace' string.

I experienced this in Release_x64 and Release modes using MSVS 2015
update 3 (14.0.25420.1, cl 19.00.24213.1) and cdb versions 10.0.10240.9
and 10.0.14321.1024.

BUG=crashpad:129

Change-Id: I0a665b88891c271253adccd9b2b414fcaac26c8f
Reviewed-on: https://chromium-review.googlesource.com/368730
Reviewed-by: Scott Graham <scottmg@chromium.org>
2016-08-12 17:33:28 +00:00