This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] varobj.c, wrapper.[ch] Wrap value_assign
- To: gdb-patches at sources dot redhat dot com
- Subject: [patch] varobj.c, wrapper.[ch] Wrap value_assign
- From: Fernando Nasser <fnasser at cygnus dot com>
- Date: Mon, 06 Nov 2000 22:10:01 +0000
- Organization: Red Hat Canada Ltd. - Toronto
I am adding a wrapped version of value_assign to prevent any longjump to
send the GUI to nowhere land.
* wrapper.c (gdb_value_assign): New function. Longjump-free
version of value_assign.
(wrap_value_assign): New function. Wrapper for value_assign.
* wrapper.h: Add declaration for the above. Also, add missing
declaration of gdb_value_subscript.
* varobj.c (varobj_set_value): Use gdb_value_assign, not
value_assign which can longjump. Do not change varobj value if
assign fails.
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
Index: varobj.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/varobj.c,v
retrieving revision 1.29.12.3
diff -c -p -r1.29.12.3 varobj.c
*** varobj.c 2000/09/27 17:23:44 1.29.12.3
--- varobj.c 2000/11/03 22:29:29
*************** varobj_set_value (struct varobj *var, ch
*** 817,823 ****
}
VALUE_ADDRESS (temp) += offset;
! val = value_assign (temp, value);
VALUE_ADDRESS (val) -= offset;
value_free (var->value);
release_value (val);
--- 817,824 ----
}
VALUE_ADDRESS (temp) += offset;
! if (!gdb_value_assign (temp, value, &val))
! return 0;
VALUE_ADDRESS (val) -= offset;
value_free (var->value);
release_value (val);
Index: wrapper.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/wrapper.c,v
retrieving revision 1.5
diff -c -p -r1.5 wrapper.c
*** wrapper.c 2000/04/17 08:28:36 1.5
--- wrapper.c 2000/11/03 22:29:29
*************** static int wrap_value_fetch_lazy PARAMS
*** 50,55 ****
--- 50,57 ----
static int wrap_value_equal PARAMS ((char *));
+ static int wrap_value_assign PARAMS ((char *));
+
static int wrap_value_subscript PARAMS ((char *));
static int wrap_value_ind PARAMS ((char *opaque_arg));
*************** wrap_value_equal (a)
*** 176,181 ****
--- 178,219 ----
val2 = (value_ptr) (args)->args[1].pointer;
(args)->result.integer = value_equal (val1, val2);
+ return 1;
+ }
+
+ int
+ gdb_value_assign (val1, val2, result)
+ value_ptr val1;
+ value_ptr val2;
+ value_ptr *result;
+ {
+ struct gdb_wrapper_arguments args;
+
+ args.args[0].pointer = val1;
+ args.args[1].pointer = val2;
+
+ if (!catch_errors ((catch_errors_ftype *) wrap_value_assign, &args,
+ "", RETURN_MASK_ERROR))
+ {
+ /* An error occurred */
+ return 0;
+ }
+
+ *result = (value_ptr) args.result.pointer;
+ return 1;
+ }
+
+ static int
+ wrap_value_assign (a)
+ char *a;
+ {
+ struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
+ value_ptr val1, val2;
+
+ val1 = (value_ptr) (args)->args[0].pointer;
+ val2 = (value_ptr) (args)->args[1].pointer;
+
+ (args)->result.pointer = value_assign (val1, val2);
return 1;
}
Index: wrapper.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/wrapper.h,v
retrieving revision 1.6
diff -c -p -r1.6 wrapper.h
*** wrapper.h 2000/05/01 04:46:48 1.6
--- wrapper.h 2000/11/03 22:29:29
*************** extern int gdb_value_fetch_lazy PARAMS (
*** 31,37 ****
--- 31,42 ----
extern int gdb_value_equal PARAMS ((value_ptr, value_ptr, int *));
+ extern int gdb_value_assign PARAMS ((value_ptr, value_ptr, value_ptr *));
+
extern int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval));
+
+ extern int gdb_value_subscript PARAMS ((value_ptr val1, value_ptr val2,
+ value_ptr * rval));
extern int gdb_parse_and_eval_type (char *, int, struct type **);