mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 09:55:40 +01:00
bd4a28c08b
On Linux, it is possible to register a core handler via /proc/sys/kernel/core_pattern. Doing so invokes the core handler when a process crash. The core_handler uses /proc/<pid>/mem to access the process memory. This way it is not necessary to process the full coredump which takes time and consumes memory. In order to profit from this core handler, for example, one can integrate dump_syms into Yocto and generate an archive with the breakpad symbols of all the binaries in the rootfs. Minidumps are especially useful on embedded systems since they are lightweight and provide contextual information. Change-Id: I9298d81159029cefb81c915831db54884310ad05 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2536917 Reviewed-by: Mike Frysinger <vapier@chromium.org>
40 lines
1.4 KiB
Markdown
40 lines
1.4 KiB
Markdown
# How To Use Breakpad As a Coredump Handler on Linux
|
|
|
|
This document presents a way to use Breakpad in order to generate
|
|
minidumps system wide on Linux.
|
|
|
|
Please refer to [Linux starter guide](./linux_starter_guide.md) if
|
|
instead you want to integrate breakpad into your application.
|
|
|
|
## Motivation
|
|
|
|
When working on an embedded system, disk and memory space is often
|
|
limited and when a process crashes it must be restarted as soon as
|
|
possible. Sometime saving a full coredump takes to much time or
|
|
consumes too much space.
|
|
|
|
## Breakpad Core Handler
|
|
|
|
In such case the program `core_handler` can be use to generate
|
|
minidumps instead of coredumps. `core_handler` reads the firsts
|
|
sections of the coredump (where the various threads are described)
|
|
generated by Linux from the standard input and then directly reads
|
|
`/proc/<pid>/mem` to reconstruct the stacktraces.
|
|
|
|
One can test it with:
|
|
|
|
```
|
|
# echo "|/usr/libexec/core_handler %P /var/lib/minidump/%e-%i.md" >
|
|
/proc/sys/kernel/core_pattern
|
|
# echo 1 > /proc/sys/kernel/core_pipe_limit
|
|
```
|
|
|
|
Be aware that a real world integration would likely require further
|
|
customization and so `core_handler` can be wrapped into a script (for
|
|
example to change the permission of the minidump file or to signal the
|
|
presence of the minidump to another service).
|
|
|
|
Please refer to
|
|
[core(5)](https://man7.org/linux/man-pages/man5/core.5.html) for more
|
|
details.
|