tree: aab96fd9923131bb2c48925f5b34f53aa34c5b1f [path history] [tgz]
  1. configs/
  2. meta/
  3. tests/
  4. BUILD.gn
  5. config.cc
  6. config.h
  7. crash_server.cc
  8. crash_server.h
  9. crashpad_agent.cc
  10. crashpad_agent.h
  11. main.cc
  12. OWNERS
  13. README.md
  14. report_annotations.cc
  15. report_annotations.h
  16. report_attachments.cc
  17. report_attachments.h
  18. scoped_unlink.h
src/developer/crashpad_agent/README.md

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().

Testing

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://fuchsia.com/crasher_dart#meta/crasher_dart.cmx

You can immediately look at the syslog.

Question? Bug? Feature request?

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