* gdbtypes.c (safe_parse_type): New wrapper function to ignore

error() during parse_and_eval_type().
	(check_stub_method): Call safe_parse_type instead of
	parse_and_eval_type().
	* wrapper.c (gdb_parse_and_eval_type): New wrapper function.
	(wrap_parse_and_eval_type): New support function.
	* wrapper.h (gdb_parse_and_eval_type): Prototype.
	(wrap_parse_and_eval_type): Prototype.
This commit is contained in:
Nicholas Duffek 2000-04-03 03:39:09 +00:00
parent f9e73361c8
commit c91ecb25c3
4 changed files with 73 additions and 1 deletions

View File

@ -1,3 +1,14 @@
2000-04-02 Nick Duffek <nsd@cygnus.com>
* gdbtypes.c (safe_parse_type): New wrapper function to ignore
error() during parse_and_eval_type().
(check_stub_method): Call safe_parse_type instead of
parse_and_eval_type().
* wrapper.c (gdb_parse_and_eval_type): New wrapper function.
(wrap_parse_and_eval_type): New support function.
* wrapper.h (gdb_parse_and_eval_type): Prototype.
(wrap_parse_and_eval_type): Prototype.
Sun Apr 2 10:32:54 2000 Andrew Cagney <cagney@b1.cygnus.com>
* MAINTAINERS: Eli Zaretskii is a doco maintainer.

View File

@ -33,6 +33,7 @@
#include "demangle.h"
#include "complaints.h"
#include "gdbcmd.h"
#include "wrapper.h"
/* These variables point to the objects
representing the predefined C data types. */
@ -1422,6 +1423,30 @@ cfront_mangle_name (type, i, j)
#undef ADD_EXTRA
/* End of new code added to support parsing of Cfront stabs strings */
/* Parse a type expression in the string [P..P+LENGTH). If an error occurs,
silently return builtin_type_void. */
struct type *
safe_parse_type (char *p, int length)
{
struct ui_file *saved_gdb_stderr;
struct type *type;
/* Suppress error messages. */
saved_gdb_stderr = gdb_stderr;
gdb_stderr = ui_file_new ();
/* Call parse_and_eval_type() without fear of longjmp()s. */
if (!gdb_parse_and_eval_type (p, length, &type))
type = builtin_type_void;
/* Stop suppressing error messages. */
ui_file_delete (gdb_stderr);
gdb_stderr = saved_gdb_stderr;
return type;
}
/* Ugly hack to convert method stubs into method types.
He ain't kiddin'. This demangles the name of the method into a string
@ -1496,7 +1521,7 @@ check_stub_method (type, method_id, signature_id)
if (strncmp (argtypetext, "...", p - argtypetext) != 0)
{
argtypes[argcount] =
parse_and_eval_type (argtypetext, p - argtypetext);
safe_parse_type (argtypetext, p - argtypetext);
argcount += 1;
}
argtypetext = p + 1;

View File

@ -61,6 +61,9 @@ int wrap_value_subscript PARAMS ((char *));
int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval));
int wrap_value_ind PARAMS ((char *opaque_arg));
int gdb_parse_and_eval_type (char *, int, struct type **);
int wrap_parse_and_eval_type (char *);
int
gdb_parse_exp_1 (stringptr, block, comma, expression)
char **stringptr;
@ -252,3 +255,33 @@ wrap_value_ind (opaque_arg)
return 1;
}
int
gdb_parse_and_eval_type (char *p, int length, struct type **type)
{
struct gdb_wrapper_arguments args;
args.args[0].pointer = p;
args.args[1].integer = length;
if (!catch_errors ((catch_errors_ftype *) wrap_parse_and_eval_type, &args,
"", RETURN_MASK_ALL))
{
/* An error occurred */
return 0;
}
*type = (struct type *) args.result.pointer;
return 1;
}
int
wrap_parse_and_eval_type (char *a)
{
struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
char *p = (char *) args->args[0].pointer;
int length = args->args[1].integer;
args->result.pointer = (char *) parse_and_eval_type (p, length);
return 1;
}

View File

@ -38,4 +38,7 @@ extern int wrap_value_equal PARAMS ((char *));
extern int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval));
extern int wrap_value_ind PARAMS ((char *opaque_arg));
extern int gdb_parse_and_eval_type (char *, int, struct type **);
extern int wrap_parse_and_eval_type (char *);
#endif /* WRAPPER_H */