diff options
author | Tom Tromey <tromey@redhat.com> | 2010-08-18 19:02:34 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-08-18 19:02:34 +0000 |
commit | c92817ce8d63df3e3c7225d77723f1c4ae725f58 (patch) | |
tree | e7c50f7d6f489add476f812346cb7006f0347146 /gdb/parse.c | |
parent | 55455f8927ff9d4703d844163ef51b6e26cdef9e (diff) | |
download | gdb-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/parse.c')
-rw-r--r-- | gdb/parse.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gdb/parse.c b/gdb/parse.c index c885c6a..035572e 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1202,8 +1202,10 @@ parse_expression (char *string) /* Parse STRING as an expression. If parsing ends in the middle of a field reference, return the type of the left-hand-side of the reference; furthermore, if the parsing ends in the field name, - return the field name in *NAME. In all other cases, return NULL. - Returned non-NULL *NAME must be freed by the caller. */ + return the field name in *NAME. If the parsing ends in the middle + of a field reference, but the reference is somehow invalid, throw + an exception. In all other cases, return NULL. Returned non-NULL + *NAME must be freed by the caller. */ struct type * parse_field_expression (char *string, char **name) @@ -1213,7 +1215,7 @@ parse_field_expression (char *string, char **name) int subexp; volatile struct gdb_exception except; - TRY_CATCH (except, RETURN_MASK_ALL) + TRY_CATCH (except, RETURN_MASK_ERROR) { in_parse_field = 1; exp = parse_exp_in_context (&string, 0, 0, 0, &subexp); @@ -1233,10 +1235,12 @@ parse_field_expression (char *string, char **name) xfree (exp); return NULL; } - /* (*NAME) is a part of the EXP memory block freed below. */ - *name = xstrdup (*name); + /* This might throw an exception. If so, we want to let it + propagate. */ val = evaluate_subexpression_type (exp, subexp); + /* (*NAME) is a part of the EXP memory block freed below. */ + *name = xstrdup (*name); xfree (exp); return value_type (val); |