1#include <stdlib.h>
2#include <thread>
3#include <unistd.h>
4#include <vector>
5
6void *sleep_worker(void *in) {
7 sleep(seconds: 30);
8 sleep(seconds: 30);
9 return nullptr;
10}
11
12void *crash_worker(void *in) {
13 sleep(seconds: 1);
14 volatile int *p = nullptr; // break here
15 return (void *)*p;
16}
17
18int main() {
19 std::vector<std::thread> threads;
20 threads.push_back(x: std::move(std::thread(crash_worker, nullptr)));
21 for (int i = 0; i < 15; i++)
22 threads.push_back(x: std::move(std::thread(sleep_worker, nullptr)));
23 sleep(seconds: 10);
24}
25

source code of lldb/test/API/macosx/corefile-exception-reason/main.cpp