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(format: "&global=%p\n", &global);
11 printf(format: "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(format: "local: %d\n", local);
19 printf(format: "global=%d\n", global);
20 printf(format: "gchar1='%c'\n", gchar1);
21 printf(format: "gchar2='%c'\n", gchar2);
22}
23

source code of lldb/test/API/commands/watchpoints/hello_watchpoint/main.c