Home | History | Annotate | Download | only in hello_watchpoint
      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 = 10; // Watchpoint variable declaration.
     13 char gchar1 = 'a';
     14 char gchar2 = 'b';
     15 
     16 int main(int argc, char** argv) {
     17     int local = 0;
     18     printf("&global=%p\n", &global);
     19     printf("about to write to 'global'...\n"); // Set break point at this line.
     20                                                // When stopped, watch 'global' for write.
     21     global = 20;
     22     gchar1 += 1;
     23     gchar2 += 1;
     24     local += argc;
     25     ++local;
     26     printf("local: %d\n", local);
     27     printf("global=%d\n", global);
     28     printf("gchar1='%c'\n", gchar1);
     29     printf("gchar2='%c'\n", gchar2);
     30 }
     31