This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Evaluating an expression in a given scope
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb at sources dot redhat dot com
- Date: Wed, 07 Sep 2005 16:39:52 +0400
- Subject: Evaluating an expression in a given scope
Hello!
Does gdb provides a clean way to evaluate an expression in a given scope
(file:line)?
Here's the use case: while in file foo.cpp, line 200, user creates a
watchpoint for expression 'g'. He then stops the GUI debugger and restarts
it again. I want to store the watchpoint in some config file and recreate
it again, but to do that I need a way to create watchpoint at specific
scope. If I just use
print g
or
display g
righ away, this might print some other 'g', not the one visible on line 200
of foo.cpp.
I think I can do this with:
tbreak foo.cpp:100
jump foo.cpp:100
display g
jump <previous source position>
but I have concerns about this being reliable method.
- Volodya