Reputation: 734
I use "watch" command of gdb to track the value of one address. However, gdb only stops when the value is changed to a different one. So how to stop the process whenever the value of the address is assigned a new value, so condition that the same value is assigned will also stops the process.
Upvotes: 1
Views: 1203
Reputation: 213955
So how to stop the process whenever the value of the address is assigned a new value ... (which could be the same as old value).
There is currently no way to do that in GDB.
Although it's not hard to implement this in GDB, the need to do this is rare (the program state is not changed, so why do you care that the same value is written to memory as it was before?).
You can use rwatch
to break whenever the value is read. That will give you a superset of your desired break locations, though if the variable is read a lot, and written rarely, rwatch
may not be a good solution.
Upvotes: 1