An earlier question explained that on x86 the size of objects being watched is limited by debug registers. As expected, I can \"watch\" a double variable. But I can\'t watch
I'm not 100% sure, but my understanding is that when you watch pObject->dPrice
, GDB tries to watch anything that can change the watched value.
Using software watchpoints, after each step GDB checks if the expression has changed. Using hardware watchpoints, GDB has to set a watchpoint for dprice
, as you expect, but also for pObject
.
Now, you tagged the question 'x86'. On x86 you can set breakpoints for up to four bytes. A double is eight bytes. If you want to watch a double, I would guess that GDB would need two hardware watchpoints. You need an additional watchpoint for pObject
as well. I'm guessing that GDB tries to watch all of pObject
, which goes back to the problem in the question you linked in the question.
When I want to do something similar, if I'm certain that the pointer pObject
will not change, I usually do:
p &pObject->dprice
Let's say GDB says the address is (double *) 0xabcdef10
, now I do:
watch (double *) *0xabcdef10
and watch only what I want to.
Note: I don't have GDB open in front of me, so I may have the exact syntax for the watch
command wrong (regarding the placement of the *
), so check it out first.