[patch] varobj.c: Reset string_print [Re: [obv] varobj.c: Fix GCC false warning]

Jan Kratochvil
2010-10-17T11:54:08Z

On Sun, 17 Oct 2010 12:02:08 +0200, Andreas Schwab wrote:
> What happens if string_print is set but gdbpy_extract_lazy_string was
> not called?

I agree.

BTW this is unrelated to the [obv] fix, in fact GCC warned on a falsely
uninitialized value <! HAVE_PYTHON> and GCC missed a real uninitialized value
<HAVE_PYTHON>.

I guess this patch should fix it.
No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.

Thanks,
Jan

gdb/
2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>

* varobj.c (value_get_print_value): Reset STRING_PRINT if STR_ADDR is
not set.

--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2557,9 +2557,14 @@ value_get_print_value (struct value *value, enum varobj_display_formats format,
make_cleanup (xfree, thevalue);
}
else
- gdbpy_print_stack ();
+ {
+ gdbpy_print_stack ();
+ string_print = 0;
+ }
}
}
+ else
+ string_print = 0;
if (replacement)
value = replacement;
}