1#include <dlfcn.h>
2#include <stdio.h>
3#include <thread>
4#include <unistd.h>
5
6void f1() {
7 while (1)
8 sleep(seconds: 1);
9}
10void f2() {
11 while (1)
12 sleep(seconds: 1);
13}
14void f3() {
15 while (1)
16 sleep(seconds: 1);
17}
18
19int main() {
20 std::thread t1{f1};
21 std::thread t2{f2};
22 std::thread t3{f3};
23
24 puts(s: "break here");
25
26 void *handle = dlopen(file: "libfoo.dylib", RTLD_LAZY);
27 int (*foo_ptr)() = (int (*)())dlsym(handle: handle, name: "foo");
28 int c = foo_ptr();
29
30 // clang-format off
31 // multiple function calls on a single source line so 'step'
32 // and 'next' need to do multiple steps of work.
33 puts(s: "1"); puts(s: "2"); puts(s: "3"); puts(s: "4"); puts(s: "5");
34 puts(s: "6"); puts(s: "7"); puts(s: "8"); puts(s: "9"); puts(s: "10");
35 puts(s: "11"); puts(s: "12"); puts(s: "13"); puts(s: "14"); puts(s: "15");
36 puts(s: "16"); puts(s: "17"); puts(s: "18"); puts(s: "19"); puts(s: "20");
37 puts(s: "21"); puts(s: "22"); puts(s: "23"); puts(s: "24"); puts(s: "24");
38 // clang-format on
39 puts(s: "one");
40 puts(s: "two");
41 puts(s: "three");
42 puts(s: "four");
43 puts(s: "five");
44 puts(s: "six");
45 puts(s: "seven");
46 puts(s: "eight");
47 puts(s: "nine");
48 puts(s: "ten");
49 c++;
50 c++;
51 c++;
52 c++;
53 c++;
54 c++;
55 c++;
56 c++;
57 c++;
58 c++;
59 c++;
60 c++;
61 return c;
62}
63

source code of lldb/test/API/macosx/expedited-thread-pcs/main.cpp