Re: [RFC/RFA] gdb.cp/classes.exp: Don't try to print local variable out of scope

Daniel Jacobowitz
2004-03-09T14:17:54Z

On Tue, Mar 09, 2004 at 01:59:59PM +0100, Corinna Vinschen wrote:
> * gdb.cp/misc.cc (enums1): Add a line to extend scope of
> local variable obj_with_enum.
>
> Index: gdb.cp/misc.cc
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/misc.cc,v
> retrieving revision 1.1
> diff -u -p -r1.1 misc.cc
> --- gdb.cp/misc.cc 23 Aug 2003 03:55:59 -0000 1.1
> +++ gdb.cp/misc.cc 8 Mar 2004 19:59:17 -0000
> @@ -433,6 +433,7 @@ void enums1 ()
> obj_with_enum.x = 0;
> enums2 ();
> obj_with_enum.priv_enum = ClassWithEnum::green;
> + obj_with_enum.priv_enum = ClassWithEnum::yellow;
> }
>
> class ClassParam {
>

Personally, I recommend using a different (new) variable; otherwise,
we'll be back here in a release when GCC decides to do a little bit
more dead code elimination at -O0.

Otherwise, I agree with your analysis and recommend this patch for
approval. I've been thinking that it would be nice to have a way to
view recently out-of-scope variables, but I couldn't work out either
the mechanism or the interface, so...

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer