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