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: [RFC] Fix variable lifetime related problem in gdb.base/store.exp


Kevin Buettner wrote:

> The test case places a breakpoint in add_float(), runs to that
> breakpoint, and then goes up a frame to examine and modify certain
> variables.
> 
> The lifetime of `l' with value obtained from `u' ends with invocation
> of add_float().  (More precisely, it ends as soon as l's value is
> copied to the argument register for the call to add_float().)  The
> result of the add_float() call is placed in `l' when the call is
> finished.
> 
> Thus it's perfectly acceptable (though a bit perverse) to put l's value
> in the ra register.  (However, given that this is occurring at -O0, it is
> also very annoying that the user is unable to inspect l's pre-call
> value.)
> 
> In any case, due to the fact that the lifetime of l-with-the-value-of-u
> ends once the call to add_float() is set up, the compiler is then free
> to use ra for other purposes which, of course, during a call, is used
> to temporarily hold the return address.

Isn't this then simply a matter of the compiler generating incorrect
debug information?  At the PC corresponding to the call site, it is
simply not true that register ra holds the variable l, so the debug
info shouldn't say that.  Instead, the debug info should either point
to whatever place actually holds the variable at this point, or else
mark variable l as "optimized out" there.

There's in the end not much GDB can do if debug info is just wrong.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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