This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: How to set a watch to a point in the source?
- From: Jim Blandy <jimb at redhat dot com>
- To: Arjan van Dijk <a dot vandijk at phys dot uu dot nl>
- Cc: gdb at sources dot redhat dot com
- Date: 30 Jul 2002 12:20:28 -0500
- Subject: Re: How to set a watch to a point in the source?
- References: <v03130309b96c02d74826@[131.211.32.140]>
Arjan van Dijk <a.vandijk@phys.uu.nl> writes:
> Can someone tell me please if and how I can instruct gdb to do the following?
> I want to add a certain variable to the display list by specifying its
> position in the source code.
GDB doesn't keep any information about the location of a variable's
declaration --- that I can find, anyway. I think you're out of luck.
What GDB can do, however, is find the definition in scope at a
particular source line. If you could parse out the variable name from
the source, and then look up that name in the context of that source
line, then you could get the right variable. I don't know of any
existing interface for doing that; so you'd need to hack on GDB either
way.
(Am I missing some MI capability or something? I'd love to be wrong.)