1 /* Longjump free calls to gdb internal routines.
2 Copyright 1999 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
24 /* Use this struct used to pass arguments to wrapper routines. We assume
25 (arbitrarily) that no gdb function takes more than ten arguments. */
26 struct gdb_wrapper_arguments
29 /* Pointer to some result from the gdb function call, if any */
32 /* The list of arguments. */
36 int gdb_evaluate_expression
PARAMS ((struct expression
*, value_ptr
*));
37 int wrap_evaluate_expression
PARAMS ((char *));
39 int gdb_value_fetch_lazy
PARAMS ((value_ptr
));
40 int wrap_value_fetch_lazy
PARAMS ((char *));
42 int gdb_value_equal
PARAMS ((value_ptr
, value_ptr
, int *));
43 int wrap_value_equal
PARAMS ((char *));
45 int gdb_value_ind
PARAMS ((value_ptr val
, value_ptr
* rval
));
46 int wrap_value_ind
PARAMS ((char *opaque_arg
));
49 gdb_evaluate_expression (exp
, value
)
50 struct expression
*exp
;
53 struct gdb_wrapper_arguments args
;
54 args
.args
[0] = (char *) exp
;
56 if (!catch_errors ((catch_errors_ftype
*) wrap_evaluate_expression
, &args
,
57 "", RETURN_MASK_ERROR
))
59 /* An error occurred */
63 *value
= (value_ptr
) args
.result
;
68 wrap_evaluate_expression (a
)
71 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) a
;
74 (char *) evaluate_expression ((struct expression
*) (args
)->args
[0]);
79 gdb_value_fetch_lazy (value
)
82 struct gdb_wrapper_arguments args
;
84 args
.args
[0] = (char *) value
;
85 return catch_errors ((catch_errors_ftype
*) wrap_value_fetch_lazy
, &args
,
86 "", RETURN_MASK_ERROR
);
90 wrap_value_fetch_lazy (a
)
93 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) a
;
95 value_fetch_lazy ((value_ptr
) (args
)->args
[0]);
100 gdb_value_equal (val1
, val2
, result
)
105 struct gdb_wrapper_arguments args
;
107 args
.args
[0] = (char *) val1
;
108 args
.args
[1] = (char *) val2
;
110 if (!catch_errors ((catch_errors_ftype
*) wrap_value_equal
, &args
,
111 "", RETURN_MASK_ERROR
))
113 /* An error occurred */
117 *result
= (int) args
.result
;
125 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) a
;
126 value_ptr val1
, val2
;
128 val1
= (value_ptr
) (args
)->args
[0];
129 val2
= (value_ptr
) (args
)->args
[1];
131 (args
)->result
= (char *) value_equal (val1
, val2
);
136 gdb_value_ind (val
, rval
)
140 struct gdb_wrapper_arguments args
;
142 args
.args
[0] = (char *) val
;
144 if (!catch_errors ((catch_errors_ftype
*) wrap_value_ind
, &args
,
145 "", RETURN_MASK_ERROR
))
147 /* An error occurred */
151 *rval
= (value_ptr
) args
.result
;
156 wrap_value_ind (opaque_arg
)
159 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) opaque_arg
;
162 val
= (value_ptr
) (args
)->args
[0];
163 (args
)->result
= (char *) value_ind (val
);