This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
How to set a watch to a point in the source?
- From: Arjan van Dijk <a dot vandijk at phys dot uu dot nl>
- To: gdb at sources dot redhat dot com
- Date: Tue, 30 Jul 2002 11:04:01 +0200
- Subject: How to set a watch to a point in the source?
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