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