GDB (xrefs)
Loading...
Searching...
No Matches
guile-internal.h
Go to the documentation of this file.
1/* Internal header for GDB/Scheme code.
2
3 Copyright (C) 2014-2023 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#ifndef GUILE_GUILE_INTERNAL_H
21#define GUILE_GUILE_INTERNAL_H
22
23/* See README file in this directory for implementation notes, coding
24 conventions, et.al. */
25
26
27#include "hashtab.h"
28#include "extension-priv.h"
29#include "symtab.h"
30#include "libguile.h"
31#include "objfiles.h"
32#include "top.h"
33
34struct block;
35struct frame_info;
36struct objfile;
37struct symbol;
38
39/* A function to pass to the safe-call routines to ignore things like
40 memory errors. */
41typedef int excp_matcher_func (SCM key);
42
43/* Scheme variables to define during initialization. */
44
46{
47 const char *name;
48 SCM value;
49 const char *doc_string;
50};
51
52/* End of scheme_variable table mark. */
53
54#define END_VARIABLES { NULL, SCM_BOOL_F, NULL }
55
56/* Although scm_t_subr is meant to hold a function pointer, at least
57 in some versions of guile, it is actually a typedef to "void *".
58 That means that in C++, an explicit cast is necessary to convert
59 function pointer to scm_t_subr. But a cast also makes it possible
60 to pass function pointers with the wrong type by mistake. So
61 instead of adding such casts throughout, we use 'as_a_scm_t_subr'
62 to do the conversion, which (only) has overloads for function
63 pointer types that are valid.
64
65 See https://lists.gnu.org/archive/html/guile-devel/2013-03/msg00001.html.
66*/
67
68static inline scm_t_subr
69as_a_scm_t_subr (SCM (*func) (void))
70{
71 return (scm_t_subr) func;
72}
73
74static inline scm_t_subr
75as_a_scm_t_subr (SCM (*func) (SCM))
76{
77 return (scm_t_subr) func;
78}
79
80static inline scm_t_subr
81as_a_scm_t_subr (SCM (*func) (SCM, SCM))
82{
83 return (scm_t_subr) func;
84}
85
86static inline scm_t_subr
87as_a_scm_t_subr (SCM (*func) (SCM, SCM, SCM))
88{
89 return (scm_t_subr) func;
90}
91
92/* Scheme functions to define during initialization. */
93
95{
96 const char *name;
99 int rest;
100 scm_t_subr func;
101 const char *doc_string;
102};
103
104/* End of scheme_function table mark. */
105
106#define END_FUNCTIONS { NULL, 0, 0, 0, NULL, NULL }
107
108/* Useful for defining a set of constants. */
109
111{
112 const char *name;
113 int value;
114};
115
116#define END_INTEGER_CONSTANTS { NULL, 0 }
117
118/* Pass this instead of 0 to routines like SCM_ASSERT to indicate the value
119 is not a function argument. */
120#define GDBSCM_ARG_NONE 0
121
122/* Ensure new code doesn't accidentally try to use this. */
123#undef scm_make_smob_type
124#define scm_make_smob_type USE_gdbscm_make_smob_type_INSTEAD
125
126/* They brought over () == #f from lisp.
127 Let's avoid that for now. */
128#undef scm_is_bool
129#undef scm_is_false
130#undef scm_is_true
131#define scm_is_bool USE_gdbscm_is_bool_INSTEAD
132#define scm_is_false USE_gdbscm_is_false_INSTEAD
133#define scm_is_true USE_gdbscm_is_true_INSTEAD
134#define gdbscm_is_bool(scm) \
135 (scm_is_eq ((scm), SCM_BOOL_F) || scm_is_eq ((scm), SCM_BOOL_T))
136#define gdbscm_is_false(scm) scm_is_eq ((scm), SCM_BOOL_F)
137#define gdbscm_is_true(scm) (!gdbscm_is_false (scm))
138
139#ifndef HAVE_SCM_NEW_SMOB
140
141/* Guile <= 2.0.5 did not provide this function, so provide it here. */
142
143static inline SCM
144scm_new_smob (scm_t_bits tc, scm_t_bits data)
145{
146 SCM_RETURN_NEWSMOB (tc, data);
147}
148
149#endif
150
151/* Function name that is passed around in case an error needs to be reported.
152 __func is in C99, but we provide a wrapper "just in case",
153 and because FUNC_NAME is the canonical value used in guile sources.
154 IWBN to use the Scheme version of the name (e.g. foo-bar vs foo_bar),
155 but let's KISS for now. */
156#define FUNC_NAME __func__
157
158extern const char gdbscm_module_name[];
159extern const char gdbscm_init_module_name[];
160
161extern int gdb_scheme_initialized;
162
166
167extern const char gdbscm_print_excp_none[];
168extern const char gdbscm_print_excp_full[];
169extern const char gdbscm_print_excp_message[];
170extern const char *gdbscm_print_excp;
171
174
175extern SCM gdbscm_map_string;
176extern SCM gdbscm_array_string;
177extern SCM gdbscm_string_string;
178
179/* scm-utils.c */
180
181extern void gdbscm_define_variables (const scheme_variable *, int is_public);
182
183extern void gdbscm_define_functions (const scheme_function *, int is_public);
184
186 int is_public);
187
188extern void gdbscm_printf (SCM port, const char *format, ...)
189 ATTRIBUTE_PRINTF (2, 3);
190
191extern void gdbscm_debug_display (SCM obj);
192
193extern void gdbscm_debug_write (SCM obj);
194
195extern void gdbscm_parse_function_args (const char *function_name,
196 int beginning_arg_pos,
197 const SCM *keywords,
198 const char *format, ...);
199
200extern SCM gdbscm_scm_from_longest (LONGEST l);
201
202extern LONGEST gdbscm_scm_to_longest (SCM l);
203
204extern SCM gdbscm_scm_from_ulongest (ULONGEST l);
205
206extern ULONGEST gdbscm_scm_to_ulongest (SCM u);
207
208extern void gdbscm_dynwind_xfree (void *ptr);
209
210extern int gdbscm_is_procedure (SCM proc);
211
212extern char *gdbscm_gc_xstrdup (const char *);
213
214extern const char * const *gdbscm_gc_dup_argv (char **argv);
215
216extern int gdbscm_guile_version_is_at_least (int major, int minor, int micro);
217
218/* GDB smobs, from scm-gsmob.c */
219
220/* All gdb smobs must contain one of the following as the first member:
221 gdb_smob, chained_gdb_smob, or eqable_gdb_smob.
222
223 Chained GDB smobs should have chained_gdb_smob as their first member. The
224 next,prev members of chained_gdb_smob allow for chaining gsmobs together so
225 that, for example, when an objfile is deleted we can clean up all smobs that
226 reference it.
227
228 Eq-able GDB smobs should have eqable_gdb_smob as their first member. The
229 containing_scm member of eqable_gdb_smob allows for returning the same gsmob
230 instead of creating a new one, allowing them to be eq?-able.
231
232 All other smobs should have gdb_smob as their first member.
233 FIXME: dje/2014-05-26: gdb_smob was useful during early development as a
234 "baseclass" for all gdb smobs. If it's still unused by gdb 8.0 delete it.
235
236 IMPORTANT: chained_gdb_smob and eqable_gdb-smob are "subclasses" of
237 gdb_smob. The layout of chained_gdb_smob,eqable_gdb_smob must match
238 gdb_smob as if it is a subclass. To that end we use macro GDB_SMOB_HEAD
239 to ensure this. */
240
241#define GDB_SMOB_HEAD \
242 int empty_base_class;
243
245{
247};
248
256
258{
260
261 /* The object we are contained in.
262 This can be used for several purposes.
263 This is used by the eq? machinery: We need to be able to see if we have
264 already created an object for a symbol, and if so use that SCM.
265 This may also be used to protect the smob from GC if there is
266 a reference to this smob from outside of GC space (i.e., from gdb).
267 This can also be used in place of chained_gdb_smob where we need to
268 keep track of objfile referencing objects. When the objfile is deleted
269 we need to invalidate the objects: we can do that using the same hashtab
270 used to record the smob for eq-ability. */
272};
273
274#undef GDB_SMOB_HEAD
275
276struct objfile;
277
278/* A predicate that returns non-zero if an object is a particular kind
279 of gsmob. */
280typedef int (gsmob_pred_func) (SCM);
281
282extern scm_t_bits gdbscm_make_smob_type (const char *name, size_t size);
283
284extern void gdbscm_init_gsmob (gdb_smob *base);
285
287
289 SCM containing_scm);
290
291extern htab_t gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn,
292 htab_eq eq_fn);
293
295 (htab_t htab, eqable_gdb_smob *base);
296
298 eqable_gdb_smob *base);
299
300extern void gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab,
301 eqable_gdb_smob *base);
302
303/* Exceptions and calling out to Guile. */
304
305/* scm-exception.c */
306
307extern SCM gdbscm_make_exception (SCM tag, SCM args);
308
309extern int gdbscm_is_exception (SCM scm);
310
311extern SCM gdbscm_exception_key (SCM excp);
312
313extern SCM gdbscm_exception_args (SCM excp);
314
315extern SCM gdbscm_make_exception_with_stack (SCM key, SCM args, SCM stack);
316
317extern SCM gdbscm_make_error_scm (SCM key, SCM subr, SCM message,
318 SCM args, SCM data);
319
320extern SCM gdbscm_make_error (SCM key, const char *subr, const char *message,
321 SCM args, SCM data);
322
323extern SCM gdbscm_make_type_error (const char *subr, int arg_pos,
324 SCM bad_value, const char *expected_type);
325
326extern SCM gdbscm_make_invalid_object_error (const char *subr, int arg_pos,
327 SCM bad_value, const char *error);
328
329extern void gdbscm_invalid_object_error (const char *subr, int arg_pos,
330 SCM bad_value, const char *error)
331 ATTRIBUTE_NORETURN;
332
333extern SCM gdbscm_make_out_of_range_error (const char *subr, int arg_pos,
334 SCM bad_value, const char *error);
335
336extern void gdbscm_out_of_range_error (const char *subr, int arg_pos,
337 SCM bad_value, const char *error)
338 ATTRIBUTE_NORETURN;
339
340extern SCM gdbscm_make_misc_error (const char *subr, int arg_pos,
341 SCM bad_value, const char *error);
342
343extern void gdbscm_misc_error (const char *subr, int arg_pos,
344 SCM bad_value, const char *error)
345 ATTRIBUTE_NORETURN;
346
347extern void gdbscm_throw (SCM exception) ATTRIBUTE_NORETURN;
348
351 (const gdbscm_gdb_exception &exception);
352
354 ATTRIBUTE_NORETURN;
355
356extern void gdbscm_print_exception_with_stack (SCM port, SCM stack,
357 SCM key, SCM args);
358
359extern void gdbscm_print_gdb_exception (SCM port, SCM exception);
360
361extern gdb::unique_xmalloc_ptr<char> gdbscm_exception_message_to_string
362 (SCM exception);
363
365
367
368extern SCM gdbscm_make_memory_error (const char *subr, const char *msg,
369 SCM args);
370
371extern void gdbscm_memory_error (const char *subr, const char *msg, SCM args)
372 ATTRIBUTE_NORETURN;
373
374/* scm-safe-call.c */
375
376extern const char *gdbscm_with_guile (const char *(*func) (void *), void *data);
377
378extern SCM gdbscm_call_guile (SCM (*func) (void *), void *data,
379 excp_matcher_func *ok_excps);
380
381extern SCM gdbscm_safe_call_0 (SCM proc, excp_matcher_func *ok_excps);
382
383extern SCM gdbscm_safe_call_1 (SCM proc, SCM arg0,
384 excp_matcher_func *ok_excps);
385
386extern SCM gdbscm_safe_call_2 (SCM proc, SCM arg0, SCM arg1,
387 excp_matcher_func *ok_excps);
388
389extern SCM gdbscm_safe_call_3 (SCM proc, SCM arg0, SCM arg1, SCM arg2,
390 excp_matcher_func *ok_excps);
391
392extern SCM gdbscm_safe_call_4 (SCM proc, SCM arg0, SCM arg1, SCM arg2,
393 SCM arg3,
394 excp_matcher_func *ok_excps);
395
396extern SCM gdbscm_safe_apply_1 (SCM proc, SCM arg0, SCM args,
397 excp_matcher_func *ok_excps);
398
399extern SCM gdbscm_unsafe_call_1 (SCM proc, SCM arg0);
400
401extern gdb::unique_xmalloc_ptr<char> gdbscm_safe_eval_string
402 (const char *string, int display_result);
403
404extern gdb::unique_xmalloc_ptr<char> gdbscm_safe_source_script
405 (const char *filename);
406
407extern void gdbscm_enter_repl (void);
408
409/* Interface to various GDB objects, in alphabetical order. */
410
411/* scm-arch.c */
412
413struct arch_smob;
414
415extern struct gdbarch *arscm_get_gdbarch (arch_smob *a_smob);
416
417extern arch_smob *arscm_get_arch_smob_arg_unsafe (SCM arch_scm, int arg_pos,
418 const char *func_name);
419
420extern SCM arscm_scm_from_arch (struct gdbarch *gdbarch);
421
422/* scm-block.c */
423
424extern SCM bkscm_scm_from_block (const struct block *block,
425 struct objfile *objfile);
426
427extern const struct block *bkscm_scm_to_block
428 (SCM block_scm, int arg_pos, const char *func_name, SCM *excp);
429
430/* scm-cmd.c */
431
432extern char *gdbscm_parse_command_name (const char *name,
433 const char *func_name, int arg_pos,
434 struct cmd_list_element ***base_list,
435 struct cmd_list_element **start_list);
436
438
439extern char *gdbscm_canonicalize_command_name (const char *name,
440 int want_trailing_space);
441
442/* scm-frame.c */
443
444struct frame_smob;
445
446extern int frscm_is_frame (SCM scm);
447
448extern frame_smob *frscm_get_frame_smob_arg_unsafe (SCM frame_scm, int arg_pos,
449 const char *func_name);
450
452
453/* scm-iterator.c */
454
455struct iterator_smob;
456
457extern SCM itscm_iterator_smob_object (iterator_smob *i_smob);
458
460
462 SCM progress);
463
464extern const char *itscm_iterator_smob_name (void);
465
466extern SCM gdbscm_make_iterator (SCM object, SCM progress, SCM next);
467
468extern int itscm_is_iterator (SCM scm);
469
470extern SCM gdbscm_end_of_iteration (void);
471
472extern int itscm_is_end_of_iteration (SCM obj);
473
474extern SCM itscm_safe_call_next_x (SCM iter, excp_matcher_func *ok_excps);
475
476extern SCM itscm_get_iterator_arg_unsafe (SCM self, int arg_pos,
477 const char *func_name);
478
479/* scm-lazy-string.c */
480
481extern int lsscm_is_lazy_string (SCM scm);
482
483extern SCM lsscm_make_lazy_string (CORE_ADDR address, int length,
484 const char *encoding, struct type *type);
485
486extern struct value *lsscm_safe_lazy_string_to_value (SCM string,
487 int arg_pos,
488 const char *func_name,
489 SCM *except_scmp);
490
492 (SCM string, struct ui_file *stream,
493 const struct value_print_options *options);
494
495/* scm-objfile.c */
496
497struct objfile_smob;
498
500
502
503extern SCM ofscm_scm_from_objfile (struct objfile *objfile);
504
505/* scm-progspace.c */
506
507struct pspace_smob;
508
510
512
513extern SCM psscm_scm_from_pspace (struct program_space *);
514
515/* scm-string.c */
516
517extern int gdbscm_scm_string_to_int (SCM string);
518
519extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_c_string (SCM string);
520
521extern SCM gdbscm_scm_from_c_string (const char *string);
522
523extern SCM gdbscm_scm_from_printf (const char *format, ...)
524 ATTRIBUTE_PRINTF (1, 2);
525
526extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_string
527 (SCM string, size_t *lenp, const char *charset, int strict, SCM *except_scmp);
528
529extern SCM gdbscm_scm_from_string (const char *string, size_t len,
530 const char *charset, int strict);
531
532extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_host_string
533 (SCM string, size_t *lenp, SCM *except);
534
535extern SCM gdbscm_scm_from_host_string (const char *string, size_t len);
536
537/* scm-symbol.c */
538
539extern int syscm_is_symbol (SCM scm);
540
541extern SCM syscm_scm_from_symbol (struct symbol *symbol);
542
544 (SCM self, int arg_pos, const char *func_name);
545
546/* scm-symtab.c */
547
548extern SCM stscm_scm_from_symtab (struct symtab *symtab);
549
550extern SCM stscm_scm_from_sal (struct symtab_and_line sal);
551
552/* scm-type.c */
553
554struct type_smob;
555
556extern int tyscm_is_type (SCM scm);
557
558extern SCM tyscm_scm_from_type (struct type *type);
559
560extern type_smob *tyscm_get_type_smob_arg_unsafe (SCM type_scm, int arg_pos,
561 const char *func_name);
562
563extern struct type *tyscm_scm_to_type (SCM t_scm);
564
565extern struct type *tyscm_type_smob_type (type_smob *t_smob);
566
567extern SCM tyscm_scm_from_field (SCM type_scm, int field_num);
568
569/* scm-value.c */
570
571extern struct value *vlscm_scm_to_value (SCM scm);
572
573extern int vlscm_is_value (SCM scm);
574
575extern SCM vlscm_scm_from_value (struct value *value);
576extern SCM vlscm_scm_from_value_no_release (struct value *value);
577
579 (const char *func_name, int obj_arg_pos, SCM obj,
580 int type_arg_pos, SCM type_scm, struct type *type, SCM *except_scmp,
581 struct gdbarch *gdbarch, const struct language_defn *language);
582
584 (const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp,
585 struct gdbarch *gdbarch, const struct language_defn *language);
586
587/* stript_lang methods */
588
591
592/* Return true if auto-loading Guile scripts is enabled.
593 This is the extension_language_script_ops.auto_load_enabled "method". */
594
595extern bool gdbscm_auto_load_enabled (const struct extension_language_defn *);
596
597extern void gdbscm_preserve_values
598 (const struct extension_language_defn *,
599 struct objfile *, htab_t copied_types);
600
602 (const struct extension_language_defn *,
603 struct value *val,
604 struct ui_file *stream, int recurse,
605 const struct value_print_options *options,
606 const struct language_defn *language);
607
608extern int gdbscm_breakpoint_has_cond (const struct extension_language_defn *,
609 struct breakpoint *b);
610
612 (const struct extension_language_defn *, struct breakpoint *b);
613
614/* Initializers for each piece of Scheme support, in alphabetical order. */
615
616extern void gdbscm_initialize_arches (void);
617extern void gdbscm_initialize_auto_load (void);
618extern void gdbscm_initialize_blocks (void);
619extern void gdbscm_initialize_breakpoints (void);
620extern void gdbscm_initialize_commands (void);
621extern void gdbscm_initialize_disasm (void);
622extern void gdbscm_initialize_exceptions (void);
623extern void gdbscm_initialize_frames (void);
624extern void gdbscm_initialize_iterators (void);
625extern void gdbscm_initialize_lazy_strings (void);
626extern void gdbscm_initialize_math (void);
627extern void gdbscm_initialize_objfiles (void);
628extern void gdbscm_initialize_pretty_printers (void);
629extern void gdbscm_initialize_parameters (void);
630extern void gdbscm_initialize_ports (void);
631extern void gdbscm_initialize_pspaces (void);
632extern void gdbscm_initialize_smobs (void);
633extern void gdbscm_initialize_strings (void);
634extern void gdbscm_initialize_symbols (void);
635extern void gdbscm_initialize_symtabs (void);
636extern void gdbscm_initialize_types (void);
637extern void gdbscm_initialize_values (void);
638
639
640/* A complication with the Guile code is that we have two types of
641 exceptions to consider. GDB/C++ exceptions, and Guile/SJLJ
642 exceptions. Code that is facing the Guile interpreter must not
643 throw GDB exceptions, instead Scheme exceptions must be thrown.
644 Also, because Guile exceptions are SJLJ based, Guile-facing code
645 must not use local objects with dtors, unless wrapped in a scope
646 with a TRY/CATCH, because the dtors won't otherwise be run when a
647 Guile exceptions is thrown. */
648
649/* This is a destructor-less clone of gdb_exception. */
650
652{
653 enum return_reason reason;
654 enum errors error;
655 /* The message is xmalloc'd. */
656 char *message;
657};
658
659/* Return a gdbscm_gdb_exception representing EXC. */
660
662unpack (const gdb_exception &exc)
663{
665 result.reason = exc.reason;
666 result.error = exc.error;
667 if (exc.message == nullptr)
668 result.message = nullptr;
669 else
670 result.message = xstrdup (exc.message->c_str ());
671 /* The message should be NULL iff the reason is zero. */
672 gdb_assert ((result.reason == 0) == (result.message == nullptr));
673 return result;
674}
675
676/* Use this after a TRY/CATCH to throw the appropriate Scheme
677 exception if a GDB error occurred. */
678
679#define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \
680 do { \
681 if (exception.reason < 0) \
682 { \
683 gdbscm_throw_gdb_exception (exception); \
684 /*NOTREACHED */ \
685 } \
686 } while (0)
687
688/* Use this to wrap a callable to throw the appropriate Scheme
689 exception if the callable throws a GDB error. ARGS are forwarded
690 to FUNC. Returns the result of FUNC, unless FUNC returns a Scheme
691 exception, in which case that exception is thrown. Note that while
692 the callable is free to use objects of types with destructors,
693 because GDB errors are C++ exceptions, the caller of gdbscm_wrap
694 must not use such objects, because their destructors would not be
695 called when a Scheme exception is thrown. */
696
697template<typename Function, typename... Args>
698SCM
699gdbscm_wrap (Function &&func, Args &&... args)
700{
701 SCM result = SCM_BOOL_F;
703
704 try
705 {
706 result = func (std::forward<Args> (args)...);
707 }
708 catch (const gdb_exception_forced_quit &e)
709 {
710 quit_force (NULL, 0);
711 }
712 catch (const gdb_exception &except)
713 {
714 exc = unpack (except);
715 }
716
718
719 if (gdbscm_is_exception (result))
720 gdbscm_throw (result);
721
722 return result;
723}
724
725#endif /* GUILE_GUILE_INTERNAL_H */
const char *const name
command_class
Definition command.h:43
language
Definition defs.h:211
ext_lang_rc
Definition extension.h:165
void objfile_script_sourcer_func(const struct extension_language_defn *, struct objfile *, FILE *stream, const char *filename)
Definition extension.h:49
ext_lang_bp_stop
Definition extension.h:138
void objfile_script_executor_func(const struct extension_language_defn *, struct objfile *, const char *name, const char *script)
Definition extension.h:55
static void ATTRIBUTE_PRINTF(1, 0)
Definition gdb_bfd.c:1154
size_t size
Definition go32-nat.c:239
SCM gdbscm_make_out_of_range_error(const char *subr, int arg_pos, SCM bad_value, const char *error)
const char gdbscm_print_excp_none[]
Definition guile.c:57
int gdbscm_scm_string_to_int(SCM string)
Definition scm-string.c:32
void gdbscm_debug_write(SCM obj)
Definition scm-utils.c:104
void gdbscm_initialize_symtabs(void)
Definition scm-symtab.c:677
SCM gdbscm_make_invalid_object_error(const char *subr, int arg_pos, SCM bad_value, const char *error)
void itscm_set_iterator_smob_progress_x(iterator_smob *i_smob, SCM progress)
void gdbscm_init_eqable_gsmob(eqable_gdb_smob *base, SCM containing_scm)
Definition scm-gsmob.c:162
void gdbscm_initialize_types(void)
Definition scm-type.c:1465
SCM tyscm_scm_from_field(SCM type_scm, int field_num)
Definition scm-type.c:464
SCM gdbscm_make_type_error(const char *subr, int arg_pos, SCM bad_value, const char *expected_type)
SCM itscm_iterator_smob_object(iterator_smob *i_smob)
struct value * vlscm_convert_value_from_scheme(const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp, struct gdbarch *gdbarch, const struct language_defn *language)
Definition scm-math.c:853
struct type * tyscm_type_smob_type(type_smob *t_smob)
Definition scm-type.c:116
SCM gdbscm_scm_from_printf(const char *format,...) ATTRIBUTE_PRINTF(1
void gdbscm_print_exception_with_stack(SCM port, SCM stack, SCM key, SCM args)
#define GDB_SMOB_HEAD
SCM gdbscm_wrap(Function &&func, Args &&... args)
void gdbscm_initialize_parameters(void)
Definition scm-param.c:1278
struct value * vlscm_convert_typed_value_from_scheme(const char *func_name, int obj_arg_pos, SCM obj, int type_arg_pos, SCM type_scm, struct type *type, SCM *except_scmp, struct gdbarch *gdbarch, const struct language_defn *language)
Definition scm-math.c:716
SCM vlscm_scm_from_value_no_release(struct value *value)
Definition scm-value.c:269
void gdbscm_initialize_strings(void)
Definition scm-string.c:273
int syscm_is_symbol(SCM scm)
Definition scm-symbol.c:213
void gdbscm_initialize_commands(void)
Definition scm-cmd.c:852
SCM itscm_iterator_smob_progress(iterator_smob *i_smob)
void gdbscm_initialize_pspaces(void)
const char * gdbscm_print_excp
Definition guile.c:74
void lsscm_val_print_lazy_string(SCM string, struct ui_file *stream, const struct value_print_options *options)
int gdbscm_breakpoint_has_cond(const struct extension_language_defn *, struct breakpoint *b)
void gdbscm_parse_function_args(const char *function_name, int beginning_arg_pos, const SCM *keywords, const char *format,...)
Definition scm-utils.c:528
objfile_smob * ofscm_objfile_smob_from_objfile(struct objfile *objfile)
int gdbscm_guile_minor_version
Definition guile.c:48
enum ext_lang_rc gdbscm_apply_val_pretty_printer(const struct extension_language_defn *, struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
struct value * vlscm_scm_to_value(SCM scm)
Definition scm-value.c:311
void gdbscm_initialize_iterators(void)
SCM gdbscm_documentation_symbol
void gdbscm_memory_error(const char *subr, const char *msg, SCM args) ATTRIBUTE_NORETURN
int vlscm_is_value(SCM scm)
Definition scm-value.c:234
int tyscm_is_type(SCM scm)
Definition scm-type.c:296
gdbscm_gdb_exception unpack(const gdb_exception &exc)
void gdbscm_misc_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
void gdbscm_preserve_values(const struct extension_language_defn *, struct objfile *, htab_t copied_types)
Definition scm-value.c:89
htab_t gdbscm_create_eqable_gsmob_ptr_map(htab_hash hash_fn, htab_eq eq_fn)
Definition scm-gsmob.c:213
SCM gdbscm_make_misc_error(const char *subr, int arg_pos, SCM bad_value, const char *error)
int gdbscm_is_procedure(SCM proc)
Definition scm-utils.c:592
SCM lsscm_make_lazy_string(CORE_ADDR address, int length, const char *encoding, struct type *type)
void gdbscm_init_gsmob(gdb_smob *base)
Definition scm-gsmob.c:140
void gdbscm_print_gdb_exception(SCM port, SCM exception)
SCM vlscm_scm_from_value(struct value *value)
Definition scm-value.c:252
SCM stscm_scm_from_sal(struct symtab_and_line sal)
Definition scm-symtab.c:444
SCM gdbscm_scm_from_gdb_exception(const gdbscm_gdb_exception &exception)
void gdbscm_invalid_object_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
SCM psscm_scm_from_pspace(struct program_space *)
void gdbscm_dynwind_xfree(void *ptr)
Definition scm-utils.c:584
void gdbscm_initialize_symbols(void)
Definition scm-symbol.c:801
char * gdbscm_parse_command_name(const char *name, const char *func_name, int arg_pos, struct cmd_list_element ***base_list, struct cmd_list_element **start_list)
Definition scm-cmd.c:470
SCM gdbscm_safe_apply_1(SCM proc, SCM arg0, SCM args, excp_matcher_func *ok_excps)
enum ext_lang_bp_stop gdbscm_breakpoint_cond_says_stop(const struct extension_language_defn *, struct breakpoint *b)
void void gdbscm_debug_display(SCM obj)
Definition scm-utils.c:92
SCM gdbscm_safe_call_4(SCM proc, SCM arg0, SCM arg1, SCM arg2, SCM arg3, excp_matcher_func *ok_excps)
objfile_script_sourcer_func gdbscm_source_objfile_script
char * gdbscm_gc_xstrdup(const char *)
Definition scm-utils.c:600
SCM ofscm_scm_from_objfile(struct objfile *objfile)
SCM gdbscm_scm_from_longest(LONGEST l)
Definition scm-utils.c:546
void gdbscm_initialize_exceptions(void)
SCM ofscm_objfile_smob_pretty_printers(objfile_smob *o_smob)
Definition scm-objfile.c:68
gdb::unique_xmalloc_ptr< char > gdbscm_exception_message_to_string(SCM exception)
SCM gdbscm_make_iterator(SCM object, SCM progress, SCM next)
frame_smob * frscm_get_frame_smob_arg_unsafe(SCM frame_scm, int arg_pos, const char *func_name)
Definition scm-frame.c:342
const char gdbscm_module_name[]
void gdbscm_initialize_disasm(void)
Definition scm-disasm.c:306
SCM gdbscm_make_memory_error(const char *subr, const char *msg, SCM args)
SCM gdbscm_exception_key(SCM excp)
SCM tyscm_scm_from_type(struct type *type)
Definition scm-type.c:313
void gdbscm_out_of_range_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
int lsscm_is_lazy_string(SCM scm)
void gdbscm_initialize_values(void)
Definition scm-value.c:1530
void gdbscm_init_chained_gsmob(chained_gdb_smob *base)
Definition scm-gsmob.c:150
type_smob * tyscm_get_type_smob_arg_unsafe(SCM type_scm, int arg_pos, const char *func_name)
Definition scm-type.c:352
SCM gdbscm_safe_call_2(SCM proc, SCM arg0, SCM arg1, excp_matcher_func *ok_excps)
SCM gdbscm_safe_call_1(SCM proc, SCM arg0, excp_matcher_func *ok_excps)
void gdbscm_define_variables(const scheme_variable *, int is_public)
Definition scm-utils.c:29
SCM bkscm_scm_from_block(const struct block *block, struct objfile *objfile)
Definition scm-block.c:238
void gdbscm_initialize_math(void)
Definition scm-math.c:968
const char gdbscm_print_excp_message[]
Definition guile.c:59
SCM gdbscm_call_guile(SCM(*func)(void *), void *data, excp_matcher_func *ok_excps)
excp_matcher_func gdbscm_memory_error_p
void gdbscm_clear_eqable_gsmob_ptr_slot(htab_t htab, eqable_gdb_smob *base)
Definition scm-gsmob.c:251
SCM arscm_scm_from_arch(struct gdbarch *gdbarch)
Definition scm-arch.c:115
void gdbscm_throw_gdb_exception(gdbscm_gdb_exception exception) ATTRIBUTE_NORETURN
SCM gdbscm_string_string
SCM itscm_safe_call_next_x(SCM iter, excp_matcher_func *ok_excps)
ULONGEST gdbscm_scm_to_ulongest(SCM u)
Definition scm-utils.c:576
int excp_matcher_func(SCM key)
char * gdbscm_canonicalize_command_name(const char *name, int want_trailing_space)
Definition scm-cmd.c:583
LONGEST gdbscm_scm_to_longest(SCM l)
Definition scm-utils.c:557
SCM gdbscm_scm_from_ulongest(ULONGEST l)
Definition scm-utils.c:565
SCM gdbscm_invalid_object_error_symbol
void gdbscm_printf(SCM port, const char *format,...) ATTRIBUTE_PRINTF(2
const char * gdbscm_with_guile(const char *(*func)(void *), void *data)
SCM gdbscm_safe_call_0(SCM proc, excp_matcher_func *ok_excps)
void gdbscm_initialize_arches(void)
Definition scm-arch.c:648
SCM gdbscm_scm_from_string(const char *string, size_t len, const char *charset, int strict)
Definition scm-string.c:177
int gdbscm_guile_major_version
Definition guile.c:47
gdb::unique_xmalloc_ptr< char > gdbscm_safe_source_script(const char *filename)
SCM gdb::unique_xmalloc_ptr< char > gdbscm_scm_to_string(SCM string, size_t *lenp, const char *charset, int strict, SCM *except_scmp)
Definition scm-string.c:117
int gdbscm_guile_version_is_at_least(int major, int minor, int micro)
Definition scm-utils.c:644
gdb::unique_xmalloc_ptr< char > gdbscm_scm_to_c_string(SCM string)
Definition scm-string.c:55
SCM gdbscm_make_error_scm(SCM key, SCM subr, SCM message, SCM args, SCM data)
struct symbol * syscm_get_valid_symbol_arg_unsafe(SCM self, int arg_pos, const char *func_name)
Definition scm-symbol.c:308
SCM gdbscm_unsafe_call_1(SCM proc, SCM arg0)
struct type * tyscm_scm_to_type(SCM t_scm)
Definition scm-type.c:364
void gdbscm_define_integer_constants(const scheme_integer_constant *, int is_public)
Definition scm-utils.c:63
void gdbscm_initialize_lazy_strings(void)
void gdbscm_initialize_smobs(void)
Definition scm-gsmob.c:274
void gdbscm_initialize_blocks(void)
Definition scm-block.c:773
const struct block * bkscm_scm_to_block(SCM block_scm, int arg_pos, const char *func_name, SCM *excp)
Definition scm-block.c:345
int itscm_is_iterator(SCM scm)
void gdbscm_initialize_frames(void)
Definition scm-frame.c:1193
void gdbscm_initialize_auto_load(void)
gdb::unique_xmalloc_ptr< char > gdbscm_safe_eval_string(const char *string, int display_result)
SCM gdbscm_make_exception_with_stack(SCM key, SCM args, SCM stack)
const char * itscm_iterator_smob_name(void)
const char gdbscm_init_module_name[]
SCM gdbscm_exception_args(SCM excp)
void gdbscm_initialize_pretty_printers(void)
static SCM scm_new_smob(scm_t_bits tc, scm_t_bits data)
void gdbscm_initialize_breakpoints(void)
int gdbscm_is_exception(SCM scm)
void gdbscm_define_functions(const scheme_function *, int is_public)
Definition scm-utils.c:44
void gdbscm_initialize_objfiles(void)
eqable_gdb_smob ** gdbscm_find_eqable_gsmob_ptr_slot(htab_t htab, eqable_gdb_smob *base)
Definition scm-gsmob.c:226
int gsmob_pred_func(SCM)
struct frame_info_ptr frscm_frame_smob_to_frame(frame_smob *)
Definition scm-frame.c:365
const char gdbscm_print_excp_full[]
Definition guile.c:58
int frscm_is_frame(SCM scm)
Definition scm-frame.c:218
#define GDBSCM_HANDLE_GDB_EXCEPTION(exception)
void gdbscm_fill_eqable_gsmob_ptr_slot(eqable_gdb_smob **slot, eqable_gdb_smob *base)
Definition scm-gsmob.c:237
int gdbscm_valid_command_class_p(int command_class)
Definition scm-cmd.c:561
struct gdbarch * arscm_get_gdbarch(arch_smob *a_smob)
Definition scm-arch.c:90
int itscm_is_end_of_iteration(SCM obj)
SCM gdbscm_map_string
scm_t_bits gdbscm_make_smob_type(const char *name, size_t size)
Definition scm-gsmob.c:103
SCM psscm_pspace_smob_pretty_printers(const pspace_smob *)
const char *const * gdbscm_gc_dup_argv(char **argv)
Definition scm-utils.c:613
SCM stscm_scm_from_symtab(struct symtab *symtab)
Definition scm-symtab.c:228
SCM gdbscm_array_string
void gdbscm_throw(SCM exception) ATTRIBUTE_NORETURN
gdb::unique_xmalloc_ptr< char > gdbscm_scm_to_host_string(SCM string, size_t *lenp, SCM *except)
Definition scm-string.c:217
bool gdbscm_auto_load_enabled(const struct extension_language_defn *)
pspace_smob * psscm_pspace_smob_from_pspace(struct program_space *)
SCM gdbscm_scm_from_host_string(const char *string, size_t len)
Definition scm-string.c:227
SCM itscm_get_iterator_arg_unsafe(SCM self, int arg_pos, const char *func_name)
struct value * lsscm_safe_lazy_string_to_value(SCM string, int arg_pos, const char *func_name, SCM *except_scmp)
SCM syscm_scm_from_symbol(struct symbol *symbol)
Definition scm-symbol.c:230
int gdb_scheme_initialized
arch_smob * arscm_get_arch_smob_arg_unsafe(SCM arch_scm, int arg_pos, const char *func_name)
Definition scm-arch.c:151
void gdbscm_initialize_ports(void)
Definition scm-ports.c:1614
objfile_script_executor_func gdbscm_execute_objfile_script
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
SCM gdbscm_end_of_iteration(void)
excp_matcher_func gdbscm_user_error_p
int gdbscm_guile_micro_version
Definition guile.c:49
SCM gdbscm_make_error(SCM key, const char *subr, const char *message, SCM args, SCM data)
SCM gdbscm_safe_call_3(SCM proc, SCM arg0, SCM arg1, SCM arg2, excp_matcher_func *ok_excps)
SCM gdbscm_scm_from_c_string(const char *string)
Definition scm-string.c:45
SCM gdbscm_make_exception(SCM tag, SCM args)
void gdbscm_enter_repl(void)
void(* func)(remote_target *remote, char *)
Definition block.h:109
GDB_SMOB_HEAD chained_gdb_smob * prev
chained_gdb_smob * next
GDB_SMOB_HEAD SCM containing_scm
enum return_reason reason
Definition gnu-nat.h:58
const char * name
const char * doc_string
const char * doc_string
const char * name
Definition value.h:130
void quit_force(int *exit_arg, int from_tty)
Definition top.c:1732