1 //===-- main.c --------------------------------------------------*- 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 #include <stdio.h>
10 #include <stdint.h>
11 
12 int32_t global = 0; // Watchpoint variable declaration.
13 
modify(int32_t & var)14 static void modify(int32_t &var) {
15     ++var;
16 }
17 
main(int argc,char ** argv)18 int main(int argc, char** argv) {
19     int local = 0;
20     printf("&global=%p\n", &global);
21     printf("about to write to 'global'...\n"); // Set break point at this line.
22                                                // When stopped, watch 'global',
23                                                // for the condition "global == 5".
24     for (int i = 0; i < 10; ++i)
25         modify(global);
26 
27     printf("global=%d\n", global);
28 }
29