This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]