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.
+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.
#include "demangle.h"
#include "complaints.h"
#include "gdbcmd.h"
+#include "wrapper.h"
/* These variables point to the objects
representing the predefined C data types. */
#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
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;
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;
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;
+}
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 */