* README: Mention gdbserver/README.
[deliverable/binutils-gdb.git] / gdb / wrapper.c
1 /* Longjump free calls to GDB internal routines.
2
3 Copyright (C) 1999, 2000, 2005, 2007, 2008 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 #include "defs.h"
19 #include "value.h"
20 #include "exceptions.h"
21 #include "wrapper.h"
22 #include "ui-out.h"
23
24 int
25 gdb_parse_exp_1 (char **stringptr, struct block *block, int comma,
26 struct expression **expression)
27 {
28 volatile struct gdb_exception except;
29
30 TRY_CATCH (except, RETURN_MASK_ERROR)
31 {
32 *expression = parse_exp_1 (stringptr, block, comma);
33 }
34
35 if (except.reason < 0)
36 return 0;
37 return 1;
38 }
39
40 int
41 gdb_evaluate_expression (struct expression *exp, struct value **value)
42 {
43 volatile struct gdb_exception except;
44
45 TRY_CATCH (except, RETURN_MASK_ERROR)
46 {
47 *value = evaluate_expression(exp);
48 }
49
50 if (except.reason < 0)
51 return 0;
52 return 1;
53 }
54
55 int
56 gdb_value_fetch_lazy (struct value *val)
57 {
58 volatile struct gdb_exception except;
59
60 TRY_CATCH (except, RETURN_MASK_ERROR)
61 {
62 value_fetch_lazy (val);
63 }
64
65 if (except.reason < 0)
66 return 0;
67 return 1;
68 }
69
70 int
71 gdb_value_equal (struct value *val1, struct value *val2, int *result)
72 {
73 volatile struct gdb_exception except;
74
75 TRY_CATCH (except, RETURN_MASK_ERROR)
76 {
77 *result = value_equal (val1, val2);
78 }
79
80 if (except.reason < 0)
81 return 0;
82 return 1;
83 }
84
85 int
86 gdb_value_assign (struct value *val1, struct value *val2,
87 struct value **result)
88 {
89 volatile struct gdb_exception except;
90
91 TRY_CATCH (except, RETURN_MASK_ERROR)
92 {
93 *result = value_assign (val1, val2);
94 }
95
96 if (except.reason < 0)
97 return 0;
98 return 1;
99 }
100
101 int
102 gdb_value_subscript (struct value *val1, struct value *val2,
103 struct value **result)
104 {
105 volatile struct gdb_exception except;
106
107 TRY_CATCH (except, RETURN_MASK_ERROR)
108 {
109 *result = value_subscript (val1, val2);
110 }
111
112 if (except.reason < 0)
113 return 0;
114 return 1;
115 }
116
117 int
118 gdb_value_ind (struct value *val, struct value **result)
119 {
120 volatile struct gdb_exception except;
121
122 TRY_CATCH (except, RETURN_MASK_ERROR)
123 {
124 *result = value_ind (val);
125 }
126
127 if (except.reason < 0)
128 return 0;
129 return 1;
130 }
131
132 int
133 gdb_parse_and_eval_type (char *p, int length, struct type **type)
134 {
135 volatile struct gdb_exception except;
136
137 TRY_CATCH (except, RETURN_MASK_ERROR)
138 {
139 *type = parse_and_eval_type (p, length);
140 }
141
142 if (except.reason < 0)
143 return 0;
144 return 1;
145 }
146
147 enum gdb_rc
148 gdb_value_struct_elt (struct ui_out *uiout, struct value **result,
149 struct value **argp, struct value **args, char *name,
150 int *static_memfuncp, char *err)
151 {
152 volatile struct gdb_exception except;
153
154 TRY_CATCH (except, RETURN_MASK_ALL)
155 {
156 *result = value_struct_elt (argp, args, name, static_memfuncp, err);
157 }
158
159 if (except.reason < 0)
160 return GDB_RC_FAIL;
161 return GDB_RC_OK;
162 }
This page took 0.031851 seconds and 4 git commands to generate.