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


On Fri, 21 Jan 2011 21:41:29 +0100 (CET)
"Ulrich Weigand" <uweigand@de.ibm.com> wrote:

> 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.

I agree with your analysis.

Let's assume for the moment that we change the compiler to mark `l' as
"optimized out".  If we do this, we should still see failures when we
attempt to either examine or set `l'.  After all, we can't look at
or change values that have been optimized out.

I can think of four not entirely unreasonable courses of action:

1) Leave the test case as is with the justification that optimizing
   away variables in unoptimized code is not debugger-friendly and
   therefore *should* be considered a bug.

2) Avoid the problem by changing the test to use some other variable
   that's not so easy to optimize out.  (This is what my patch does.)

3) Change the test case to recognize the "optimized out" condition,
   causing the affected tests to be XFAILed instead.

4) Do (3), but also augment the test case to modify/examine some other
   variable that won't likely be optimized out.

As I ponder these options, I'm not really liking option 2 since it
doesn't allow us to learn of a potential deficiency in the compiler. 
That being the case, I withdraw my patch.

Kevin


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