158c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen//===-- main.c --------------------------------------------------*- C++ -*-===// 258c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen// 358c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen// The LLVM Compiler Infrastructure 458c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen// 558c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen// This file is distributed under the University of Illinois Open Source 658c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen// License. See LICENSE.TXT for details. 758c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen// 858c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen//===----------------------------------------------------------------------===// 958c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen#include <stdio.h> 1058c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen#include <stdint.h> 1158c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen 1210b12b3aa8542721fa9485c1d520433de0e0e720Johnny Chenint32_t global = 10; // Watchpoint variable declaration. 13c811f9f60058121e53f2d6b30cb8fc112b13ba26Johnny Chenchar gchar1 = 'a'; 14c811f9f60058121e53f2d6b30cb8fc112b13ba26Johnny Chenchar gchar2 = 'b'; 1558c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen 1658c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chenint main(int argc, char** argv) { 1758c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen int local = 0; 1858c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen printf("&global=%p\n", &global); 1958c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen printf("about to write to 'global'...\n"); // Set break point at this line. 2058c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen // When stopped, watch 'global' for write. 2158c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen global = 20; 22c811f9f60058121e53f2d6b30cb8fc112b13ba26Johnny Chen gchar1 += 1; 23c811f9f60058121e53f2d6b30cb8fc112b13ba26Johnny Chen gchar2 += 1; 2458c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen local += argc; 2558c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen ++local; 2658c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen printf("local: %d\n", local); 2758c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen printf("global=%d\n", global); 28c811f9f60058121e53f2d6b30cb8fc112b13ba26Johnny Chen printf("gchar1='%c'\n", gchar1); 29c811f9f60058121e53f2d6b30cb8fc112b13ba26Johnny Chen printf("gchar2='%c'\n", gchar2); 3058c66e2c4273c101a82ce02e17cc10d338b825bbJohnny Chen} 31