This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] More wrappers in varobj
- To: <gdb-patches at sources dot redhat dot com>
- Subject: [RFA] More wrappers in varobj
- From: Keith Seitz <keiths at cygnus dot com>
- Date: Mon, 15 Oct 2001 12:49:56 -0700 (PDT)
Hi,
I've been trying to update varobj in light of what appears to be either
bitrot or a bunch of v3 abi issues. We are seeing an extraordinary number
of problems with C++.
This is the first of several patches to get varobj working a little better
for C++.
I have tested this on linux native and arm-elf, and it introduces no new
failures in mi or insight testsuites.
Keith
ChangeLog
2001-10-15 Keith Seitz <keiths@redhat.com>
* wrapper.h (gdb_value_struct_elt): New function.
* wrapper.c (gdb_value_struct_elt): New function.
(wrap_value_struct_elt): New function.
* varobj.c (c_value_of_child): Use gdb_value_struct_elt.
(cplus_value_of_child): Likewise.
Patch
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.21
diff -u -p -r1.21 varobj.c
--- varobj.c 2001/10/10 17:01:52 1.21
+++ varobj.c 2001/10/15 19:45:21
@@ -1950,7 +1950,7 @@ c_value_of_child (struct varobj *parent,
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- value = value_struct_elt (&temp, NULL, name, NULL, "vstructure");
+ gdb_value_struct_elt (&temp, NULL, name, NULL, "vstructure", &value);
break;
case TYPE_CODE_PTR:
@@ -1958,7 +1958,7 @@ c_value_of_child (struct varobj *parent,
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- value = value_struct_elt (&temp, NULL, name, NULL, "vstructure");
+ gdb_value_struct_elt (&temp, NULL, name, NULL, "vstructure", &value);
break;
default:
@@ -2295,9 +2295,14 @@ cplus_value_of_child (struct varobj *par
if (CPLUS_FAKE_CHILD (parent))
{
value_ptr temp = parent->parent->value;
- value = value_struct_elt (&temp, NULL, name,
- NULL, "cplus_structure");
- release_value (value);
+
+ if (temp == NULL)
+ return NULL;
+
+ gdb_value_struct_elt (&temp, NULL, name, NULL, "cplus_structure",
+ &value);
+ if (value != NULL)
+ release_value (value);
}
else if (index >= TYPE_N_BASECLASSES (type))
{
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/15 19:45:21
@@ -37,6 +37,8 @@ extern int gdb_value_subscript (value_pt
extern int gdb_value_ind (value_ptr val, value_ptr * rval);
+extern int gdb_value_struct_elt (value_ptr *argp, value_ptr *args, char *name, int *static_memfuncp, char *err, value_ptr * rval);
+
extern int gdb_parse_and_eval_type (char *, int, struct type **);
#endif /* WRAPPER_H */
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/15 19:45:21
@@ -55,6 +55,8 @@ static int wrap_value_subscript (char *)
static int wrap_value_ind (char *opaque_arg);
+static int wrap_value_struct_elt (char *opaque_arg);
+
static int wrap_parse_and_eval_type (char *);
int
@@ -257,6 +259,47 @@ wrap_value_ind (char *opaque_arg)
val = (value_ptr) (args)->args[0].pointer;
(args)->result.pointer = value_ind (val);
+ return 1;
+}
+
+int
+gdb_value_struct_elt (value_ptr *argp, value_ptr *args, char *name,
+ int *static_memfuncp, char *err, value_ptr * rval)
+{
+ struct gdb_wrapper_arguments argss;
+
+ argss.args[0].pointer = argp;
+ argss.args[1].pointer = args;
+ argss.args[2].pointer = name;
+ argss.args[3].pointer = static_memfuncp;
+ argss.args[4].pointer = err;
+
+ if (!catch_errors ((catch_errors_ftype *) wrap_value_struct_elt, &argss,
+ "", RETURN_MASK_ERROR))
+ {
+ /* An error occurred */
+ return 0;
+ }
+
+ *rval = (value_ptr) argss.result.pointer;
+ return 1;
+}
+
+static int
+wrap_value_struct_elt (char *opaque_arg)
+{
+ char *err, *name;
+ value_ptr *argp, *args;
+ int *static_memfuncp;
+ struct gdb_wrapper_arguments *argss = (struct gdb_wrapper_arguments *) opaque_arg;
+
+ argp = (value_ptr *) argss->args[0].pointer;
+ args = (value_ptr *) argss->args[1].pointer;
+ name = (char *) argss->args[2].pointer;
+ static_memfuncp = argss->args[3].pointer;
+ err = (char *) argss->args[4].pointer;
+
+ (argss)->result.pointer = value_struct_elt (argp, args, name, static_memfuncp, err);
return 1;
}