A Code Monkey's Blog

GDB: How to set a watchpoint to watch the change of variable

Step 1: Print the address of the variable you are going to watch. p *your_variable (Suppose the address is 0x12345678 Step 2: Set watchpoint watch *0x12345678