This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Remove type prefix for -var-evaluate-expression/functions
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 15 Mar 2006 17:46:12 +0300
- Subject: Remove type prefix for -var-evaluate-expression/functions
Hi,
the following patch removes 'type prefix' from output of
-var-evaluate-expression applied to objects of function type (not pointers
to functions, but functions).
It causes no regression in the testsuite for me.
Changelog:
2006-03-15 Vladimir Prus <ghost@cs.msu.su>
* c-valprint.c
(c_val_print): Don't print type prefix for functions.
(c_value_print): Print type prefix for functions here.
Patch attached.
- Volodya
Index: c-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-valprint.c,v
retrieving revision 1.39
diff -u -r1.39 c-valprint.c
--- c-valprint.c 18 Jan 2006 21:24:19 -0000 1.39
+++ c-valprint.c 15 Mar 2006 14:44:45 -0000
@@ -356,11 +356,6 @@
print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
break;
}
- /* FIXME, we should consider, at least for ANSI C language, eliminating
- the distinction made between FUNCs and POINTERs to FUNCs. */
- fprintf_filtered (stream, "{");
- type_print (type, "", stream, -1);
- fprintf_filtered (stream, "} ");
/* Try to print what function it points to, and its address. */
print_address_demangle (address, stream, demangle);
break;
@@ -570,6 +565,16 @@
}
}
+ if (TYPE_CODE (type) == TYPE_CODE_FUNC)
+ {
+ /* FIXME, we should consider, at least for ANSI C language, eliminating
+ the distinction made between FUNCs and POINTERs to FUNCs. */
+ fprintf_filtered (stream, "{");
+ type_print (type, "", stream, -1);
+ fprintf_filtered (stream, "} ");
+ }
+
+
if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
{
/* Attempt to determine real type of object */