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_parse_exp_1
PARAMS ((char **, struct block
*,
37 int, struct expression
**));
38 int wrap_parse_exp_1
PARAMS ((char *));
40 int gdb_evaluate_expression
PARAMS ((struct expression
*, value_ptr
*));
41 int wrap_evaluate_expression
PARAMS ((char *));
43 int gdb_value_fetch_lazy
PARAMS ((value_ptr
));
44 int wrap_value_fetch_lazy
PARAMS ((char *));
46 int gdb_value_equal
PARAMS ((value_ptr
, value_ptr
, int *));
47 int wrap_value_equal
PARAMS ((char *));
49 int gdb_value_ind
PARAMS ((value_ptr val
, value_ptr
* rval
));
50 int wrap_value_ind
PARAMS ((char *opaque_arg
));
53 gdb_parse_exp_1 (stringptr
, block
, comma
, expression
)
57 struct expression
**expression
;
59 struct gdb_wrapper_arguments args
;
60 args
.args
[0] = (char *) stringptr
;
61 args
.args
[1] = (char *) block
;
62 args
.args
[2] = (char *) comma
;
64 if (!catch_errors ((catch_errors_ftype
*) wrap_parse_exp_1
, &args
,
65 "", RETURN_MASK_ERROR
))
67 /* An error occurred */
71 *expression
= (struct expression
*) args
.result
;
77 wrap_parse_exp_1 (argptr
)
80 struct gdb_wrapper_arguments
*args
81 = (struct gdb_wrapper_arguments
*) argptr
;
82 args
->result
= (char *) parse_exp_1((char **) args
->args
[0],
83 (struct block
*) args
->args
[1],
89 gdb_evaluate_expression (exp
, value
)
90 struct expression
*exp
;
93 struct gdb_wrapper_arguments args
;
94 args
.args
[0] = (char *) exp
;
96 if (!catch_errors ((catch_errors_ftype
*) wrap_evaluate_expression
, &args
,
97 "", RETURN_MASK_ERROR
))
99 /* An error occurred */
103 *value
= (value_ptr
) args
.result
;
108 wrap_evaluate_expression (a
)
111 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) a
;
114 (char *) evaluate_expression ((struct expression
*) (args
)->args
[0]);
119 gdb_value_fetch_lazy (value
)
122 struct gdb_wrapper_arguments args
;
124 args
.args
[0] = (char *) value
;
125 return catch_errors ((catch_errors_ftype
*) wrap_value_fetch_lazy
, &args
,
126 "", RETURN_MASK_ERROR
);
130 wrap_value_fetch_lazy (a
)
133 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) a
;
135 value_fetch_lazy ((value_ptr
) (args
)->args
[0]);
140 gdb_value_equal (val1
, val2
, result
)
145 struct gdb_wrapper_arguments args
;
147 args
.args
[0] = (char *) val1
;
148 args
.args
[1] = (char *) val2
;
150 if (!catch_errors ((catch_errors_ftype
*) wrap_value_equal
, &args
,
151 "", RETURN_MASK_ERROR
))
153 /* An error occurred */
157 *result
= (int) args
.result
;
165 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) a
;
166 value_ptr val1
, val2
;
168 val1
= (value_ptr
) (args
)->args
[0];
169 val2
= (value_ptr
) (args
)->args
[1];
171 (args
)->result
= (char *) value_equal (val1
, val2
);
176 gdb_value_ind (val
, rval
)
180 struct gdb_wrapper_arguments args
;
182 args
.args
[0] = (char *) val
;
184 if (!catch_errors ((catch_errors_ftype
*) wrap_value_ind
, &args
,
185 "", RETURN_MASK_ERROR
))
187 /* An error occurred */
191 *rval
= (value_ptr
) args
.result
;
196 wrap_value_ind (opaque_arg
)
199 struct gdb_wrapper_arguments
*args
= (struct gdb_wrapper_arguments
*) opaque_arg
;
202 val
= (value_ptr
) (args
)->args
[0];
203 (args
)->result
= (char *) value_ind (val
);