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]

Re: Checking variable scope - progress and questions


On 17/01/07, Daniel Jacobowitz <drow@false.org> wrote:
On Sun, Jan 14, 2007 at 02:11:00PM +0000, Rob Quill wrote:
> But I am having difficulty getting it to work for expressions of the form
>
> $in_scope(x.y)
>
> Becuase I can't find the place in the grammar when it is checked if
> this is in scope.

It isn't checked explicitly.  It's checked when we do the x.y
operation, so that we can look up the type of x.  Try setting a
breakpoint on 'error'; that may help.

Hi,


I've been narrowing this down, and now what I have is roughly as follows:

In the value_of_variable function in valops.c, I check to see if we
are checking scope, and if we are, it returns value_from_longest
(builtin_type_int, (LONGEST) 1), otherwise it returns val.

However, this didn't fix the problems with structures, so in eval.c,
in the STRUCTOP_STRUCT case, I added some code in the else section
which if scope is being checked, checks the value of arg1, so see if
it is equal to an integer 0, if it is, it returns arg1, i.e. a value
structure continaing 0, and if it isn't, it sets check_scope to 0 and
re-evaluates the sub-expression so that the correct value structure is
returned.

Does that make sense? Is that the right way to go about it?

Thanks for your time

Rob


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