Commit | Line | Data |
---|---|---|
ed3ef339 DE |
1 | /* Internal header for GDB/Scheme code. |
2 | ||
3 | Copyright (C) 2014 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | /* See README file in this directory for implementation notes, coding | |
21 | conventions, et.al. */ | |
22 | ||
23 | #ifndef GDB_GUILE_INTERNAL_H | |
24 | #define GDB_GUILE_INTERNAL_H | |
25 | ||
26 | #include "hashtab.h" | |
27 | #include "extension-priv.h" | |
28 | #include "symtab.h" | |
29 | #include "libguile.h" | |
30 | ||
31 | struct block; | |
32 | struct frame_info; | |
33 | struct objfile; | |
34 | struct symbol; | |
35 | ||
36 | /* A function to pass to the safe-call routines to ignore things like | |
37 | memory errors. */ | |
38 | typedef int excp_matcher_func (SCM key); | |
39 | ||
40 | /* Scheme variables to define during initialization. */ | |
41 | ||
42 | typedef struct | |
43 | { | |
44 | const char *name; | |
45 | SCM value; | |
46 | const char *doc_string; | |
47 | } scheme_variable; | |
48 | ||
49 | /* End of scheme_variable table mark. */ | |
50 | ||
51 | #define END_VARIABLES { NULL, SCM_BOOL_F, NULL } | |
52 | ||
53 | /* Scheme functions to define during initialization. */ | |
54 | ||
55 | typedef struct | |
56 | { | |
57 | const char *name; | |
58 | int required; | |
59 | int optional; | |
60 | int rest; | |
61 | scm_t_subr func; | |
62 | const char *doc_string; | |
63 | } scheme_function; | |
64 | ||
65 | /* End of scheme_function table mark. */ | |
66 | ||
67 | #define END_FUNCTIONS { NULL, 0, 0, 0, NULL, NULL } | |
68 | ||
69 | /* Useful for defining a set of constants. */ | |
70 | ||
71 | typedef struct | |
72 | { | |
73 | const char *name; | |
74 | int value; | |
75 | } scheme_integer_constant; | |
76 | ||
77 | #define END_INTEGER_CONSTANTS { NULL, 0 } | |
78 | ||
79 | /* Pass this instead of 0 to routines like SCM_ASSERT to indicate the value | |
80 | is not a function argument. */ | |
81 | #define GDBSCM_ARG_NONE 0 | |
82 | ||
83 | /* Ensure new code doesn't accidentally try to use this. */ | |
84 | #undef scm_make_smob_type | |
85 | #define scm_make_smob_type USE_gdbscm_make_smob_type_INSTEAD | |
86 | ||
87 | /* They brought over () == #f from lisp. | |
88 | Let's avoid that for now. */ | |
89 | #undef scm_is_bool | |
90 | #undef scm_is_false | |
91 | #undef scm_is_true | |
92 | #define scm_is_bool USE_gdbscm_is_bool_INSTEAD | |
93 | #define scm_is_false USE_gdbscm_is_false_INSTEAD | |
94 | #define scm_is_true USE_gdbscm_is_true_INSTEAD | |
95 | #define gdbscm_is_bool(scm) \ | |
96 | (scm_is_eq ((scm), SCM_BOOL_F) || scm_is_eq ((scm), SCM_BOOL_T)) | |
97 | #define gdbscm_is_false(scm) scm_is_eq ((scm), SCM_BOOL_F) | |
98 | #define gdbscm_is_true(scm) (!gdbscm_is_false (scm)) | |
99 | ||
16954d5d LC |
100 | #ifndef HAVE_SCM_NEW_SMOB |
101 | ||
102 | /* Guile <= 2.0.5 did not provide this function, so provide it here. */ | |
103 | ||
104 | static inline SCM | |
105 | scm_new_smob (scm_t_bits tc, scm_t_bits data) | |
106 | { | |
107 | SCM_RETURN_NEWSMOB (tc, data); | |
108 | } | |
109 | ||
110 | #endif | |
111 | ||
ed3ef339 DE |
112 | /* Function name that is passed around in case an error needs to be reported. |
113 | __func is in C99, but we provide a wrapper "just in case", | |
114 | and because FUNC_NAME is the canonical value used in guile sources. | |
115 | IWBN to use the Scheme version of the name (e.g. foo-bar vs foo_bar), | |
116 | but let's KISS for now. */ | |
117 | #define FUNC_NAME __func__ | |
118 | ||
119 | extern const char gdbscm_module_name[]; | |
120 | extern const char gdbscm_init_module_name[]; | |
121 | ||
122 | extern int gdb_scheme_initialized; | |
123 | ||
124 | extern const char gdbscm_print_excp_none[]; | |
125 | extern const char gdbscm_print_excp_full[]; | |
126 | extern const char gdbscm_print_excp_message[]; | |
127 | extern const char *gdbscm_print_excp; | |
128 | ||
129 | extern SCM gdbscm_documentation_symbol; | |
130 | extern SCM gdbscm_invalid_object_error_symbol; | |
131 | ||
132 | extern SCM gdbscm_map_string; | |
133 | extern SCM gdbscm_array_string; | |
134 | extern SCM gdbscm_string_string; | |
135 | \f | |
136 | /* scm-utils.c */ | |
137 | ||
138 | extern void gdbscm_define_variables (const scheme_variable *, int public); | |
139 | ||
140 | extern void gdbscm_define_functions (const scheme_function *, int public); | |
141 | ||
142 | extern void gdbscm_define_integer_constants (const scheme_integer_constant *, | |
143 | int public); | |
144 | ||
145 | extern void gdbscm_printf (SCM port, const char *format, ...); | |
146 | ||
147 | extern void gdbscm_debug_display (SCM obj); | |
148 | ||
149 | extern void gdbscm_debug_write (SCM obj); | |
150 | ||
151 | extern void gdbscm_parse_function_args (const char *function_name, | |
152 | int beginning_arg_pos, | |
153 | const SCM *keywords, | |
154 | const char *format, ...); | |
155 | ||
156 | extern SCM gdbscm_scm_from_longest (LONGEST l); | |
157 | ||
158 | extern LONGEST gdbscm_scm_to_longest (SCM l); | |
159 | ||
160 | extern SCM gdbscm_scm_from_ulongest (ULONGEST l); | |
161 | ||
162 | extern ULONGEST gdbscm_scm_to_ulongest (SCM u); | |
163 | ||
164 | extern void gdbscm_dynwind_xfree (void *ptr); | |
165 | ||
166 | extern int gdbscm_is_procedure (SCM proc); | |
e698b8c4 DE |
167 | |
168 | extern char *gdbscm_gc_xstrdup (const char *); | |
06eb1586 DE |
169 | |
170 | extern const char * const *gdbscm_gc_dup_argv (char **argv); | |
ed3ef339 | 171 | \f |
b2715b27 | 172 | /* GDB smobs, from scm-gsmob.c */ |
ed3ef339 DE |
173 | |
174 | /* All gdb smobs must contain one of the following as the first member: | |
175 | gdb_smob, chained_gdb_smob, or eqable_gdb_smob. | |
176 | ||
b2715b27 AW |
177 | Chained GDB smobs should have chained_gdb_smob as their first member. The |
178 | next,prev members of chained_gdb_smob allow for chaining gsmobs together so | |
179 | that, for example, when an objfile is deleted we can clean up all smobs that | |
180 | reference it. | |
ed3ef339 | 181 | |
b2715b27 AW |
182 | Eq-able GDB smobs should have eqable_gdb_smob as their first member. The |
183 | containing_scm member of eqable_gdb_smob allows for returning the same gsmob | |
184 | instead of creating a new one, allowing them to be eq?-able. | |
ed3ef339 | 185 | |
b2715b27 AW |
186 | All other smobs should have gdb_smob as their first member. |
187 | FIXME: dje/2014-05-26: gdb_smob was useful during early development as a | |
188 | "baseclass" for all gdb smobs. If it's still unused by gdb 8.0 delete it. | |
189 | ||
190 | IMPORTANT: chained_gdb_smob and eqable_gdb-smob are "subclasses" of | |
ed3ef339 DE |
191 | gdb_smob. The layout of chained_gdb_smob,eqable_gdb_smob must match |
192 | gdb_smob as if it is a subclass. To that end we use macro GDB_SMOB_HEAD | |
193 | to ensure this. */ | |
194 | ||
b2715b27 AW |
195 | #define GDB_SMOB_HEAD \ |
196 | int empty_base_class; | |
ed3ef339 DE |
197 | |
198 | typedef struct | |
199 | { | |
200 | GDB_SMOB_HEAD | |
201 | } gdb_smob; | |
202 | ||
203 | typedef struct _chained_gdb_smob | |
204 | { | |
205 | GDB_SMOB_HEAD | |
206 | ||
207 | struct _chained_gdb_smob *prev; | |
208 | struct _chained_gdb_smob *next; | |
209 | } chained_gdb_smob; | |
210 | ||
211 | typedef struct _eqable_gdb_smob | |
212 | { | |
213 | GDB_SMOB_HEAD | |
214 | ||
215 | /* The object we are contained in. | |
216 | This can be used for several purposes. | |
217 | This is used by the eq? machinery: We need to be able to see if we have | |
218 | already created an object for a symbol, and if so use that SCM. | |
219 | This may also be used to protect the smob from GC if there is | |
220 | a reference to this smob from outside of GC space (i.e., from gdb). | |
221 | This can also be used in place of chained_gdb_smob where we need to | |
222 | keep track of objfile referencing objects. When the objfile is deleted | |
223 | we need to invalidate the objects: we can do that using the same hashtab | |
224 | used to record the smob for eq-ability. */ | |
225 | SCM containing_scm; | |
226 | } eqable_gdb_smob; | |
227 | ||
228 | #undef GDB_SMOB_HEAD | |
229 | ||
230 | struct objfile; | |
231 | struct objfile_data; | |
232 | ||
233 | /* A predicate that returns non-zero if an object is a particular kind | |
234 | of gsmob. */ | |
235 | typedef int (gsmob_pred_func) (SCM); | |
236 | ||
237 | extern scm_t_bits gdbscm_make_smob_type (const char *name, size_t size); | |
238 | ||
239 | extern void gdbscm_init_gsmob (gdb_smob *base); | |
240 | ||
241 | extern void gdbscm_init_chained_gsmob (chained_gdb_smob *base); | |
242 | ||
1254eefc DE |
243 | extern void gdbscm_init_eqable_gsmob (eqable_gdb_smob *base, |
244 | SCM containing_scm); | |
ed3ef339 | 245 | |
ed3ef339 DE |
246 | extern void gdbscm_add_objfile_ref (struct objfile *objfile, |
247 | const struct objfile_data *data_key, | |
248 | chained_gdb_smob *g_smob); | |
249 | ||
250 | extern void gdbscm_remove_objfile_ref (struct objfile *objfile, | |
251 | const struct objfile_data *data_key, | |
252 | chained_gdb_smob *g_smob); | |
253 | ||
254 | extern htab_t gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn, | |
255 | htab_eq eq_fn); | |
256 | ||
257 | extern eqable_gdb_smob **gdbscm_find_eqable_gsmob_ptr_slot | |
258 | (htab_t htab, eqable_gdb_smob *base); | |
259 | ||
260 | extern void gdbscm_fill_eqable_gsmob_ptr_slot (eqable_gdb_smob **slot, | |
1254eefc | 261 | eqable_gdb_smob *base); |
ed3ef339 DE |
262 | |
263 | extern void gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab, | |
264 | eqable_gdb_smob *base); | |
265 | \f | |
266 | /* Exceptions and calling out to Guile. */ | |
267 | ||
268 | /* scm-exception.c */ | |
269 | ||
270 | extern SCM gdbscm_make_exception (SCM tag, SCM args); | |
271 | ||
272 | extern int gdbscm_is_exception (SCM scm); | |
273 | ||
274 | extern SCM gdbscm_exception_key (SCM excp); | |
275 | ||
276 | extern SCM gdbscm_exception_args (SCM excp); | |
277 | ||
278 | extern SCM gdbscm_make_exception_with_stack (SCM key, SCM args, SCM stack); | |
279 | ||
280 | extern SCM gdbscm_make_error_scm (SCM key, SCM subr, SCM message, | |
281 | SCM args, SCM data); | |
282 | ||
283 | extern SCM gdbscm_make_error (SCM key, const char *subr, const char *message, | |
284 | SCM args, SCM data); | |
285 | ||
286 | extern SCM gdbscm_make_type_error (const char *subr, int arg_pos, | |
287 | SCM bad_value, const char *expected_type); | |
288 | ||
289 | extern SCM gdbscm_make_invalid_object_error (const char *subr, int arg_pos, | |
290 | SCM bad_value, const char *error); | |
291 | ||
4a2722c5 DE |
292 | extern void gdbscm_invalid_object_error (const char *subr, int arg_pos, |
293 | SCM bad_value, const char *error) | |
ed3ef339 DE |
294 | ATTRIBUTE_NORETURN; |
295 | ||
296 | extern SCM gdbscm_make_out_of_range_error (const char *subr, int arg_pos, | |
297 | SCM bad_value, const char *error); | |
298 | ||
4a2722c5 DE |
299 | extern void gdbscm_out_of_range_error (const char *subr, int arg_pos, |
300 | SCM bad_value, const char *error) | |
ed3ef339 DE |
301 | ATTRIBUTE_NORETURN; |
302 | ||
303 | extern SCM gdbscm_make_misc_error (const char *subr, int arg_pos, | |
304 | SCM bad_value, const char *error); | |
305 | ||
06eb1586 DE |
306 | extern void gdbscm_misc_error (const char *subr, int arg_pos, |
307 | SCM bad_value, const char *error) | |
308 | ATTRIBUTE_NORETURN; | |
309 | ||
ed3ef339 DE |
310 | extern void gdbscm_throw (SCM exception) ATTRIBUTE_NORETURN; |
311 | ||
312 | extern SCM gdbscm_scm_from_gdb_exception (struct gdb_exception exception); | |
313 | ||
314 | extern void gdbscm_throw_gdb_exception (struct gdb_exception exception) | |
315 | ATTRIBUTE_NORETURN; | |
316 | ||
317 | extern void gdbscm_print_exception_with_stack (SCM port, SCM stack, | |
318 | SCM key, SCM args); | |
319 | ||
320 | extern void gdbscm_print_gdb_exception (SCM port, SCM exception); | |
321 | ||
322 | extern char *gdbscm_exception_message_to_string (SCM exception); | |
323 | ||
324 | extern excp_matcher_func gdbscm_memory_error_p; | |
325 | ||
e698b8c4 DE |
326 | extern excp_matcher_func gdbscm_user_error_p; |
327 | ||
ed3ef339 DE |
328 | extern SCM gdbscm_make_memory_error (const char *subr, const char *msg, |
329 | SCM args); | |
330 | ||
4a2722c5 DE |
331 | extern void gdbscm_memory_error (const char *subr, const char *msg, SCM args) |
332 | ATTRIBUTE_NORETURN; | |
ed3ef339 DE |
333 | |
334 | /* scm-safe-call.c */ | |
335 | ||
336 | extern void *gdbscm_with_guile (void *(*func) (void *), void *data); | |
337 | ||
338 | extern SCM gdbscm_call_guile (SCM (*func) (void *), void *data, | |
339 | excp_matcher_func *ok_excps); | |
340 | ||
341 | extern SCM gdbscm_safe_call_0 (SCM proc, excp_matcher_func *ok_excps); | |
342 | ||
343 | extern SCM gdbscm_safe_call_1 (SCM proc, SCM arg0, | |
344 | excp_matcher_func *ok_excps); | |
345 | ||
346 | extern SCM gdbscm_safe_call_2 (SCM proc, SCM arg0, SCM arg1, | |
347 | excp_matcher_func *ok_excps); | |
348 | ||
349 | extern SCM gdbscm_safe_call_3 (SCM proc, SCM arg0, SCM arg1, SCM arg2, | |
350 | excp_matcher_func *ok_excps); | |
351 | ||
352 | extern SCM gdbscm_safe_call_4 (SCM proc, SCM arg0, SCM arg1, SCM arg2, | |
353 | SCM arg3, | |
354 | excp_matcher_func *ok_excps); | |
355 | ||
356 | extern SCM gdbscm_safe_apply_1 (SCM proc, SCM arg0, SCM args, | |
357 | excp_matcher_func *ok_excps); | |
358 | ||
359 | extern SCM gdbscm_unsafe_call_1 (SCM proc, SCM arg0); | |
360 | ||
361 | extern char *gdbscm_safe_eval_string (const char *string, int display_result); | |
362 | ||
363 | extern char *gdbscm_safe_source_script (const char *filename); | |
364 | ||
365 | extern void gdbscm_enter_repl (void); | |
366 | \f | |
367 | /* Interface to various GDB objects, in alphabetical order. */ | |
368 | ||
369 | /* scm-arch.c */ | |
370 | ||
371 | typedef struct _arch_smob arch_smob; | |
372 | ||
373 | extern struct gdbarch *arscm_get_gdbarch (arch_smob *a_smob); | |
374 | ||
375 | extern arch_smob *arscm_get_arch_smob_arg_unsafe (SCM arch_scm, int arg_pos, | |
376 | const char *func_name); | |
377 | ||
378 | extern SCM arscm_scm_from_arch (struct gdbarch *gdbarch); | |
379 | ||
380 | /* scm-block.c */ | |
381 | ||
382 | extern SCM bkscm_scm_from_block (const struct block *block, | |
383 | struct objfile *objfile); | |
384 | ||
385 | extern const struct block *bkscm_scm_to_block | |
386 | (SCM block_scm, int arg_pos, const char *func_name, SCM *excp); | |
387 | ||
e698b8c4 DE |
388 | /* scm-cmd.c */ |
389 | ||
390 | extern char *gdbscm_parse_command_name (const char *name, | |
391 | const char *func_name, int arg_pos, | |
392 | struct cmd_list_element ***base_list, | |
393 | struct cmd_list_element **start_list); | |
394 | ||
395 | extern int gdbscm_valid_command_class_p (int command_class); | |
396 | ||
06eb1586 DE |
397 | extern char *gdbscm_canonicalize_command_name (const char *name, |
398 | int want_trailing_space); | |
399 | ||
ed3ef339 DE |
400 | /* scm-frame.c */ |
401 | ||
402 | typedef struct _frame_smob frame_smob; | |
403 | ||
404 | extern int frscm_is_frame (SCM scm); | |
405 | ||
406 | extern frame_smob *frscm_get_frame_smob_arg_unsafe (SCM frame_scm, int arg_pos, | |
407 | const char *func_name); | |
408 | ||
409 | extern struct frame_info *frscm_frame_smob_to_frame (frame_smob *); | |
410 | ||
411 | /* scm-iterator.c */ | |
412 | ||
413 | typedef struct _iterator_smob iterator_smob; | |
414 | ||
415 | extern SCM itscm_iterator_smob_object (iterator_smob *i_smob); | |
416 | ||
417 | extern SCM itscm_iterator_smob_progress (iterator_smob *i_smob); | |
418 | ||
419 | extern void itscm_set_iterator_smob_progress_x (iterator_smob *i_smob, | |
420 | SCM progress); | |
421 | ||
422 | extern const char *itscm_iterator_smob_name (void); | |
423 | ||
424 | extern SCM gdbscm_make_iterator (SCM object, SCM progress, SCM next); | |
425 | ||
426 | extern int itscm_is_iterator (SCM scm); | |
427 | ||
428 | extern SCM gdbscm_end_of_iteration (void); | |
429 | ||
430 | extern int itscm_is_end_of_iteration (SCM obj); | |
431 | ||
432 | extern SCM itscm_safe_call_next_x (SCM iter, excp_matcher_func *ok_excps); | |
433 | ||
434 | extern SCM itscm_get_iterator_arg_unsafe (SCM self, int arg_pos, | |
435 | const char *func_name); | |
436 | ||
437 | /* scm-lazy-string.c */ | |
438 | ||
439 | extern int lsscm_is_lazy_string (SCM scm); | |
440 | ||
441 | extern SCM lsscm_make_lazy_string (CORE_ADDR address, int length, | |
442 | const char *encoding, struct type *type); | |
443 | ||
444 | extern struct value *lsscm_safe_lazy_string_to_value (SCM string, | |
445 | int arg_pos, | |
446 | const char *func_name, | |
447 | SCM *except_scmp); | |
448 | ||
449 | extern void lsscm_val_print_lazy_string | |
450 | (SCM string, struct ui_file *stream, | |
451 | const struct value_print_options *options); | |
452 | ||
453 | /* scm-objfile.c */ | |
454 | ||
455 | typedef struct _objfile_smob objfile_smob; | |
456 | ||
457 | extern SCM ofscm_objfile_smob_pretty_printers (objfile_smob *o_smob); | |
458 | ||
459 | extern objfile_smob *ofscm_objfile_smob_from_objfile (struct objfile *objfile); | |
460 | ||
461 | extern SCM ofscm_scm_from_objfile (struct objfile *objfile); | |
462 | ||
ded03782 DE |
463 | /* scm-progspace.c */ |
464 | ||
465 | typedef struct _pspace_smob pspace_smob; | |
466 | ||
467 | extern SCM psscm_pspace_smob_pretty_printers (const pspace_smob *); | |
468 | ||
469 | extern pspace_smob *psscm_pspace_smob_from_pspace (struct program_space *); | |
470 | ||
471 | extern SCM psscm_scm_from_pspace (struct program_space *); | |
472 | ||
ed3ef339 DE |
473 | /* scm-string.c */ |
474 | ||
475 | extern char *gdbscm_scm_to_c_string (SCM string); | |
476 | ||
477 | extern SCM gdbscm_scm_from_c_string (const char *string); | |
478 | ||
479 | extern SCM gdbscm_scm_from_printf (const char *format, ...); | |
480 | ||
481 | extern char *gdbscm_scm_to_string (SCM string, size_t *lenp, | |
482 | const char *charset, | |
483 | int strict, SCM *except_scmp); | |
484 | ||
485 | extern SCM gdbscm_scm_from_string (const char *string, size_t len, | |
486 | const char *charset, int strict); | |
487 | ||
06eb1586 DE |
488 | extern char *gdbscm_scm_to_host_string (SCM string, size_t *lenp, SCM *except); |
489 | ||
490 | extern SCM gdbscm_scm_from_host_string (const char *string, size_t len); | |
491 | ||
ed3ef339 DE |
492 | /* scm-symbol.c */ |
493 | ||
494 | extern int syscm_is_symbol (SCM scm); | |
495 | ||
496 | extern SCM syscm_scm_from_symbol (struct symbol *symbol); | |
497 | ||
498 | extern struct symbol *syscm_get_valid_symbol_arg_unsafe | |
499 | (SCM self, int arg_pos, const char *func_name); | |
500 | ||
501 | /* scm-symtab.c */ | |
502 | ||
503 | extern SCM stscm_scm_from_symtab (struct symtab *symtab); | |
504 | ||
505 | extern SCM stscm_scm_from_sal (struct symtab_and_line sal); | |
506 | ||
507 | /* scm-type.c */ | |
508 | ||
509 | typedef struct _type_smob type_smob; | |
510 | ||
511 | extern int tyscm_is_type (SCM scm); | |
512 | ||
513 | extern SCM tyscm_scm_from_type (struct type *type); | |
514 | ||
515 | extern type_smob *tyscm_get_type_smob_arg_unsafe (SCM type_scm, int arg_pos, | |
516 | const char *func_name); | |
517 | ||
518 | extern struct type *tyscm_type_smob_type (type_smob *t_smob); | |
519 | ||
520 | extern SCM tyscm_scm_from_field (SCM type_scm, int field_num); | |
521 | ||
522 | /* scm-value.c */ | |
523 | ||
524 | extern struct value *vlscm_scm_to_value (SCM scm); | |
525 | ||
526 | extern int vlscm_is_value (SCM scm); | |
527 | ||
528 | extern SCM vlscm_scm_from_value (struct value *value); | |
529 | ||
530 | extern SCM vlscm_scm_from_value_unsafe (struct value *value); | |
531 | ||
532 | extern struct value *vlscm_convert_typed_value_from_scheme | |
533 | (const char *func_name, int obj_arg_pos, SCM obj, | |
534 | int type_arg_pos, SCM type_scm, struct type *type, SCM *except_scmp, | |
535 | struct gdbarch *gdbarch, const struct language_defn *language); | |
536 | ||
537 | extern struct value *vlscm_convert_value_from_scheme | |
538 | (const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp, | |
539 | struct gdbarch *gdbarch, const struct language_defn *language); | |
540 | \f | |
541 | /* stript_lang methods */ | |
542 | ||
543 | extern objfile_script_sourcer_func gdbscm_source_objfile_script; | |
544 | ||
545 | extern int gdbscm_auto_load_enabled (const struct extension_language_defn *); | |
546 | ||
547 | extern void gdbscm_preserve_values | |
548 | (const struct extension_language_defn *, | |
549 | struct objfile *, htab_t copied_types); | |
550 | ||
551 | extern enum ext_lang_rc gdbscm_apply_val_pretty_printer | |
552 | (const struct extension_language_defn *, | |
553 | struct type *type, const gdb_byte *valaddr, | |
554 | int embedded_offset, CORE_ADDR address, | |
555 | struct ui_file *stream, int recurse, | |
556 | const struct value *val, | |
557 | const struct value_print_options *options, | |
558 | const struct language_defn *language); | |
559 | ||
560 | extern int gdbscm_breakpoint_has_cond (const struct extension_language_defn *, | |
561 | struct breakpoint *b); | |
562 | ||
563 | extern enum ext_lang_bp_stop gdbscm_breakpoint_cond_says_stop | |
564 | (const struct extension_language_defn *, struct breakpoint *b); | |
565 | \f | |
566 | /* Initializers for each piece of Scheme support, in alphabetical order. */ | |
567 | ||
568 | extern void gdbscm_initialize_arches (void); | |
569 | extern void gdbscm_initialize_auto_load (void); | |
570 | extern void gdbscm_initialize_blocks (void); | |
571 | extern void gdbscm_initialize_breakpoints (void); | |
e698b8c4 | 572 | extern void gdbscm_initialize_commands (void); |
ed3ef339 DE |
573 | extern void gdbscm_initialize_disasm (void); |
574 | extern void gdbscm_initialize_exceptions (void); | |
575 | extern void gdbscm_initialize_frames (void); | |
576 | extern void gdbscm_initialize_iterators (void); | |
577 | extern void gdbscm_initialize_lazy_strings (void); | |
578 | extern void gdbscm_initialize_math (void); | |
579 | extern void gdbscm_initialize_objfiles (void); | |
580 | extern void gdbscm_initialize_pretty_printers (void); | |
06eb1586 | 581 | extern void gdbscm_initialize_parameters (void); |
ed3ef339 | 582 | extern void gdbscm_initialize_ports (void); |
ded03782 | 583 | extern void gdbscm_initialize_pspaces (void); |
ed3ef339 DE |
584 | extern void gdbscm_initialize_smobs (void); |
585 | extern void gdbscm_initialize_strings (void); | |
586 | extern void gdbscm_initialize_symbols (void); | |
587 | extern void gdbscm_initialize_symtabs (void); | |
588 | extern void gdbscm_initialize_types (void); | |
589 | extern void gdbscm_initialize_values (void); | |
590 | \f | |
591 | /* Use these after a TRY_CATCH to throw the appropriate Scheme exception | |
592 | if a GDB error occurred. */ | |
593 | ||
594 | #define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \ | |
595 | do { \ | |
596 | if (exception.reason < 0) \ | |
597 | { \ | |
598 | gdbscm_throw_gdb_exception (exception); \ | |
599 | /*NOTREACHED */ \ | |
600 | } \ | |
601 | } while (0) | |
602 | ||
603 | /* If cleanups are establish outside the TRY_CATCH block, use this version. */ | |
604 | ||
605 | #define GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS(exception, cleanups) \ | |
606 | do { \ | |
607 | if (exception.reason < 0) \ | |
608 | { \ | |
609 | do_cleanups (cleanups); \ | |
610 | gdbscm_throw_gdb_exception (exception); \ | |
611 | /*NOTREACHED */ \ | |
612 | } \ | |
613 | } while (0) | |
614 | ||
615 | #endif /* GDB_GUILE_INTERNAL_H */ |