37 lines · cpp
1// This test is intended to verify that thread states are properly maintained2// when transitional actions are performed in the debugger. Most of the logic3// is in the test script. This program merely provides places where the test4// 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 here19 20 while (!g_test && temp < 5)21 {22 ++temp;23 std::this_thread::sleep_for(std::chrono::seconds(2));24 }25 26 return temp; // Set second breakpoint here27}28 29int main ()30{31 int result = doNothing();32 33 int i = addSomething(result);34 35 return 0;36}37