aboutsummaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-08-18 19:02:34 +0000
committerTom Tromey <tromey@redhat.com>2010-08-18 19:02:34 +0000
commitc92817ce8d63df3e3c7225d77723f1c4ae725f58 (patch)
treee7c50f7d6f489add476f812346cb7006f0347146 /gdb/completer.c
parent55455f8927ff9d4703d844163ef51b6e26cdef9e (diff)
downloadgdb-c92817ce8d63df3e3c7225d77723f1c4ae725f58.zip
gdb-c92817ce8d63df3e3c7225d77723f1c4ae725f58.tar.gz
gdb-c92817ce8d63df3e3c7225d77723f1c4ae725f58.tar.bz2
gdb
PR symtab/11919: * gdbtypes.c (lookup_struct_elt_type): Clean up error emission. * parse.c (parse_field_expression): Use RETURN_MASK_ERROR. Move name-copying lower. Document exception behavior. * completer.c (expression_completer): Catch exceptions from parse_field_expression. gdb/testsuite PR symtab/11919: * gdb.base/completion.exp: Add test.
Diffstat (limited to 'gdb/completer.c')
-rw-r--r--gdb/completer.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index 3ba481e..91b899d 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -24,6 +24,7 @@
#include "filenames.h" /* For DOSish file names. */
#include "language.h"
#include "gdb_assert.h"
+#include "exceptions.h"
#include "cli/cli-decode.h"
@@ -414,13 +415,19 @@ add_struct_fields (struct type *type, int *nextp, char **output,
char **
expression_completer (struct cmd_list_element *ignore, char *text, char *word)
{
- struct type *type;
+ struct type *type = NULL;
char *fieldname, *p;
+ volatile struct gdb_exception except;
/* Perform a tentative parse of the expression, to see whether a
field completion is required. */
fieldname = NULL;
- type = parse_field_expression (text, &fieldname);
+ TRY_CATCH (except, RETURN_MASK_ERROR)
+ {
+ type = parse_field_expression (text, &fieldname);
+ }
+ if (except.reason < 0)
+ return NULL;
if (fieldname && type)
{
for (;;)