1 | long g_watch_me_read = 1; |
---|---|
2 | long g_watch_me_write = 2; |
3 | long g_temp = 3; |
4 | |
5 | void watch_read() { |
6 | g_temp = g_watch_me_read; |
7 | } |
8 | |
9 | void watch_write() { g_watch_me_write = g_temp++; } |
10 | |
11 | void read_watchpoint_testing() { |
12 | watch_read(); // break here for read watchpoints |
13 | g_temp = g_watch_me_read; |
14 | } |
15 | |
16 | void watch_breakpoint_testing() { |
17 | watch_write(); // break here for modify watchpoints |
18 | g_watch_me_write = g_temp; |
19 | } |
20 | |
21 | int main() { |
22 | read_watchpoint_testing(); |
23 | watch_breakpoint_testing(); |
24 | return 0; |
25 | } |
26 |