tree: aab96fd9923131bb2c48925f5b34f53aa34c5b1f [path history] [tgz]
  5. config.h
  6. configs/
  8. crash_server.h
  10. crashpad_agent.h
  12. meta/
  14. report_annotations.h
  16. report_attachments.h
  17. scoped_unlink.h
  18. tests/

Crash reporting

For development, it is often easier to dump the crash information in the logs as the crash happens on device. For devices in the field, we want to be able to send a report to a remote crash server as well as we might not have access to the devices' logs. We use Crashpad as the third-party client library to talk to the remote crash server.

We control via JSON configuration files whether we upload the Crashpad reports to a crash server and if so, to which crash server. By default, we create a Crashpad report, but we do not upload it.

Adding report annotations

We collect various info in addition to the stack trace, e.g., process names, board names, that we add as annotations to the crash reports. To add a new annotation, simply add a new field in the map returned by ::fuchsia::crash::MakeDefaultAnnotations().


To test your changes, on a real device, we have some unit tests and some helper programs to simulate various crashes.

For the helper programs, you first need to add the package wrapping the config telling Crashpad to upload to a crash server and which server to upload to.

(host)$ fx set --monolith garnet/packages/config/crashpad_upload_to_prod_server --product ...

Then, after running each one of the helper programs (see commands in sections below), you should then look each time for the following line in the syslog:

(host)$ fx syslog --tag crash
successfully uploaded crash report at $URL...

Click on the URL (contact frousseau if you don't have access and think you should) and check that the report matches your expectations, e.g., the new annotation is set to the expected value.

Unit tests

To run the unit tests:

(host) $ fx run-test crashpad_analyzer_tests

Kernel crash

The following command will cause a kernel panic:

(target)$ k crash

The device will then reboot and the system should detect the kernel crash log, attach it to a crash report and try to upload it. Look at the syslog upon reboot.

C userspace crash

The following command will cause a write to address 0x0:

(target)$ crasher

You can immediately look at the syslog.

Dart crash

The following command will cause an uncaught Dart exception:

(target)$ run fuchsia-pkg://

You can immediately look at the syslog.

Question? Bug? Feature request?

Contact frousseau, or file a bug or a feature request.