* How to set a watch to a point in the source?
@ 2002-07-30 2:04 Arjan van Dijk
2002-07-30 10:20 ` Jim Blandy
0 siblings, 1 reply; 2+ messages in thread
From: Arjan van Dijk @ 2002-07-30 2:04 UTC (permalink / raw)
To: gdb
Hi,
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.
The option to specify the source-file name is too coarse, since there are
many routines in one file and they all have variables with similar names
(e.g. a counter named "i"). The option to give the name of the routine
would do the job, but then I would have to find out to which routine the
variable belongs. With nested subroutines this is a terrible job. For
setting breakpoints I found out that one can specify either a subroutine
name or a linenumber. For setting watches I could not find an equivalent
for the latter.
Background: I am working on a set of macro-commands for the editor NEdit to
collaborate with gdb via a shell-link. With a keystroke in NEdit I can
select the variable under the cursor and send the filename, linenumber and
column number to gdb. Making a macro that determines to which subroutine
that variable belongs is no fun.
Thanks for any suggestion,
Arjan
Arjan van Dijk
Institute for Marine and Atmospheric Research Utrecht
Faculty of Physics and Astronomy
Utrecht University
Princetonplein 5
NL - 3584 CC Utrecht
The Netherlands
phone: +31 30 2532815
fax: +31 30 2543163
e-mail: mailto:A.vanDijk@phys.uu.nl
homepage: http://www.phys.uu.nl/~vndijk
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to set a watch to a point in the source?
2002-07-30 2:04 How to set a watch to a point in the source? Arjan van Dijk
@ 2002-07-30 10:20 ` Jim Blandy
0 siblings, 0 replies; 2+ messages in thread
From: Jim Blandy @ 2002-07-30 10:20 UTC (permalink / raw)
To: Arjan van Dijk; +Cc: gdb
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.)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-07-30 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-30 2:04 How to set a watch to a point in the source? Arjan van Dijk
2002-07-30 10:20 ` Jim Blandy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox