* dead code in varobj.c:c_value_of_variable ?
@ 2012-01-09 8:08 Joel Brobecker
2012-01-24 19:53 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2012-01-09 8:08 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey, vladimir
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: dead code in varobj.c:c_value_of_variable ?
2012-01-09 8:08 dead code in varobj.c:c_value_of_variable ? Joel Brobecker
@ 2012-01-24 19:53 ` Tom Tromey
2012-03-01 2:02 ` [commit] remove dead code in varobj.c:c_value_of_variable Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2012-01-24 19:53 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches, vladimir
>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
[...]
Joel> And therefore, it seems to me that the following code in
Joel> c_value_of_variable is dead:
I think your analysis is correct.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* [commit] remove dead code in varobj.c:c_value_of_variable
2012-01-24 19:53 ` Tom Tromey
@ 2012-03-01 2:02 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2012-03-01 2:02 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
This patch removes some dead code identified in:
http://www.sourceware.org/ml/gdb-patches/2012-01/msg00266.html
(and analysis confirmed by Tom).
gdb/ChangeLog:
* varobj.c (c_value_of_variable): Remove dead code.
Tested on x86_64-linux. Checked in.
---
gdb/ChangeLog | 4 ++++
gdb/varobj.c | 5 -----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 621da5b..cb9eecb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2012-02-29 Joel Brobecker <brobecker@adacore.com>
+ * varobj.c (c_value_of_variable): Remove dead code.
+
+2012-02-29 Joel Brobecker <brobecker@adacore.com>
+
* ada-lex.p (processId): Do not modify already encoded IDs.
Update function documentation.
diff --git a/gdb/varobj.c b/gdb/varobj.c
index abe832c..cb05128 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -3400,11 +3400,6 @@ c_value_of_variable (struct varobj *var, enum varobj_display_formats format)
catch that case explicitly. */
struct type *type = get_type (var);
- /* If we have a custom formatter, return whatever string it has
- produced. */
- if (var->pretty_printer && var->print_value)
- return xstrdup (var->print_value);
-
/* Strip top-level references. */
while (TYPE_CODE (type) == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type));
--
1.7.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-01 2:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-09 8:08 dead code in varobj.c:c_value_of_variable ? Joel Brobecker
2012-01-24 19:53 ` Tom Tromey
2012-03-01 2:02 ` [commit] remove dead code in varobj.c:c_value_of_variable Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).