kernel NFS - Fix another deadlock in the readdirplus code
[dragonfly.git] / contrib / gdb-7 / gdb / wrapper.c
blob931ecbf8105809e1deda1bbe722f7943d6f5e5be
1 /* Longjump free calls to GDB internal routines.
3 Copyright (C) 1999, 2000, 2005, 2007, 2008, 2009
4 Free Software Foundation, Inc.
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
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include "defs.h"
20 #include "value.h"
21 #include "exceptions.h"
22 #include "wrapper.h"
23 #include "ui-out.h"
25 int
26 gdb_parse_exp_1 (char **stringptr, struct block *block, int comma,
27 struct expression **expression)
29 volatile struct gdb_exception except;
31 TRY_CATCH (except, RETURN_MASK_ERROR)
33 *expression = parse_exp_1 (stringptr, block, comma);
36 if (except.reason < 0)
37 return 0;
38 return 1;
41 int
42 gdb_evaluate_expression (struct expression *exp, struct value **value)
44 volatile struct gdb_exception except;
46 TRY_CATCH (except, RETURN_MASK_ERROR)
48 *value = evaluate_expression(exp);
51 if (except.reason < 0)
52 return 0;
53 return 1;
56 int
57 gdb_value_fetch_lazy (struct value *val)
59 volatile struct gdb_exception except;
61 TRY_CATCH (except, RETURN_MASK_ERROR)
63 value_fetch_lazy (val);
66 if (except.reason < 0)
67 return 0;
68 return 1;
71 int
72 gdb_value_equal (struct value *val1, struct value *val2, int *result)
74 volatile struct gdb_exception except;
76 TRY_CATCH (except, RETURN_MASK_ERROR)
78 *result = value_equal (val1, val2);
81 if (except.reason < 0)
82 return 0;
83 return 1;
86 int
87 gdb_value_assign (struct value *val1, struct value *val2,
88 struct value **result)
90 volatile struct gdb_exception except;
92 TRY_CATCH (except, RETURN_MASK_ERROR)
94 *result = value_assign (val1, val2);
97 if (except.reason < 0)
98 return 0;
99 return 1;
103 gdb_value_subscript (struct value *val, LONGEST index,
104 struct value **result)
106 volatile struct gdb_exception except;
108 TRY_CATCH (except, RETURN_MASK_ERROR)
110 *result = value_subscript (val, index);
113 if (except.reason < 0)
114 return 0;
115 return 1;
119 gdb_value_ind (struct value *val, struct value **result)
121 volatile struct gdb_exception except;
123 TRY_CATCH (except, RETURN_MASK_ERROR)
125 *result = value_ind (val);
128 if (except.reason < 0)
129 return 0;
130 return 1;
134 gdb_parse_and_eval_type (char *p, int length, struct type **type)
136 volatile struct gdb_exception except;
138 TRY_CATCH (except, RETURN_MASK_ERROR)
140 *type = parse_and_eval_type (p, length);
143 if (except.reason < 0)
144 return 0;
145 return 1;
148 enum gdb_rc
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)
153 volatile struct gdb_exception except;
155 TRY_CATCH (except, RETURN_MASK_ERROR)
157 *result = value_struct_elt (argp, args, name, static_memfuncp, err);
160 if (except.reason < 0)
161 return GDB_RC_FAIL;
162 return GDB_RC_OK;