This is the mail archive of the gdb-patches@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: MI: Another -var-update bug? [PATCH]


On Wed, Dec 13, 2006 at 07:28:05PM +1300, Nick Roberts wrote:
>  > Variable objects appear to test scope on a frame basis (in c_value_of root).
>  > If we create a variable object for j in the inner block of the program below
>  > then doing -var-update on line 10 doesn't report it as being out of scope.
>  > But struct varobj_root has a member struct block *valid_block.  Presumably
>  > the addresses in this structure can be used to test if the variable is still
>  > in scope or not
> 
> Something like below?

Yeah.  My only concern about this is a variable going out of scope
which might then come back into scope.  That can't happen if the frame
is gone (unless something has changed), but it can happen with blocks
once we support optimized blocks better (I posted a patch for this
once).

Here's an example.  Suppose we have this code:

  int func()
  {
    int i = foo();
    {
       int j = bar();
       j = j * j;
       i += j;
    }
    baz();
    return i;
  }

Since baz can't see i or j, it's legitimate for the compiler to move
the call to baz up to right after the call to bar.  Then we'll appear
to "leave" the block and "re-enter" it after another step.

Will the front end delete the varobj if it sees in_scope="false"?

-- 
Daniel Jacobowitz
CodeSourcery


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