Home | History | Annotate | Download | only in state
      1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // This test is intended to verify that thread states are properly maintained
     11 // when transitional actions are performed in the debugger.  Most of the logic
     12 // is in the test script.  This program merely provides places where the test
     13 // can create the intended states.
     14 
     15 #include <unistd.h>
     16 
     17 volatile int g_test = 0;
     18 
     19 int addSomething(int a)
     20 {
     21     return a + g_test;
     22 }
     23 
     24 int doNothing()
     25 {
     26     int temp = 0;   // Set first breakpoint here
     27 
     28     while (!g_test && temp < 5)
     29     {
     30         ++temp;
     31         sleep(1);
     32     }
     33 
     34     return temp;    // Set second breakpoint here
     35 }
     36 
     37 int main ()
     38 {
     39     int result = doNothing();
     40 
     41     int i = addSomething(result);
     42 
     43     return 0;
     44 }
     45