From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: Subject: Re: [RFA] More wrappers in varobj Date: Fri, 19 Oct 2001 11:41:00 -0000 Message-id: References: <3BCB4792.7020502@cygnus.com> X-SW-Source: 2001-10/msg00265.html Sorry for the delay. I got a little caught up in debugging some other stuff... On Mon, 15 Oct 2001, Andrew Cagney wrote: > have a look at breakpoint.c:gdb_breakpoint for a more robust / current > way of implementing these wrappers. Is this better? Slightly off-topic: We are going to be calling externally visible functions something like "gdb_FOO", right? Example: gdb_breakpoint and gdb_breakpoint_query. How are we going to name internal functions? Leading "_" or something? I ask because I don't really want to have this patch introduce internal variations of gdb functions into the "libgdb" namespace. Keith Index: wrapper.h =================================================================== RCS file: /cvs/src/src/gdb/wrapper.h,v retrieving revision 1.10 diff -u -p -r1.10 wrapper.h --- wrapper.h 2001/03/06 08:21:18 1.10 +++ wrapper.h 2001/10/19 18:36:50 @@ -18,6 +18,7 @@ #ifndef WRAPPER_H #define WRAPPER_H 1 +#include "gdb.h" /* Use this struct to pass arguments to wrapper routines. */ struct gdb_wrapper_arguments; @@ -36,6 +37,10 @@ extern int gdb_value_assign (value_ptr, extern int gdb_value_subscript (value_ptr, value_ptr, value_ptr *); extern int gdb_value_ind (value_ptr val, value_ptr * rval); + +extern enum gdb_rc gdb_value_struct_elt (struct ui_out *uiout, value_ptr *result_ptr, + value_ptr *argp, value_ptr *args, + char *name, int *static_memfuncp, char *err); extern int gdb_parse_and_eval_type (char *, int, struct type **); Index: wrapper.c =================================================================== RCS file: /cvs/src/src/gdb/wrapper.c,v retrieving revision 1.12 diff -u -p -r1.12 wrapper.c --- wrapper.c 2001/03/27 20:36:24 1.12 +++ wrapper.c 2001/10/19 18:36:50 @@ -41,6 +41,16 @@ struct gdb_wrapper_arguments } args[10]; }; +struct captured_value_struct_elt_args +{ + value_ptr *argp; + value_ptr *args; + char *name; + int *static_memfuncp; + char *err; + value_ptr *result_ptr; +}; + static int wrap_parse_exp_1 (char *); static int wrap_evaluate_expression (char *); @@ -55,6 +65,8 @@ static int wrap_value_subscript (char *) static int wrap_value_ind (char *opaque_arg); +static int do_captured_value_struct_elt (struct ui_out *uiout, void *data); + static int wrap_parse_and_eval_type (char *); int @@ -290,3 +302,29 @@ wrap_parse_and_eval_type (char *a) return 1; } + +enum gdb_rc +gdb_value_struct_elt (struct ui_out *uiout, value_ptr *result, value_ptr *argp, + value_ptr *args, char *name, int *static_memfuncp, + char *err) +{ + struct captured_value_struct_elt_args cargs; + cargs.argp = argp; + cargs.args = args; + cargs.name = name; + cargs.static_memfuncp = static_memfuncp; + cargs.err = err; + cargs.result_ptr = result; + return catch_exceptions (uiout, do_captured_value_struct_elt, &cargs, + NULL, RETURN_MASK_ALL); +} + +static int +do_captured_value_struct_elt (struct ui_out *uiout, void *data) +{ + struct captured_value_struct_elt_args *cargs = data; + *cargs->result_ptr = value_struct_elt (cargs->argp, cargs->args, cargs->name, + cargs->static_memfuncp, cargs->err); + return GDB_RC_OK; +} +