This is the mail archive of the
mailing list for the GDB project.
Re: Checking if addess is on stack?
On Thu, Apr 20, 2006 at 10:03:11PM +0300, Eli Zaretskii wrote:
> That's one possible situation, sure. But there are others: someone
> could be scribbling over ptr->i by inadvertently changing ptr itself.
> If you think this latter situation is unlikely or uninteresting, you
> in effect say that our whole concept of watching expression values is
It depends what you're debugging, of course. I'm generally debugging
"something in the list is wrong, later, in another function";
"something in this function clobbered the loop pointer" is much rarer.
That's likely to be in a register, for instance.
I think that the idea of watching expression values is useful as an
option, but if there's more than one memory location involved I can't
think when the last time I wanted the current behavior was. And I find
it very unintuitive that "print &foo->bar; watch *$31" is not the same
as "watch foo->bar" (and that the former is so cumbersome).
But I'm not suggesting changing our behavior at this late date.
> In your example, you (the user) knew what you were after. I was
> arguing that doing this always in a front end, like what Vladimir was
> suggesting, might not be what users expect in each particular case.
I would believe that it is more often correct, especially if the GUI is
used to set the watchpoint - if I clicked on a member of a structure and
said "watch this", I'd mean the member, not whatever expression I followed
to get that window to pop up.