This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: breakpoint for accessing memory location
Eli Zaretskii wrote:
The beginning of that section has a better explanation:
You can use a watchpoint to stop execution whenever the value of an
expression changes, without having to predict a particular place where
this may happen.
What text would you suggest to have there that would have helped you
recognize that this is the feature you wanted? If you were looking
for some specific words or phrases, please tell what they are. This
will allow us to improve the manual.
TIA
I have never had trouble understanding this sentence, although I have
thought "a particular place in the code" would be even clearer.
But while this subject is open, I would like to see more explanation on just
what the semantics of evaluating a watchpoint expression are. An expression
always is evaluated in a particular context that can affect the legality/result,
but in the case of a watchpoint, execution is proceeding and changing the
context. I have never been sure what the rules are.
For example, I sometimes want to watch p->f, where p is local variable that
I know perfectly well will soon cease to exist, but I also know *p will
remain. I've long since learned that watching p->f doesn't work. Instead,
I print the address of p->f and then watch the contents of that address.
But more information on the general rules would be helpful in the manual.
--
-------------------------------------------------------------
Rodney M. Bates, retired assistant professor
Dept. of Computer Science, Wichita State University
Wichita, KS 67260-0083
316-978-3922
rodney.bates@wichita.edu