This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
dead code in varobj.c:c_value_of_variable ?
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>, vladimir at codesourcery dot com
- Date: Mon, 9 Jan 2012 12:07:59 +0400
- Subject: dead code in varobj.c:c_value_of_variable ?
Hello,
I noticed that c_value_of_variable is really only called via
the "value_of_variable" varobj callback, which is only called
from my_value_of_variable. And the code in my_value_of_variable
is:
if (var->pretty_printer)
return value_get_print_value (var->value, var->format, var);
return (*var->root->lang->value_of_variable) (var, format);
And therefore, it seems to me that the following code in
c_value_of_variable is dead:
/* If we have a custom formatter, return whatever string it has
produced. */
if (var->pretty_printer && var->print_value)
return xstrdup (var->print_value);
If we reach this function var->pretty_printer should always be false.
Purely at the design level, this kind of makes sense to me, since
I would expect the pretty-printer to be language-independent and
always override whatever the language might want to do....
--
Joel