This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Checking variable scope
"Rob Quill" <rob.quill@gmail.com> writes:
> I am stepping through the program, so I suppose I'd be looking to see
> if the variable is in scope at the location of the PC.
>
> How would I call lookup_symbol, given that information? I had a brief
> look, but I wasn't sure what parameters to pass to the function, or
> how to get the right values.
You can pass NULL for 'symtab' and 'is_a_field_of_this', and
VAR_DOMAIN for domain. block is the scoping block containing the PC.
I don't know where you're calling things from, so I can't really tell
you how to get the current PC.