don't let bin2hex call strlen
[deliverable/binutils-gdb.git] / gdb / typeprint.c
index cf3ba381a44c616600f6f99596bb1a2f2a899be0..b4ad43150604f3ecfe04f5a918bda65e3730bcab 100644 (file)
@@ -1,7 +1,6 @@
 /* Language independent support for printing types for GDB, the GNU debugger.
 
-   Copyright (C) 1986, 1988-1989, 1991-1995, 1998-2001, 2003, 2006-2012
-   Free Software Foundation, Inc.
+   Copyright (C) 1986-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "language.h"
 #include "cp-abi.h"
 #include "typeprint.h"
-#include "gdb_string.h"
+#include <string.h>
 #include "exceptions.h"
 #include "valprint.h"
 #include <errno.h>
 #include <ctype.h>
 #include "cli/cli-utils.h"
-#include "python/python.h"
+#include "extension.h"
+#include "completer.h"
 
 extern void _initialize_typeprint (void);
 
@@ -248,7 +248,7 @@ do_free_global_table (void *arg)
   struct type_print_options *flags = arg;
 
   free_typedef_hash (flags->global_typedefs);
-  free_type_printers (flags->global_printers);
+  free_ext_lang_type_printers (flags->global_printers);
 }
 
 /* Create the global typedef hash.  */
@@ -258,13 +258,13 @@ create_global_typedef_table (struct type_print_options *flags)
 {
   gdb_assert (flags->global_typedefs == NULL && flags->global_printers == NULL);
   flags->global_typedefs = create_typedef_hash ();
-  flags->global_printers = start_type_printers ();
+  flags->global_printers = start_ext_lang_type_printers ();
   return make_cleanup (do_free_global_table, flags);
 }
 
 /* Look up the type T in the global typedef hash.  If it is found,
    return the typedef name.  If it is not found, apply the
-   type-printers, if any, given by start_type_printers and return the
+   type-printers, if any, given by start_script_type_printers and return the
    result.  A NULL return means that the name was not found.  */
 
 static const char *
@@ -288,7 +288,7 @@ find_global_typedef (const struct type_print_options *flags,
       return new_tf->name;
     }
 
-  /* Put an entry into the hash table now, in case apply_type_printers
+  /* Put an entry into the hash table now, in case apply_script_type_printers
      recurses.  */
   new_tf = XOBNEW (&flags->global_typedefs->storage, struct typedef_field);
   new_tf->name = NULL;
@@ -296,7 +296,7 @@ find_global_typedef (const struct type_print_options *flags,
 
   *slot = new_tf;
 
-  applied = apply_type_printers (flags->global_printers, t);
+  applied = apply_ext_lang_type_printers (flags->global_printers, t);
 
   if (applied != NULL)
     {
@@ -680,11 +680,14 @@ show_print_type_typedefs (struct ui_file *file, int from_tty,
 void
 _initialize_typeprint (void)
 {
-  add_com ("ptype", class_vars, ptype_command, _("\
+  struct cmd_list_element *c;
+
+  c = add_com ("ptype", class_vars, ptype_command, _("\
 Print definition of type TYPE.\n\
-Usage: ptype[/FLAGS] TYPE-NAME | EXPRESSION\n\
-Argument may be a type name defined by typedef, or \"struct STRUCT-TAG\"\n\
-or \"class CLASS-NAME\" or \"union UNION-TAG\" or \"enum ENUM-TAG\".\n\
+Usage: ptype[/FLAGS] TYPE | EXPRESSION\n\
+Argument may be any type (for example a type name defined by typedef,\n\
+or \"struct STRUCT-TAG\" or \"class CLASS-NAME\" or \"union UNION-TAG\"\n\
+or \"enum ENUM-TAG\") or an expression.\n\
 The selected stack frame's lexical context is used to look up the name.\n\
 Contrary to \"whatis\", \"ptype\" always unrolls any typedefs.\n\
 \n\
@@ -694,10 +697,12 @@ Available FLAGS are:\n\
   /M    print methods defined in a class\n\
   /t    do not print typedefs defined in a class\n\
   /T    print typedefs defined in a class"));
+  set_cmd_completer (c, expression_completer);
 
-  add_com ("whatis", class_vars, whatis_command,
-          _("Print data type of expression EXP.\n\
+  c = add_com ("whatis", class_vars, whatis_command,
+              _("Print data type of expression EXP.\n\
 Only one level of typedefs is unrolled.  See also \"ptype\"."));
+  set_cmd_completer (c, expression_completer);
 
   add_prefix_cmd ("type", no_class, show_print_type,
                  _("Generic command for showing type-printing settings."),
This page took 0.046915 seconds and 4 git commands to generate.