OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [wrapper.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 markom
/* Longjump free calls to gdb internal routines.
2
   Copyright 1999 Free Software Foundation, Inc.
3
 
4
   This program is free software; you can redistribute it and/or modify
5
   it under the terms of the GNU General Public License as published by
6
   the Free Software Foundation; either version 2 of the License, or
7
   (at your option) any later version.
8
 
9
   This program is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
   GNU General Public License for more details.
13
 
14
   You should have received a copy of the GNU General Public License
15
   along with this program; if not, write to the Free Software
16
   Foundation, Inc., 59 Temple Place - Suite 330,
17
   Boston, MA 02111-1307, USA.  */
18
 
19
#include "defs.h"
20
#include "value.h"
21
#include "frame.h"
22
#include "wrapper.h"
23
 
24
/* Use this struct to pass arguments to wrapper routines. We assume
25
   (arbitrarily) that no gdb function takes more than ten arguments. */
26
struct gdb_wrapper_arguments
27
  {
28
 
29
    /* Pointer to some result from the gdb function call, if any */
30
    union wrapper_results
31
      {
32
        int   integer;
33
        void *pointer;
34
      } result;
35
 
36
 
37
    /* The list of arguments. */
38
    union wrapper_args
39
      {
40
        int   integer;
41
        void *pointer;
42
      } args[10];
43
  };
44
 
45
int gdb_parse_exp_1 PARAMS ((char **, struct block *,
46
                             int, struct expression **));
47
int wrap_parse_exp_1 PARAMS ((char *));
48
 
49
int gdb_evaluate_expression PARAMS ((struct expression *, value_ptr *));
50
int wrap_evaluate_expression PARAMS ((char *));
51
 
52
int gdb_value_fetch_lazy PARAMS ((value_ptr));
53
int wrap_value_fetch_lazy PARAMS ((char *));
54
 
55
int gdb_value_equal PARAMS ((value_ptr, value_ptr, int *));
56
int wrap_value_equal PARAMS ((char *));
57
 
58
int gdb_value_subscript PARAMS ((value_ptr, value_ptr, value_ptr * rval));
59
int wrap_value_subscript PARAMS ((char *));
60
 
61
int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval));
62
int wrap_value_ind PARAMS ((char *opaque_arg));
63
 
64
int gdb_parse_and_eval_type (char *, int, struct type **);
65
int wrap_parse_and_eval_type (char *);
66
 
67
int
68
gdb_parse_exp_1 (stringptr, block, comma, expression)
69
     char **stringptr;
70
     struct block *block;
71
     int comma;
72
     struct expression **expression;
73
{
74
  struct gdb_wrapper_arguments args;
75
  args.args[0].pointer = stringptr;
76
  args.args[1].pointer = block;
77
  args.args[2].integer = comma;
78
 
79
  if (!catch_errors ((catch_errors_ftype *) wrap_parse_exp_1, &args,
80
                     "", RETURN_MASK_ERROR))
81
    {
82
      /* An error occurred */
83
      return 0;
84
    }
85
 
86
  *expression = (struct expression *) args.result.pointer;
87
  return 1;
88
 
89
}
90
 
91
int
92
wrap_parse_exp_1 (argptr)
93
     char *argptr;
94
{
95
  struct gdb_wrapper_arguments *args
96
    = (struct gdb_wrapper_arguments *) argptr;
97
  args->result.pointer = parse_exp_1((char **) args->args[0].pointer,
98
                                     (struct block *) args->args[1].pointer,
99
                                     args->args[2].integer);
100
  return 1;
101
}
102
 
103
int
104
gdb_evaluate_expression (exp, value)
105
     struct expression *exp;
106
     value_ptr *value;
107
{
108
  struct gdb_wrapper_arguments args;
109
  args.args[0].pointer = exp;
110
 
111
  if (!catch_errors ((catch_errors_ftype *) wrap_evaluate_expression, &args,
112
                     "", RETURN_MASK_ERROR))
113
    {
114
      /* An error occurred */
115
      return 0;
116
    }
117
 
118
  *value = (value_ptr) args.result.pointer;
119
  return 1;
120
}
121
 
122
int
123
wrap_evaluate_expression (a)
124
     char *a;
125
{
126
  struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
127
 
128
  (args)->result.pointer =
129
    (char *) evaluate_expression ((struct expression *) args->args[0].pointer);
130
  return 1;
131
}
132
 
