23 lines · c
1#include <stdio.h>2#include <stdint.h>3 4int32_t global = 10; // Watchpoint variable declaration.5char gchar1 = 'a';6char gchar2 = 'b';7 8int main(int argc, char** argv) {9 int local = 0;10 printf("&global=%p\n", &global);11 printf("about to write to 'global'...\n"); // Set break point at this line.12 // When stopped, watch 'global' for write.13 global = 20;14 gchar1 += 1;15 gchar2 += 1;16 local += argc;17 ++local;18 printf("local: %d\n", local);19 printf("global=%d\n", global);20 printf("gchar1='%c'\n", gchar1);21 printf("gchar2='%c'\n", gchar2);22}23