diff options
author | Fernando Nasser <fnasser@redhat.com> | 2000-11-06 23:12:29 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@redhat.com> | 2000-11-06 23:12:29 +0000 |
commit | 8a1a01128de8adbea128525c11808b57bc9b04cd (patch) | |
tree | 715a34908306fd5192ae093617871d1780c6eb26 | |
parent | c4dfa77f430fbd0eb5ec1d22c2b29581091ab0fe (diff) | |
download | gdb-8a1a01128de8adbea128525c11808b57bc9b04cd.zip gdb-8a1a01128de8adbea128525c11808b57bc9b04cd.tar.gz gdb-8a1a01128de8adbea128525c11808b57bc9b04cd.tar.bz2 |
2000-11-06 Fernando Nasser <fnasser@totem.toronto.redhat.com>
* 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.
* varobj.c (varobj_set_value): Use gdb_value_assign, not
value_assign which can longjump. Do not change varobj value if
assign fails.
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/varobj.c | 3 | ||||
-rw-r--r-- | gdb/wrapper.c | 38 | ||||
-rw-r--r-- | gdb/wrapper.h | 2 |
4 files changed, 52 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d0ad9b9..4812ad0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2000-11-06 Fernando Nasser <fnasser@totem.toronto.redhat.com> + + * 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. + * varobj.c (varobj_set_value): Use gdb_value_assign, not + value_assign which can longjump. Do not change varobj value if + assign fails. + 2000-11-06 Fernando Nasser <fnasser@cygnus.com> From Steven Johnson <sbjohnson@ozemail.com.au>: diff --git a/gdb/varobj.c b/gdb/varobj.c index fe3f940..1ebf21c 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -818,7 +818,8 @@ varobj_set_value (struct varobj *var, char *expression) } VALUE_ADDRESS (temp) += offset; - val = value_assign (temp, value); + if (!gdb_value_assign (temp, value, &val)) + return 0; VALUE_ADDRESS (val) -= offset; value_free (var->value); release_value (val); diff --git a/gdb/wrapper.c b/gdb/wrapper.c index 60b259e..f8adff4 100644 --- a/gdb/wrapper.c +++ b/gdb/wrapper.c @@ -50,6 +50,8 @@ static int wrap_value_fetch_lazy (char *); static int wrap_value_equal (char *); +static int wrap_value_assign (char *); + static int wrap_value_subscript (char *); static int wrap_value_ind (char *opaque_arg); @@ -167,6 +169,42 @@ wrap_value_equal (char *a) } 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; +} + +int gdb_value_subscript (value_ptr val1, value_ptr val2, value_ptr *rval) { struct gdb_wrapper_arguments args; diff --git a/gdb/wrapper.h b/gdb/wrapper.h index 28261ac..85fc0b3 100644 --- a/gdb/wrapper.h +++ b/gdb/wrapper.h @@ -31,6 +31,8 @@ extern int gdb_value_fetch_lazy (value_ptr); extern int gdb_value_equal (value_ptr, value_ptr, int *); +extern int gdb_value_assign (value_ptr, value_ptr, value_ptr *); + extern int gdb_value_subscript (value_ptr, value_ptr, value_ptr *); extern int gdb_value_ind (value_ptr val, value_ptr * rval); |