xref: /llvm-project/lldb/test/API/python_api/thread/main.cpp (revision 845dee36ba4161df153ba05009cea615e20eda5a)
1 #include <stdio.h>
2 
3 // This simple program is to test the lldb Python API related to thread.
4 
5 char my_char = 'u';
6 int my_int = 0;
7 
8 void
call_me(bool should_spin)9 call_me(bool should_spin) {
10     int counter = 0;
11     if (should_spin) {
12         while (1)
13             counter++;  // Set a breakpoint in call_me
14      }
15 }
16 
main(int argc,char const * argv[])17 int main (int argc, char const *argv[])
18 {
19     call_me(false);
20     for (int i = 0; i < 3; ++i) {
21         printf("my_char='%c'\n", my_char);
22         ++my_char;
23     }
24 
25     printf("after the loop: my_char='%c'\n", my_char); // 'my_char' should print out as 'x'.
26 
27     return 0; // Set break point at this line and check variable 'my_char'.
28 }
29