133
int
134
gdb_value_fetch_lazy (value)
135
     value_ptr value;
136
{
137
  struct gdb_wrapper_arguments args;
138
 
139
  args.args[0].pointer = value;
140
  return catch_errors ((catch_errors_ftype *) wrap_value_fetch_lazy, &args,
141
                       "", RETURN_MASK_ERROR);
142
}
143
 
144
int
145
wrap_value_fetch_lazy (a)
146
     char *a;
147
{
148
  struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
149
 
150
  value_fetch_lazy ((value_ptr) (args)->args[0].pointer);
151
  return 1;
152
}
153
 
154
int
155
gdb_value_equal (val1, val2, result)
156
     value_ptr val1;
157
     value_ptr val2;
158
     int *result;
159
{
160
  struct gdb_wrapper_arguments args;
161
 
162
  args.args[0].pointer = val1;
163
  args.args[1].pointer = val2;
164
 
165
  if (!catch_errors ((catch_errors_ftype *) wrap_value_equal, &args,
166
                     "", RETURN_MASK_ERROR))
167
    {
168
      /* An error occurred */
169
      return 0;
170
    }
171
 
172
  *result = args.result.integer;
173
  return 1;
174
}
175
 
176
int
177
wrap_value_equal (a)
178
     char *a;
179
{
180
  struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
181
  value_ptr val1, val2;
182
 
183
  val1 = (value_ptr) (args)->args[0].pointer;
184
  val2 = (value_ptr) (args)->args[1].pointer;
185
 
186
  (args)->result.integer = value_equal (val1, val2);
187
  return 1;
188
}
189
 
190
int
191
gdb_value_subscript (val1, val2, rval)
192
     value_ptr val1;
193
     value_ptr val2;
194
     value_ptr * rval;
195
{
196
  struct gdb_wrapper_arguments args;
197
 
198
  args.args[0].pointer = val1;
199
  args.args[1].pointer = val2;
200
 
201
  if (!catch_errors ((catch_errors_ftype *) wrap_value_subscript, &args,
202
                     "", RETURN_MASK_ERROR))
203
    {
204
      /* An error occurred */
205
      return 0;
206
    }
207
 
208
  *rval = (value_ptr) args.result.pointer;
209
  return 1;
210
}
211
 
212
int
213
wrap_value_subscript (a)
214
     char *a;
215
{
216
  struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
217
  value_ptr val1, val2;
218
 
219
  val1 = (value_ptr) (args)->args[0].pointer;
220
  val2 = (value_ptr) (args)->args[1].pointer;
221
 
222
  (args)->result.pointer = value_subscript (val1, val2);
223
  return 1;
224
}
225
 
226
int
227
gdb_value_ind (val, rval)
228
     value_ptr val;
229
     value_ptr *rval;
230
{
231
  struct gdb_wrapper_arguments args;
232
 
233
  args.args[0].pointer = val;
234
 
235
  if (!catch_errors ((catch_errors_ftype *) wrap_value_ind, &args,
236
                     "", RETURN_MASK_ERROR))
237
    {
238
      /* An error occurred */
239
      return 0;
240
    }
241
 
242
  *rval = (value_ptr) args.result.pointer;
243
  return 1;
244
}
245
 
246
int
247
wrap_value_ind (opaque_arg)
248
     char *opaque_arg;
249
{
250
  struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) opaque_arg;
251
  value_ptr val;
252
 
253
  val = (value_ptr) (args)->args[0].pointer;
254
  (args)->result.pointer = value_ind (val);
255
  return 1;
256
}
257
 
258
int
259
gdb_parse_and_eval_type (char *p, int length, struct type **type)
260
{
261
  struct gdb_wrapper_arguments args;
262
  args.args[0].pointer = p;
263
  args.args[1].integer = length;
264
 
265
  if (!catch_errors ((catch_errors_ftype *) wrap_parse_and_eval_type, &args,
266
                     "", RETURN_MASK_ALL))
267
    {
268
      /* An error occurred */
269
      return 0;
270
    }
271
 
272
  *type = (struct type *) args.result.pointer;
273
  return 1;
274
}
275
 
276
int
277
wrap_parse_and_eval_type (char *a)
278
{
279
  struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a;
280
 
281
  char *p = (char *) args->args[0].pointer;
282
  int length = args->args[1].integer;
283
 
284
  args->result.pointer = (char *) parse_and_eval_type (p, length);
285
 
286
  return 1;
287
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.