1#include <lwp.h>
2#include <stddef.h>
3#include <stdlib.h>
4
5static void bar(char *boom) {
6 char F = 'b';
7 *boom = 47; // Frame bar
8}
9
10static void foo(char *boom, void (*boomer)(char *)) {
11 char F = 'f';
12 boomer(boom); // Frame foo
13}
14
15void lwp_main(void *unused) {
16 char F = 'l';
17 foo(boom: 0, boomer: bar); // Frame lwp_main
18}
19
20int main(int argc, char **argv) {
21 ucontext_t uc;
22 lwpid_t lid;
23 static const size_t ssize = 16 * 1024;
24 void *stack;
25
26 stack = malloc(size: ssize);
27 _lwp_makecontext(&uc, lwp_main, NULL, NULL, stack, ssize);
28 _lwp_create(&uc, 0, &lid);
29 _lwp_wait(lid, NULL);
30}
31

source code of lldb/test/API/functionalities/postmortem/netbsd-core/2lwp_t2_SIGSEGV.c