Need help with stack smash

Roland McGrath roland at
Thu Aug 27 19:42:01 UTC 2009

> Note that this means what it says: if your expression contains a symbol
> that goes out of scope before the change happens, then the watchpoint
> will be forgotten, because the value of the expression will change from
> being a value to being not-a-thing.  So you would need to set the watch
> on the address in memory of what you're trying to watch, and not
> necessarily on its symbolic name.

Indeed.  Usually the convenient thing to do is:

(gdb) p &foo->bar
$22 = (int *) 0x12345
(gdb) watch *$22

More information about the devel mailing list