1 /* Internal header for GDB/Scheme code.
3 Copyright (C) 2014-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
20 #ifndef GDB_GUILE_GUILE_INTERNAL_H
21 #define GDB_GUILE_GUILE_INTERNAL_H
23 /* See README file in this directory for implementation notes, coding
24 conventions, et.al. */
28 #include "extension-priv.h"
33 /* GCC introduced C++20 support in GCC 8, using -std=c++2a (the name of the
34 C++20 standard before publishing) and __cplusplus 201709L. In GCC 10,
35 -std=c++20 was added, but __cplusplus stayed at 201709L, and was only
36 changed to the standard 202002L in GCC 11. Consequently, some C++20
37 features and restrictions need to be tested against the non-standard
38 201709L, otherwise the build with GCC 10 and -std=c++20 will break. */
39 #if __cplusplus >= 201709L
40 /* Work around Werror=volatile in SCM_UNPACK for
41 SCM_DEBUG_TYPING_STRICTNESS == 1. Reported upstream:
42 https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65333 . */
43 #define SCM_DEBUG_TYPING_STRICTNESS 0
52 /* A function to pass to the safe-call routines to ignore things like
54 typedef int excp_matcher_func (SCM key
);
56 /* Scheme variables to define during initialization. */
58 struct scheme_variable
62 const char *doc_string
;
65 /* End of scheme_variable table mark. */
67 #define END_VARIABLES { NULL, SCM_BOOL_F, NULL }
69 /* Although scm_t_subr is meant to hold a function pointer, at least
70 in some versions of guile, it is actually a typedef to "void *".
71 That means that in C++, an explicit cast is necessary to convert
72 function pointer to scm_t_subr. But a cast also makes it possible
73 to pass function pointers with the wrong type by mistake. So
74 instead of adding such casts throughout, we use 'as_a_scm_t_subr'
75 to do the conversion, which (only) has overloads for function
76 pointer types that are valid.
78 See https://lists.gnu.org/archive/html/guile-devel/2013-03/msg00001.html.
81 static inline scm_t_subr
82 as_a_scm_t_subr (SCM (*func
) (void))
84 return (scm_t_subr
) func
;
87 static inline scm_t_subr
88 as_a_scm_t_subr (SCM (*func
) (SCM
))
90 return (scm_t_subr
) func
;
93 static inline scm_t_subr
94 as_a_scm_t_subr (SCM (*func
) (SCM
, SCM
))
96 return (scm_t_subr
) func
;
99 static inline scm_t_subr
100 as_a_scm_t_subr (SCM (*func
) (SCM
, SCM
, SCM
))
102 return (scm_t_subr
) func
;
105 /* Scheme functions to define during initialization. */
107 struct scheme_function
114 const char *doc_string
;
117 /* End of scheme_function table mark. */
119 #define END_FUNCTIONS { NULL, 0, 0, 0, NULL, NULL }
121 /* Useful for defining a set of constants. */
123 struct scheme_integer_constant
129 #define END_INTEGER_CONSTANTS { NULL, 0 }
131 /* Pass this instead of 0 to routines like SCM_ASSERT to indicate the value
132 is not a function argument. */
133 #define GDBSCM_ARG_NONE 0
135 /* Ensure new code doesn't accidentally try to use this. */
136 #undef scm_make_smob_type
137 #define scm_make_smob_type USE_gdbscm_make_smob_type_INSTEAD
139 /* They brought over () == #f from lisp.
140 Let's avoid that for now. */
144 #define scm_is_bool USE_gdbscm_is_bool_INSTEAD
145 #define scm_is_false USE_gdbscm_is_false_INSTEAD
146 #define scm_is_true USE_gdbscm_is_true_INSTEAD
147 #define gdbscm_is_bool(scm) \
148 (scm_is_eq ((scm), SCM_BOOL_F) || scm_is_eq ((scm), SCM_BOOL_T))
149 #define gdbscm_is_false(scm) scm_is_eq ((scm), SCM_BOOL_F)
150 #define gdbscm_is_true(scm) (!gdbscm_is_false (scm))
152 #ifndef HAVE_SCM_NEW_SMOB
154 /* Guile <= 2.0.5 did not provide this function, so provide it here. */
157 scm_new_smob (scm_t_bits tc
, scm_t_bits data
)
159 SCM_RETURN_NEWSMOB (tc
, data
);
164 /* Function name that is passed around in case an error needs to be reported.
165 __func is in C99, but we provide a wrapper "just in case",
166 and because FUNC_NAME is the canonical value used in guile sources.
167 IWBN to use the Scheme version of the name (e.g. foo-bar vs foo_bar),
168 but let's KISS for now. */
169 #define FUNC_NAME __func__
171 extern const char gdbscm_module_name
[];
172 extern const char gdbscm_init_module_name
[];
174 extern int gdb_scheme_initialized
;
176 extern int gdbscm_guile_major_version
;
177 extern int gdbscm_guile_minor_version
;
178 extern int gdbscm_guile_micro_version
;
180 extern const char gdbscm_print_excp_none
[];
181 extern const char gdbscm_print_excp_full
[];
182 extern const char gdbscm_print_excp_message
[];
183 extern const char *gdbscm_print_excp
;
185 extern SCM gdbscm_documentation_symbol
;
186 extern SCM gdbscm_invalid_object_error_symbol
;
188 extern SCM gdbscm_map_string
;
189 extern SCM gdbscm_array_string
;
190 extern SCM gdbscm_string_string
;
194 extern void gdbscm_define_variables (const scheme_variable
*, int is_public
);
196 extern void gdbscm_define_functions (const scheme_function
*, int is_public
);
198 extern void gdbscm_define_integer_constants (const scheme_integer_constant
*,
201 extern void gdbscm_printf (SCM port
, const char *format
, ...)
202 ATTRIBUTE_PRINTF (2, 3);
204 extern void gdbscm_debug_display (SCM obj
);
206 extern void gdbscm_debug_write (SCM obj
);
208 extern void gdbscm_parse_function_args (const char *function_name
,
209 int beginning_arg_pos
,
211 const char *format
, ...);
213 extern SCM
gdbscm_scm_from_longest (LONGEST l
);
215 extern LONGEST
gdbscm_scm_to_longest (SCM l
);
217 extern SCM
gdbscm_scm_from_ulongest (ULONGEST l
);
219 extern ULONGEST
gdbscm_scm_to_ulongest (SCM u
);
221 extern void gdbscm_dynwind_xfree (void *ptr
);
223 extern int gdbscm_is_procedure (SCM proc
);
225 extern char *gdbscm_gc_xstrdup (const char *);
227 extern const char * const *gdbscm_gc_dup_argv (char **argv
);
229 extern int gdbscm_guile_version_is_at_least (int major
, int minor
, int micro
);
231 /* GDB smobs, from scm-gsmob.c */
233 /* All gdb smobs must contain one of the following as the first member:
234 gdb_smob, chained_gdb_smob, or eqable_gdb_smob.
236 Chained GDB smobs should have chained_gdb_smob as their first member. The
237 next,prev members of chained_gdb_smob allow for chaining gsmobs together so
238 that, for example, when an objfile is deleted we can clean up all smobs that
241 Eq-able GDB smobs should have eqable_gdb_smob as their first member. The
242 containing_scm member of eqable_gdb_smob allows for returning the same gsmob
243 instead of creating a new one, allowing them to be eq?-able.
245 All other smobs should have gdb_smob as their first member.
246 FIXME: dje/2014-05-26: gdb_smob was useful during early development as a
247 "baseclass" for all gdb smobs. If it's still unused by gdb 8.0 delete it.
249 IMPORTANT: chained_gdb_smob and eqable_gdb-smob are "subclasses" of
250 gdb_smob. The layout of chained_gdb_smob,eqable_gdb_smob must match
251 gdb_smob as if it is a subclass. To that end we use macro GDB_SMOB_HEAD
254 #define GDB_SMOB_HEAD \
255 int empty_base_class;
262 struct chained_gdb_smob
266 chained_gdb_smob
*prev
;
267 chained_gdb_smob
*next
;
270 struct eqable_gdb_smob
274 /* The object we are contained in.
275 This can be used for several purposes.
276 This is used by the eq? machinery: We need to be able to see if we have
277 already created an object for a symbol, and if so use that SCM.
278 This may also be used to protect the smob from GC if there is
279 a reference to this smob from outside of GC space (i.e., from gdb).
280 This can also be used in place of chained_gdb_smob where we need to
281 keep track of objfile referencing objects. When the objfile is deleted
282 we need to invalidate the objects: we can do that using the same hashtab
283 used to record the smob for eq-ability. */
291 /* A predicate that returns non-zero if an object is a particular kind
293 typedef int (gsmob_pred_func
) (SCM
);
295 extern scm_t_bits
gdbscm_make_smob_type (const char *name
, size_t size
);
297 extern void gdbscm_init_gsmob (gdb_smob
*base
);
299 extern void gdbscm_init_chained_gsmob (chained_gdb_smob
*base
);
301 extern void gdbscm_init_eqable_gsmob (eqable_gdb_smob
*base
,
304 extern htab_t
gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn
,
307 extern eqable_gdb_smob
**gdbscm_find_eqable_gsmob_ptr_slot
308 (htab_t htab
, eqable_gdb_smob
*base
);
310 extern void gdbscm_fill_eqable_gsmob_ptr_slot (eqable_gdb_smob
**slot
,
311 eqable_gdb_smob
*base
);
313 extern void gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab
,
314 eqable_gdb_smob
*base
);
316 /* Exceptions and calling out to Guile. */
318 /* scm-exception.c */
320 extern SCM
gdbscm_make_exception (SCM tag
, SCM args
);
322 extern int gdbscm_is_exception (SCM scm
);
324 extern SCM
gdbscm_exception_key (SCM excp
);
326 extern SCM
gdbscm_exception_args (SCM excp
);
328 extern SCM
gdbscm_make_exception_with_stack (SCM key
, SCM args
, SCM stack
);
330 extern SCM
gdbscm_make_error_scm (SCM key
, SCM subr
, SCM message
,
333 extern SCM
gdbscm_make_error (SCM key
, const char *subr
, const char *message
,
336 extern SCM
gdbscm_make_type_error (const char *subr
, int arg_pos
,
337 SCM bad_value
, const char *expected_type
);
339 extern SCM
gdbscm_make_invalid_object_error (const char *subr
, int arg_pos
,
340 SCM bad_value
, const char *error
);
342 [[noreturn
]] extern void gdbscm_invalid_object_error (const char *subr
,
347 extern SCM
gdbscm_make_out_of_range_error (const char *subr
, int arg_pos
,
348 SCM bad_value
, const char *error
);
350 [[noreturn
]] extern void gdbscm_out_of_range_error (const char *subr
,
351 int arg_pos
, SCM bad_value
,
354 extern SCM
gdbscm_make_misc_error (const char *subr
, int arg_pos
,
355 SCM bad_value
, const char *error
);
357 [[noreturn
]] extern void gdbscm_misc_error (const char *subr
, int arg_pos
,
358 SCM bad_value
, const char *error
);
360 [[noreturn
]] extern void gdbscm_throw (SCM exception
);
362 struct gdbscm_gdb_exception
;
363 extern SCM gdbscm_scm_from_gdb_exception
364 (const gdbscm_gdb_exception
&exception
);
366 [[noreturn
]] extern void gdbscm_throw_gdb_exception
367 (gdbscm_gdb_exception exception
);
369 extern void gdbscm_print_exception_with_stack (SCM port
, SCM stack
,
372 extern void gdbscm_print_gdb_exception (SCM port
, SCM exception
);
374 extern gdb::unique_xmalloc_ptr
<char> gdbscm_exception_message_to_string
377 extern excp_matcher_func gdbscm_memory_error_p
;
379 extern excp_matcher_func gdbscm_user_error_p
;
381 extern SCM
gdbscm_make_memory_error (const char *subr
, const char *msg
,
384 [[noreturn
]] extern void gdbscm_memory_error (const char *subr
,
385 const char *msg
, SCM args
);
387 /* scm-safe-call.c */
389 extern const char *gdbscm_with_guile (const char *(*func
) (void *), void *data
);
391 extern SCM
gdbscm_call_guile (SCM (*func
) (void *), void *data
,
392 excp_matcher_func
*ok_excps
);
394 extern SCM
gdbscm_safe_call_0 (SCM proc
, excp_matcher_func
*ok_excps
);
396 extern SCM
gdbscm_safe_call_1 (SCM proc
, SCM arg0
,
397 excp_matcher_func
*ok_excps
);
399 extern SCM
gdbscm_safe_call_2 (SCM proc
, SCM arg0
, SCM arg1
,
400 excp_matcher_func
*ok_excps
);
402 extern SCM
gdbscm_safe_call_3 (SCM proc
, SCM arg0
, SCM arg1
, SCM arg2
,
403 excp_matcher_func
*ok_excps
);
405 extern SCM
gdbscm_safe_call_4 (SCM proc
, SCM arg0
, SCM arg1
, SCM arg2
,
407 excp_matcher_func
*ok_excps
);
409 extern SCM
gdbscm_safe_apply_1 (SCM proc
, SCM arg0
, SCM args
,
410 excp_matcher_func
*ok_excps
);
412 extern SCM
gdbscm_unsafe_call_1 (SCM proc
, SCM arg0
);
414 extern gdb::unique_xmalloc_ptr
<char> gdbscm_safe_eval_string
415 (const char *string
, int display_result
);
417 extern gdb::unique_xmalloc_ptr
<char> gdbscm_safe_source_script
418 (const char *filename
);
420 extern void gdbscm_enter_repl (void);
422 /* Interface to various GDB objects, in alphabetical order. */
428 extern struct gdbarch
*arscm_get_gdbarch (arch_smob
*a_smob
);
430 extern arch_smob
*arscm_get_arch_smob_arg_unsafe (SCM arch_scm
, int arg_pos
,
431 const char *func_name
);
433 extern SCM
arscm_scm_from_arch (struct gdbarch
*gdbarch
);
437 extern SCM
bkscm_scm_from_block (const struct block
*block
,
438 struct objfile
*objfile
);
440 extern const struct block
*bkscm_scm_to_block
441 (SCM block_scm
, int arg_pos
, const char *func_name
, SCM
*excp
);
445 extern char *gdbscm_parse_command_name (const char *name
,
446 const char *func_name
, int arg_pos
,
447 struct cmd_list_element
***base_list
,
448 struct cmd_list_element
**start_list
);
450 extern int gdbscm_valid_command_class_p (int command_class
);
452 extern char *gdbscm_canonicalize_command_name (const char *name
,
453 int want_trailing_space
);
457 extern SCM
coscm_scm_from_color (const ui_file_style::color
&color
);
459 extern int coscm_is_color (SCM scm
);
461 extern const ui_file_style::color
& coscm_get_color (SCM color_scm
);
467 extern int frscm_is_frame (SCM scm
);
469 extern frame_smob
*frscm_get_frame_smob_arg_unsafe (SCM frame_scm
, int arg_pos
,
470 const char *func_name
);
472 extern struct frame_info_ptr
frscm_frame_smob_to_frame (frame_smob
*);
476 struct iterator_smob
;
478 extern SCM
itscm_iterator_smob_object (iterator_smob
*i_smob
);
480 extern SCM
itscm_iterator_smob_progress (iterator_smob
*i_smob
);
482 extern void itscm_set_iterator_smob_progress_x (iterator_smob
*i_smob
,
485 extern const char *itscm_iterator_smob_name (void);
487 extern SCM
gdbscm_make_iterator (SCM object
, SCM progress
, SCM next
);
489 extern int itscm_is_iterator (SCM scm
);
491 extern SCM
gdbscm_end_of_iteration (void);
493 extern int itscm_is_end_of_iteration (SCM obj
);
495 extern SCM
itscm_safe_call_next_x (SCM iter
, excp_matcher_func
*ok_excps
);
497 extern SCM
itscm_get_iterator_arg_unsafe (SCM self
, int arg_pos
,
498 const char *func_name
);
500 /* scm-lazy-string.c */
502 extern int lsscm_is_lazy_string (SCM scm
);
504 extern SCM
lsscm_make_lazy_string (CORE_ADDR address
, int length
,
505 const char *encoding
, struct type
*type
);
507 extern struct value
*lsscm_safe_lazy_string_to_value (SCM string
,
509 const char *func_name
,
512 extern void lsscm_val_print_lazy_string
513 (SCM string
, struct ui_file
*stream
,
514 const struct value_print_options
*options
);
520 extern SCM
ofscm_objfile_smob_pretty_printers (objfile_smob
*o_smob
);
522 extern objfile_smob
*ofscm_objfile_smob_from_objfile (struct objfile
*objfile
);
524 extern SCM
ofscm_scm_from_objfile (struct objfile
*objfile
);
526 /* scm-progspace.c */
530 extern SCM
psscm_pspace_smob_pretty_printers (const pspace_smob
*);
532 extern pspace_smob
*psscm_pspace_smob_from_pspace (struct program_space
*);
534 extern SCM
psscm_scm_from_pspace (struct program_space
*);
538 extern int gdbscm_scm_string_to_int (SCM string
);
540 extern gdb::unique_xmalloc_ptr
<char> gdbscm_scm_to_c_string (SCM string
);
542 extern SCM
gdbscm_scm_from_c_string (const char *string
);
544 extern SCM
gdbscm_scm_from_printf (const char *format
, ...)
545 ATTRIBUTE_PRINTF (1, 2);
547 extern gdb::unique_xmalloc_ptr
<char> gdbscm_scm_to_string
548 (SCM string
, size_t *lenp
, const char *charset
, int strict
, SCM
*except_scmp
);
550 extern SCM
gdbscm_scm_from_string (const char *string
, size_t len
,
551 const char *charset
, int strict
);
553 extern gdb::unique_xmalloc_ptr
<char> gdbscm_scm_to_host_string
554 (SCM string
, size_t *lenp
, SCM
*except
);
556 extern SCM
gdbscm_scm_from_host_string (const char *string
, size_t len
);
560 extern int syscm_is_symbol (SCM scm
);
562 extern SCM
syscm_scm_from_symbol (struct symbol
*symbol
);
564 extern struct symbol
*syscm_get_valid_symbol_arg_unsafe
565 (SCM self
, int arg_pos
, const char *func_name
);
569 extern SCM
stscm_scm_from_symtab (struct symtab
*symtab
);
571 extern SCM
stscm_scm_from_sal (struct symtab_and_line sal
);
577 extern int tyscm_is_type (SCM scm
);
579 extern SCM
tyscm_scm_from_type (struct type
*type
);
581 extern type_smob
*tyscm_get_type_smob_arg_unsafe (SCM type_scm
, int arg_pos
,
582 const char *func_name
);
584 extern struct type
*tyscm_scm_to_type (SCM t_scm
);
586 extern struct type
*tyscm_type_smob_type (type_smob
*t_smob
);
588 extern SCM
tyscm_scm_from_field (SCM type_scm
, int field_num
);
592 extern struct value
*vlscm_scm_to_value (SCM scm
);
594 extern int vlscm_is_value (SCM scm
);
596 extern SCM
vlscm_scm_from_value (struct value
*value
);
597 extern SCM
vlscm_scm_from_value_no_release (struct value
*value
);
599 extern struct value
*vlscm_convert_typed_value_from_scheme
600 (const char *func_name
, int obj_arg_pos
, SCM obj
,
601 int type_arg_pos
, SCM type_scm
, struct type
*type
, SCM
*except_scmp
,
602 struct gdbarch
*gdbarch
, const struct language_defn
*language
);
604 extern struct value
*vlscm_convert_value_from_scheme
605 (const char *func_name
, int obj_arg_pos
, SCM obj
, SCM
*except_scmp
,
606 struct gdbarch
*gdbarch
, const struct language_defn
*language
);
608 /* stript_lang methods */
610 extern objfile_script_sourcer_func gdbscm_source_objfile_script
;
611 extern objfile_script_executor_func gdbscm_execute_objfile_script
;
613 /* Return true if auto-loading Guile scripts is enabled.
614 This is the extension_language_script_ops.auto_load_enabled "method". */
616 extern bool gdbscm_auto_load_enabled (const struct extension_language_defn
*);
618 extern void gdbscm_preserve_values
619 (const struct extension_language_defn
*,
620 struct objfile
*, copied_types_hash_t
&copied_types
);
622 extern enum ext_lang_rc gdbscm_apply_val_pretty_printer
623 (const struct extension_language_defn
*,
625 struct ui_file
*stream
, int recurse
,
626 const struct value_print_options
*options
,
627 const struct language_defn
*language
);
629 extern int gdbscm_breakpoint_has_cond (const struct extension_language_defn
*,
630 struct breakpoint
*b
);
632 extern enum ext_lang_bp_stop gdbscm_breakpoint_cond_says_stop
633 (const struct extension_language_defn
*, struct breakpoint
*b
);
635 /* Initializers for each piece of Scheme support, in alphabetical order. */
637 extern void gdbscm_initialize_arches (void);
638 extern void gdbscm_initialize_auto_load (void);
639 extern void gdbscm_initialize_blocks (void);
640 extern void gdbscm_initialize_breakpoints (void);
641 extern void gdbscm_initialize_colors (void);
642 extern void gdbscm_initialize_commands (void);
643 extern void gdbscm_initialize_disasm (void);
644 extern void gdbscm_initialize_exceptions (void);
645 extern void gdbscm_initialize_frames (void);
646 extern void gdbscm_initialize_iterators (void);
647 extern void gdbscm_initialize_lazy_strings (void);
648 extern void gdbscm_initialize_math (void);
649 extern void gdbscm_initialize_objfiles (void);
650 extern void gdbscm_initialize_pretty_printers (void);
651 extern void gdbscm_initialize_parameters (void);
652 extern void gdbscm_initialize_ports (void);
653 extern void gdbscm_initialize_pspaces (void);
654 extern void gdbscm_initialize_smobs (void);
655 extern void gdbscm_initialize_strings (void);
656 extern void gdbscm_initialize_symbols (void);
657 extern void gdbscm_initialize_symtabs (void);
658 extern void gdbscm_initialize_types (void);
659 extern void gdbscm_initialize_values (void);
662 /* A complication with the Guile code is that we have two types of
663 exceptions to consider. GDB/C++ exceptions, and Guile/SJLJ
664 exceptions. Code that is facing the Guile interpreter must not
665 throw GDB exceptions, instead Scheme exceptions must be thrown.
666 Also, because Guile exceptions are SJLJ based, Guile-facing code
667 must not use local objects with dtors, unless wrapped in a scope
668 with a TRY/CATCH, because the dtors won't otherwise be run when a
669 Guile exceptions is thrown. */
671 /* This is a destructor-less clone of gdb_exception. */
673 struct gdbscm_gdb_exception
675 enum return_reason reason
;
677 /* The message is xmalloc'd. */
681 /* Return a gdbscm_gdb_exception representing EXC. */
683 inline gdbscm_gdb_exception
684 unpack (const gdb_exception
&exc
)
686 gdbscm_gdb_exception result
;
687 result
.reason
= exc
.reason
;
688 result
.error
= exc
.error
;
689 if (exc
.message
== nullptr)
690 result
.message
= nullptr;
692 result
.message
= xstrdup (exc
.message
->c_str ());
693 /* The message should be NULL iff the reason is zero. */
694 gdb_assert ((result
.reason
== 0) == (result
.message
== nullptr));
698 /* Use this after a TRY/CATCH to throw the appropriate Scheme
699 exception if a GDB error occurred. */
701 #define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \
703 if (exception.reason < 0) \
705 gdbscm_throw_gdb_exception (exception); \
710 /* Use this to wrap a callable to throw the appropriate Scheme
711 exception if the callable throws a GDB error. ARGS are forwarded
712 to FUNC. Returns the result of FUNC, unless FUNC returns a Scheme
713 exception, in which case that exception is thrown. Note that while
714 the callable is free to use objects of types with destructors,
715 because GDB errors are C++ exceptions, the caller of gdbscm_wrap
716 must not use such objects, because their destructors would not be
717 called when a Scheme exception is thrown. */
719 template<typename Function
, typename
... Args
>
721 gdbscm_wrap (Function
&&func
, Args
&&... args
)
723 SCM result
= SCM_BOOL_F
;
724 gdbscm_gdb_exception exc
{};
728 result
= func (std::forward
<Args
> (args
)...);
730 catch (const gdb_exception_forced_quit
&e
)
732 quit_force (NULL
, 0);
734 catch (const gdb_exception
&except
)
736 exc
= unpack (except
);
739 GDBSCM_HANDLE_GDB_EXCEPTION (exc
);
741 if (gdbscm_is_exception (result
))
742 gdbscm_throw (result
);
747 #endif /* GDB_GUILE_GUILE_INTERNAL_H */