Fix -Wuh and -Wnhu options so that they work.
[deliverable/binutils-gdb.git] / gdb / typeprint.c
index 144df82cf28fc88393623f541ac03e2ee458b306..9f8bd4f6ae7e2b51454af9fcf322d22f1ec6adc7 100644 (file)
@@ -34,6 +34,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "gdb_string.h"
 #include <errno.h>
 
+/* For real-type printing in whatis_exp() */
+extern int objectprint;                /* Controls looking up an object's derived type
+                                  using what we find in its vtables.  */
+
+extern void _initialize_typeprint PARAMS ((void));
+
 static void
 ptype_command PARAMS ((char *, int));
 
@@ -74,6 +80,10 @@ whatis_exp (exp, show)
   struct expression *expr;
   register value_ptr val;
   register struct cleanup *old_chain = NULL;
+  struct type * real_type = NULL;
+  int full = 0;
+  int top = -1;
+  int using_enc = 0;
 
   if (exp)
     {
@@ -85,7 +95,16 @@ whatis_exp (exp, show)
   else
     val = access_value_history (0);
 
+  real_type = value_rtti_type (val, &full, &top, &using_enc);
+
   printf_filtered ("type = ");
+
+  if (real_type && objectprint)
+    printf_filtered ("/* real type = %s%s */\n",
+                     TYPE_NAME (real_type),
+                     full ? "" : " (incomplete object)");
+  /* FIXME: maybe better to use type_print (real_type, "", gdb_stdout, -1); */
+
   type_print (VALUE_TYPE (val), "", gdb_stdout, show);
   printf_filtered ("\n");
 
@@ -245,8 +264,6 @@ print_type_scalar (type, val, stream)
   gdb_flush (stream);
 }
 
-#if MAINTENANCE_CMDS
-
 /* Dump details of a type specified either directly or indirectly.
    Uses the same sort of type lookup mechanism as ptype_command()
    and whatis_command(). */
@@ -285,8 +302,6 @@ maintenance_print_type (typename, from_tty)
   }
 }
 
-#endif /* MAINTENANCE_CMDS */
-
 \f
 void
 _initialize_typeprint ()
This page took 0.023306 seconds and 4 git commands to generate.