1// This test is intended to verify that thread states are properly maintained
2// when transitional actions are performed in the debugger. Most of the logic
3// is in the test script. This program merely provides places where the test
4// can create the intended states.
5
6#include <chrono>
7#include <thread>
8
9volatile int g_test = 0;
10
11int addSomething(int a)
12{
13 return a + g_test;
14}
15
16int doNothing()
17{
18 int temp = 0; // Set first breakpoint here
19
20 while (!g_test && temp < 5)
21 {
22 ++temp;
23 std::this_thread::sleep_for(rtime: std::chrono::seconds(2));
24 }
25
26 return temp; // Set second breakpoint here
27}
28
29int main ()
30{
31 int result = doNothing();
32
33 int i = addSomething(a: result);
34
35 return 0;
36}
37

source code of lldb/test/API/functionalities/thread/state/main.cpp