Commit | Line | Data |
---|---|---|
1c7b1e5a MK |
1 | /* Longjump free calls to GDB internal routines. |
2 | ||
9b254dd1 | 3 | Copyright (C) 1999, 2000, 2005, 2007, 2008 Free Software Foundation, Inc. |
8b93c638 JM |
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 | |
a9762ec7 | 7 | the Free Software Foundation; either version 3 of the License, or |
8b93c638 JM |
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 | |
a9762ec7 | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
8b93c638 JM |
17 | |
18 | #include "defs.h" | |
19 | #include "value.h" | |
60250e8b | 20 | #include "exceptions.h" |
8b93c638 | 21 | #include "wrapper.h" |
1c7b1e5a | 22 | #include "ui-out.h" |
c91ecb25 | 23 | |
73a93a32 | 24 | int |
fba45db2 KB |
25 | gdb_parse_exp_1 (char **stringptr, struct block *block, int comma, |
26 | struct expression **expression) | |
73a93a32 | 27 | { |
71fff37b | 28 | volatile struct gdb_exception except; |
73a93a32 | 29 | |
1c7b1e5a | 30 | TRY_CATCH (except, RETURN_MASK_ERROR) |
73a93a32 | 31 | { |
1c7b1e5a | 32 | *expression = parse_exp_1 (stringptr, block, comma); |
73a93a32 JI |
33 | } |
34 | ||
1c7b1e5a MK |
35 | if (except.reason < 0) |
36 | return 0; | |
73a93a32 JI |
37 | return 1; |
38 | } | |
39 | ||
8b93c638 | 40 | int |
c9847381 | 41 | gdb_evaluate_expression (struct expression *exp, struct value **value) |
8b93c638 | 42 | { |
71fff37b | 43 | volatile struct gdb_exception except; |
8b93c638 | 44 | |
1c7b1e5a | 45 | TRY_CATCH (except, RETURN_MASK_ERROR) |
8b93c638 | 46 | { |
1c7b1e5a | 47 | *value = evaluate_expression(exp); |
8b93c638 JM |
48 | } |
49 | ||
1c7b1e5a MK |
50 | if (except.reason < 0) |
51 | return 0; | |
8b93c638 JM |
52 | return 1; |
53 | } | |
54 | ||
55 | int | |
1c7b1e5a | 56 | gdb_value_fetch_lazy (struct value *val) |
8b93c638 | 57 | { |
71fff37b | 58 | volatile struct gdb_exception except; |
8b93c638 | 59 | |
1c7b1e5a MK |
60 | TRY_CATCH (except, RETURN_MASK_ERROR) |
61 | { | |
62 | value_fetch_lazy (val); | |
63 | } | |
8b93c638 | 64 | |
1c7b1e5a MK |
65 | if (except.reason < 0) |
66 | return 0; | |
8b93c638 JM |
67 | return 1; |
68 | } | |
69 | ||
70 | int | |
c9847381 | 71 | gdb_value_equal (struct value *val1, struct value *val2, int *result) |
8b93c638 | 72 | { |
71fff37b | 73 | volatile struct gdb_exception except; |
8b93c638 | 74 | |
1c7b1e5a | 75 | TRY_CATCH (except, RETURN_MASK_ERROR) |
8b93c638 | 76 | { |
1c7b1e5a | 77 | *result = value_equal (val1, val2); |
8b93c638 JM |
78 | } |
79 | ||
1c7b1e5a MK |
80 | if (except.reason < 0) |
81 | return 0; | |
8b93c638 JM |
82 | return 1; |
83 | } | |
84 | ||
8a1a0112 | 85 | int |
1c7b1e5a MK |
86 | gdb_value_assign (struct value *val1, struct value *val2, |
87 | struct value **result) | |
8a1a0112 | 88 | { |
71fff37b | 89 | volatile struct gdb_exception except; |
8a1a0112 | 90 | |
1c7b1e5a | 91 | TRY_CATCH (except, RETURN_MASK_ERROR) |
8a1a0112 | 92 | { |
1c7b1e5a | 93 | *result = value_assign (val1, val2); |
8a1a0112 FN |
94 | } |
95 | ||
1c7b1e5a MK |
96 | if (except.reason < 0) |
97 | return 0; | |
8a1a0112 FN |
98 | return 1; |
99 | } | |
100 | ||
8310b29b | 101 | int |
1c7b1e5a MK |
102 | gdb_value_subscript (struct value *val1, struct value *val2, |
103 | struct value **result) | |
8310b29b | 104 | { |
71fff37b | 105 | volatile struct gdb_exception except; |
8310b29b | 106 | |
1c7b1e5a | 107 | TRY_CATCH (except, RETURN_MASK_ERROR) |
8310b29b | 108 | { |
1c7b1e5a | 109 | *result = value_subscript (val1, val2); |
8310b29b FN |
110 | } |
111 | ||
1c7b1e5a MK |
112 | if (except.reason < 0) |
113 | return 0; | |
8310b29b FN |
114 | return 1; |
115 | } | |
116 | ||
8b93c638 | 117 | int |
1c7b1e5a | 118 | gdb_value_ind (struct value *val, struct value **result) |
8b93c638 | 119 | { |
71fff37b | 120 | volatile struct gdb_exception except; |
8b93c638 | 121 | |
1c7b1e5a | 122 | TRY_CATCH (except, RETURN_MASK_ERROR) |
8b93c638 | 123 | { |
1c7b1e5a | 124 | *result = value_ind (val); |
8b93c638 JM |
125 | } |
126 | ||
1c7b1e5a MK |
127 | if (except.reason < 0) |
128 | return 0; | |
8b93c638 JM |
129 | return 1; |
130 | } | |
73a93a32 | 131 | |
c91ecb25 ND |
132 | int |
133 | gdb_parse_and_eval_type (char *p, int length, struct type **type) | |
134 | { | |
71fff37b | 135 | volatile struct gdb_exception except; |
c91ecb25 | 136 | |
1c7b1e5a | 137 | TRY_CATCH (except, RETURN_MASK_ERROR) |
c91ecb25 | 138 | { |
1c7b1e5a | 139 | *type = parse_and_eval_type (p, length); |
c91ecb25 ND |
140 | } |
141 | ||
1c7b1e5a MK |
142 | if (except.reason < 0) |
143 | return 0; | |
c91ecb25 ND |
144 | return 1; |
145 | } | |
ddc54292 KS |
146 | |
147 | enum gdb_rc | |
1c7b1e5a MK |
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) | |
ddc54292 | 151 | { |
71fff37b | 152 | volatile struct gdb_exception except; |
ddc54292 | 153 | |
1c7b1e5a MK |
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; | |
ddc54292 KS |
161 | return GDB_RC_OK; |
162 | } |