1// Example source from breakpad's linux tutorial
2// https://chromium.googlesource.com/breakpad/breakpad/+/main/docs/linux_starter_guide.md
3
4#include <stdio.h>
5#include <sys/types.h>
6#include <unistd.h>
7
8#include "client/linux/handler/exception_handler.h"
9
10static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor,
11 void *context, bool succeeded) {
12 printf("Dump path: %s\n", descriptor.path());
13 return succeeded;
14}
15
16void crash() {
17 volatile int *a = (int *)(NULL);
18 *a = 1;
19}
20
21int main(int argc, char *argv[]) {
22 google_breakpad::MinidumpDescriptor descriptor("/tmp");
23 google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL,
24 true, -1);
25 printf(format: "pid: %d\n", getpid());
26 crash();
27 return 0;
28}
29

source code of lldb/unittests/Process/minidump/Inputs/linux-x86_64.cpp