14c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen//===-- main.c --------------------------------------------------*- C++ -*-===// 24c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen// 34c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen// The LLVM Compiler Infrastructure 44c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen// 54c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen// This file is distributed under the University of Illinois Open Source 64c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen// License. See LICENSE.TXT for details. 74c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen// 84c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen//===----------------------------------------------------------------------===// 94c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen#include <stdio.h> 104c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen#include <stdint.h> 114c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen 124c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chenint32_t global = 10; // Watchpoint variable declaration. 134c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen 144c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chenint main(int argc, char** argv) { 154c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen int local = 0; 164c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen printf("&global=%p\n", &global); 174c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen printf("about to write to 'global'...\n"); // Set break point at this line. 18ad0134d454ddeaed6b9d2ba9b46995bdac336ab3Johnny Chen // When stopped, watch 'global' for read&write. 194c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen global = 20; 204c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen local += argc; 214c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen ++local; 224c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen printf("local: %d\n", local); 234c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen printf("global=%d\n", global); 244c24b0a9f72c09d2e442ab9dbbf270b6e930f1e8Johnny Chen} 25