1 //===-- main.c --------------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 #include <stdio.h> 9 #include <stdint.h> 10 11 int32_t global = 0; // Watchpoint variable declaration. 12 int32_t cookie = 0; 13 14 static void modify(int32_t &var) { 15 ++var; 16 } 17 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 for (int i = 0; i < 10; ++i) 23 modify(global); 24 25 printf("global=%d\n", global); 26 printf("cookie=%d\n", cookie); 27 } 28