From 8310b29b55fa6a6d33400670331d3e6506773293 Mon Sep 17 00:00:00 2001 From: Fernando Nasser Date: Thu, 30 Mar 2000 20:15:35 +0000 Subject: 2000-03-30 Fernando Nasser * wrapper.c (gdb_value_subscript, wrap_value_subscript): New functions. Safe version of value_subscript. * varobj.c (): Use gdb_value_subscript() to get an array element value. --- gdb/wrapper.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'gdb/wrapper.c') diff --git a/gdb/wrapper.c b/gdb/wrapper.c index 07ac39a..83405e5 100644 --- a/gdb/wrapper.c +++ b/gdb/wrapper.c @@ -55,6 +55,9 @@ int wrap_value_fetch_lazy PARAMS ((char *)); int gdb_value_equal PARAMS ((value_ptr, value_ptr, int *)); int wrap_value_equal PARAMS ((char *)); +int gdb_value_subscript PARAMS ((value_ptr, value_ptr, value_ptr * rval)); +int wrap_value_subscript PARAMS ((char *)); + int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval)); int wrap_value_ind PARAMS ((char *opaque_arg)); @@ -182,6 +185,42 @@ wrap_value_equal (a) } int +gdb_value_subscript (val1, val2, rval) + value_ptr val1; + value_ptr val2; + value_ptr * rval; +{ + struct gdb_wrapper_arguments args; + + args.args[0].pointer = val1; + args.args[1].pointer = val2; + + if (!catch_errors ((catch_errors_ftype *) wrap_value_subscript, &args, + "", RETURN_MASK_ERROR)) + { + /* An error occurred */ + return 0; + } + + *rval = (value_ptr) args.result.pointer; + return 1; +} + +int +wrap_value_subscript (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_subscript (val1, val2); + return 1; +} + +int gdb_value_ind (val, rval) value_ptr val; value_ptr *rval; -- cgit v1.1