aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-12-07 19:58:10 +0000
committerTom Tromey <tromey@redhat.com>2012-12-07 19:58:10 +0000
commit4fc5d43ea6b0f1ae45c2819f9b15d2cafe2f27b7 (patch)
tree0351d47efcf85fd721a20096a8cd305cb816d418 /gdb
parent7708f7ef37a45253153d7c739a86668ed62d5a1b (diff)
downloadgdb-4fc5d43ea6b0f1ae45c2819f9b15d2cafe2f27b7.zip
gdb-4fc5d43ea6b0f1ae45c2819f9b15d2cafe2f27b7.tar.gz
gdb-4fc5d43ea6b0f1ae45c2819f9b15d2cafe2f27b7.tar.bz2
* typeprint.c (_initialize_typeprint): Set completer
for "whatis" and "ptype". testsuite * gdb.base/completion.exp: Add tests for ptype and whatis completion.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/completion.exp8
-rw-r--r--gdb/typeprint.c11
4 files changed, 26 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b4e6afb..eda155b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-07 Tom Tromey <tromey@redhat.com>
+
+ * typeprint.c (_initialize_typeprint): Set completer
+ for "whatis" and "ptype".
+
2012-12-07 Joel Brobecker <brobecker@adacore.com>
* copyright.py (NOT_FSF_LIST): Remove duplicate entry
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2cc6d25..0bdd094 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-07 Tom Tromey <tromey@redhat.com>
+
+ * gdb.base/completion.exp: Add tests for ptype and whatis
+ completion.
+
2012-12-07 Joel Brobecker <brobecker@adacore.com>
* gdb.base/stale-infcall.exp: Fix copyright line.
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 80f7032..c8edc98 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -555,6 +555,14 @@ gdb_test "complete p &values\[0\]->z" \
"p &values.0.->z_field" \
"completion of field in anonymous union"
+gdb_test "complete ptype &values\[0\]->z" \
+ "ptype &values.0.->z_field" \
+ "ptype completion of field in anonymous union"
+
+gdb_test "complete whatis &values\[0\]->z" \
+ "whatis &values.0.->z_field" \
+ "whatis completion of field in anonymous union"
+
# The following tests used to simply try to complete `${objdir}/file',
# and so on. The problem is that ${objdir} can be very long; the
# completed filename may be more than eighty characters wide. When
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index cf3ba381..53cc9eb 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -39,6 +39,7 @@
#include <ctype.h>
#include "cli/cli-utils.h"
#include "python/python.h"
+#include "completer.h"
extern void _initialize_typeprint (void);
@@ -680,7 +681,9 @@ 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\
@@ -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."),