2006-12-26 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / gdb / wrapper.c
... / ...
CommitLineData
1/* Longjump free calls to GDB internal routines.
2
3 Copyright (C) 1999, 2000, 2005 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 2 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, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA. */
19
20#include "defs.h"
21#include "value.h"
22#include "exceptions.h"
23#include "wrapper.h"
24#include "ui-out.h"
25
26int
27gdb_parse_exp_1 (char **stringptr, struct block *block, int comma,
28 struct expression **expression)
29{
30 volatile struct gdb_exception except;
31
32 TRY_CATCH (except, RETURN_MASK_ERROR)
33 {
34 *expression = parse_exp_1 (stringptr, block, comma);
35 }
36
37 if (except.reason < 0)
38 return 0;
39 return 1;
40}
41
42int
43gdb_evaluate_expression (struct expression *exp, struct value **value)
44{
45 volatile struct gdb_exception except;
46
47 TRY_CATCH (except, RETURN_MASK_ERROR)
48 {
49 *value = evaluate_expression(exp);
50 }
51
52 if (except.reason < 0)
53 return 0;
54 return 1;
55}
56
57int
58gdb_value_fetch_lazy (struct value *val)
59{
60 volatile struct gdb_exception except;
61
62 TRY_CATCH (except, RETURN_MASK_ERROR)
63 {
64 value_fetch_lazy (val);
65 }
66
67 if (except.reason < 0)
68 return 0;
69 return 1;
70}
71
72int
73gdb_value_equal (struct value *val1, struct value *val2, int *result)
74{
75 volatile struct gdb_exception except;
76
77 TRY_CATCH (except, RETURN_MASK_ERROR)
78 {
79 *result = value_equal (val1, val2);
80 }
81
82 if (except.reason < 0)
83 return 0;
84 return 1;
85}
86
87int
88gdb_value_assign (struct value *val1, struct value *val2,
89 struct value **result)
90{
91 volatile struct gdb_exception except;
92
93 TRY_CATCH (except, RETURN_MASK_ERROR)
94 {
95 *result = value_assign (val1, val2);
96 }
97
98 if (except.reason < 0)
99 return 0;
100 return 1;
101}
102
103int
104gdb_value_subscript (struct value *val1, struct value *val2,
105 struct value **result)
106{
107 volatile struct gdb_exception except;
108
109 TRY_CATCH (except, RETURN_MASK_ERROR)
110 {
111 *result = value_subscript (val1, val2);
112 }
113
114 if (except.reason < 0)
115 return 0;
116 return 1;
117}
118
119int
120gdb_value_ind (struct value *val, struct value **result)
121{
122 volatile struct gdb_exception except;
123
124 TRY_CATCH (except, RETURN_MASK_ERROR)
125 {
126 *result = value_ind (val);
127 }
128
129 if (except.reason < 0)
130 return 0;
131 return 1;
132}
133
134int
135gdb_parse_and_eval_type (char *p, int length, struct type **type)
136{
137 volatile struct gdb_exception except;
138
139 TRY_CATCH (except, RETURN_MASK_ERROR)
140 {
141 *type = parse_and_eval_type (p, length);
142 }
143
144 if (except.reason < 0)
145 return 0;
146 return 1;
147}
148
149enum gdb_rc
150gdb_value_struct_elt (struct ui_out *uiout, struct value **result,
151 struct value **argp, struct value **args, char *name,
152 int *static_memfuncp, char *err)
153{
154 volatile struct gdb_exception except;
155
156 TRY_CATCH (except, RETURN_MASK_ALL)
157 {
158 *result = value_struct_elt (argp, args, name, static_memfuncp, err);
159 }
160
161 if (except.reason < 0)
162 return GDB_RC_FAIL;
163 return GDB_RC_OK;
164}
This page took 0.022058 seconds and 4 git commands to generate.