1# How To Use Breakpad As a Coredump Handler on Linux 2 3This document presents a way to use Breakpad in order to generate 4minidumps system wide on Linux. 5 6Please refer to [Linux starter guide](./linux_starter_guide.md) if 7instead you want to integrate breakpad into your application. 8 9## Motivation 10 11When working on an embedded system, disk and memory space is often 12limited and when a process crashes it must be restarted as soon as 13possible. Sometime saving a full coredump takes to much time or 14consumes too much space. 15 16## Breakpad Core Handler 17 18In such case the program `core_handler` can be use to generate 19minidumps instead of coredumps. `core_handler` reads the firsts 20sections of the coredump (where the various threads are described) 21generated by Linux from the standard input and then directly reads 22`/proc/<pid>/mem` to reconstruct the stacktraces. 23 24One can test it with: 25 26``` 27# echo "|/usr/libexec/core_handler %P /var/lib/minidump/%e-%i.md" > 28 /proc/sys/kernel/core_pattern 29# echo 1 > /proc/sys/kernel/core_pipe_limit 30``` 31 32Be aware that a real world integration would likely require further 33customization and so `core_handler` can be wrapped into a script (for 34example to change the permission of the minidump file or to signal the 35presence of the minidump to another service). 36 37Please refer to 38[core(5)](https://man7.org/linux/man-pages/man5/core.5.html) for more 39details. 40