This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: RFA: patch to ignore C++ method conversion errors
- To: Nick Duffek <nsd at cygnus dot com>
- Subject: Re: RFA: patch to ignore C++ method conversion errors
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: Sat, 1 Apr 2000 08:44:37 -0800 (PST)
- cc: gdb-patches at sourceware dot cygnus dot com
Please do commit it.
I've been reworking the RTTI stuff, and value_virtual_fn_field, in an
attempt to remove every single expected failure from virtfunc.exp
I'm down to 3 failures, from 9.
On Sat, 1 Apr 2000, Nick Duffek wrote:
> I wrote:
>
> >I'll go ahead and change my patch to use wrapper.c
>
> Here's the wrapperized patch. No regressions were evident. I'll go ahead
> and commit it if there are no objections.
>
> Nick
>
> Index: gdbtypes.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtypes.c,v
> retrieving revision 1.6
> diff -u -r1.6 gdbtypes.c
> --- gdbtypes.c 2000/03/28 02:25:14 1.6
> +++ gdbtypes.c 2000/04/01 06:12:58
> @@ -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 @@
> #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 @@
> 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;
> Index: wrapper.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/wrapper.c,v
> retrieving revision 1.4
> diff -u -r1.4 wrapper.c
> --- wrapper.c 2000/03/30 20:15:35 1.4
> +++ wrapper.c 2000/04/01 06:12:58
> @@ -61,6 +61,9 @@
> 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 @@
> 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;
> +}
> Index: wrapper.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/wrapper.h,v
> retrieving revision 1.2
> diff -u -r1.2 wrapper.h
> --- wrapper.h 2000/03/13 21:51:45 1.2
> +++ wrapper.h 2000/04/01 06:12:58
> @@ -38,4 +38,7 @@
> 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 */
>