gecko-dev/toolkit/crashreporter/mozwer
Gabriele Svelto 277338b229 Bug 1682509 - Add a Windows Error Reporting exception module capable of writing out crash reports r=dmajor
This is a minimal implementation of a WER exception module that can intercept
crashes of Firefox processes and write out a fully formed crash report, that is
a minidump, an .extra file containing the minimum annotations required by
Socorro and an event file.

The module in and by itself is not functional: an entry needs to be added to
the registry and the processes which want to be monitored need to register it
at runtime. With this patch applied it will only be built but it won't be
packaged with Firefox nor it will be used when doing local development.

The module implementation has a few notable properties:

* We use an empty C++ shim (mozwer) to build the module DLL. This is
  because the build system doesn't support building DLLs directly from Rust.
* The actual implementation is written in Rust (mozwer-rust) and exposes the
  callbacks that will be invoked by the WER service.
* We use the winapi crate to access Windows native functionality but given it
  is missing some bits (including upstream!) we declare them in our crate for
  the time being.
* The minidump uses the same options we use in Firefox and should be of
  similar size. I manually tested different type of crashes including
  __fastail() ones and they're all reliably captured.
* The .extra file contains only the annotations that are strictly required for
  submitting the crash to crash-stats.mozilla.org. More should be added in the
  future. The existing annotations are all extracted from within the module
  code because we have no way to access the ones that were stored in Firefox'
  crashed processes (nor should we, since we hope to catch crashes that happen
  even before Firefox sets up crash reporting internally).
* The module does not distinguish between main process and content process
  crashes at the moment. This will need to be implemented when we hook it up
  with the crash reporting code within Firefox.
* We use libc's time() function to get the crash time in order to be consistent
  with what the regular exception handler does.

Differential Revision: https://phabricator.services.mozilla.com/D101708
2021-04-07 07:55:23 +00:00
..
moz.build
mozwer.cpp
mozwer.def