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