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.
This commit is contained in:
Tom Tromey
2010-08-18 19:02:34 +00:00
parent 55455f8927
commit c92817ce8d
6 changed files with 41 additions and 37 deletions

View File

@@ -1212,6 +1212,7 @@ struct type *
lookup_struct_elt_type (struct type *type, char *name, int noerr)
{
int i;
char *typename;
for (;;)
{
@@ -1225,11 +1226,9 @@ lookup_struct_elt_type (struct type *type, char *name, int noerr)
if (TYPE_CODE (type) != TYPE_CODE_STRUCT
&& TYPE_CODE (type) != TYPE_CODE_UNION)
{
target_terminal_ours ();
gdb_flush (gdb_stdout);
fprintf_unfiltered (gdb_stderr, "Type ");
type_print (type, "", gdb_stderr, -1);
error (_(" is not a structure or union type."));
typename = type_to_string (type);
make_cleanup (xfree, typename);
error (_("Type %s is not a structure or union type."), typename);
}
#if 0
@@ -1281,14 +1280,9 @@ lookup_struct_elt_type (struct type *type, char *name, int noerr)
return NULL;
}
target_terminal_ours ();
gdb_flush (gdb_stdout);
fprintf_unfiltered (gdb_stderr, "Type ");
type_print (type, "", gdb_stderr, -1);
fprintf_unfiltered (gdb_stderr, " has no component named ");
fputs_filtered (name, gdb_stderr);
error (("."));
return (struct type *) -1; /* For lint */
typename = type_to_string (type);
make_cleanup (xfree, typename);
error (_("Type %s has no component named %s."), typename, name);
}
/* Lookup the vptr basetype/fieldno values for TYPE.