20#ifndef GUILE_GUILE_INTERNAL_H
21#define GUILE_GUILE_INTERNAL_H
54#define END_VARIABLES { NULL, SCM_BOOL_F, NULL }
68static inline scm_t_subr
71 return (scm_t_subr)
func;
74static inline scm_t_subr
77 return (scm_t_subr)
func;
80static inline scm_t_subr
83 return (scm_t_subr)
func;
86static inline scm_t_subr
89 return (scm_t_subr)
func;
106#define END_FUNCTIONS { NULL, 0, 0, 0, NULL, NULL }
116#define END_INTEGER_CONSTANTS { NULL, 0 }
120#define GDBSCM_ARG_NONE 0
123#undef scm_make_smob_type
124#define scm_make_smob_type USE_gdbscm_make_smob_type_INSTEAD
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))
139#ifndef HAVE_SCM_NEW_SMOB
146 SCM_RETURN_NEWSMOB (tc, data);
156#define FUNC_NAME __func__
196 int beginning_arg_pos,
198 const
char *format, ...);
241#define GDB_SMOB_HEAD \
242 int empty_base_class;
324 SCM bad_value,
const char *expected_type);
327 SCM bad_value,
const char *error);
330 SCM bad_value,
const char *error)
334 SCM bad_value,
const char *error);
337 SCM bad_value,
const char *error)
341 SCM bad_value,
const char *error);
344 SCM bad_value,
const char *error)
347extern void gdbscm_throw (SCM exception) ATTRIBUTE_NORETURN;
402 (
const char *
string,
int display_result);
405 (
const char *filename);
418 const char *func_name);
428 (SCM block_scm,
int arg_pos,
const char *func_name, SCM *excp);
433 const char *func_name,
int arg_pos,
440 int want_trailing_space);
449 const char *func_name);
477 const char *func_name);
484 const char *encoding,
struct type *
type);
488 const char *func_name,
492 (SCM
string,
struct ui_file *stream,
527 (SCM
string,
size_t *lenp, const
char *charset,
int strict, SCM *except_scmp);
530 const
char *charset,
int strict);
533 (SCM
string,
size_t *lenp, SCM *except);
544 (SCM self,
int arg_pos, const
char *func_name);
561 const
char *func_name);
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,
584 (const
char *func_name,
int obj_arg_pos, SCM obj, SCM *except_scmp,
599 struct
objfile *, htab_t copied_types);
604 struct
ui_file *stream,
int recurse,
665 result.
reason = exc.reason;
666 result.
error = exc.error;
667 if (exc.message ==
nullptr)
670 result.
message = xstrdup (exc.message->c_str ());
672 gdb_assert ((result.
reason == 0) == (result.
message ==
nullptr));
679#define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \
681 if (exception.reason < 0) \
683 gdbscm_throw_gdb_exception (exception); \
697template<
typename Function,
typename... Args>
701 SCM result = SCM_BOOL_F;
706 result =
func (std::forward<Args> (args)...);
708 catch (
const gdb_exception_forced_quit &e)
712 catch (
const gdb_exception &except)
void objfile_script_sourcer_func(const struct extension_language_defn *, struct objfile *, FILE *stream, const char *filename)
void objfile_script_executor_func(const struct extension_language_defn *, struct objfile *, const char *name, const char *script)
static void ATTRIBUTE_PRINTF(1, 0)
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[]
int gdbscm_scm_string_to_int(SCM string)
void gdbscm_debug_write(SCM obj)
void gdbscm_initialize_symtabs(void)
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)
void gdbscm_initialize_types(void)
SCM tyscm_scm_from_field(SCM type_scm, int field_num)
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)
struct type * tyscm_type_smob_type(type_smob *t_smob)
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)
SCM gdbscm_wrap(Function &&func, Args &&... args)
void gdbscm_initialize_parameters(void)
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)
SCM vlscm_scm_from_value_no_release(struct value *value)
void gdbscm_initialize_strings(void)
int syscm_is_symbol(SCM scm)
void gdbscm_initialize_commands(void)
SCM itscm_iterator_smob_progress(iterator_smob *i_smob)
void gdbscm_initialize_pspaces(void)
const char * gdbscm_print_excp
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,...)
objfile_smob * ofscm_objfile_smob_from_objfile(struct objfile *objfile)
int gdbscm_guile_minor_version
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)
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)
int tyscm_is_type(SCM scm)
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)
htab_t gdbscm_create_eqable_gsmob_ptr_map(htab_hash hash_fn, htab_eq eq_fn)
SCM gdbscm_make_misc_error(const char *subr, int arg_pos, SCM bad_value, const char *error)
int gdbscm_is_procedure(SCM proc)
SCM lsscm_make_lazy_string(CORE_ADDR address, int length, const char *encoding, struct type *type)
void gdbscm_init_gsmob(gdb_smob *base)
void gdbscm_print_gdb_exception(SCM port, SCM exception)
SCM vlscm_scm_from_value(struct value *value)
SCM stscm_scm_from_sal(struct symtab_and_line sal)
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)
void gdbscm_initialize_symbols(void)
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)
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)
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 *)
SCM ofscm_scm_from_objfile(struct objfile *objfile)
SCM gdbscm_scm_from_longest(LONGEST l)
void gdbscm_initialize_exceptions(void)
SCM ofscm_objfile_smob_pretty_printers(objfile_smob *o_smob)
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)
const char gdbscm_module_name[]
void gdbscm_initialize_disasm(void)
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)
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)
void gdbscm_init_chained_gsmob(chained_gdb_smob *base)
type_smob * tyscm_get_type_smob_arg_unsafe(SCM type_scm, int arg_pos, const char *func_name)
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)
SCM bkscm_scm_from_block(const struct block *block, struct objfile *objfile)
void gdbscm_initialize_math(void)
const char gdbscm_print_excp_message[]
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)
SCM arscm_scm_from_arch(struct gdbarch *gdbarch)
void gdbscm_throw_gdb_exception(gdbscm_gdb_exception exception) ATTRIBUTE_NORETURN
SCM itscm_safe_call_next_x(SCM iter, excp_matcher_func *ok_excps)
ULONGEST gdbscm_scm_to_ulongest(SCM u)
int excp_matcher_func(SCM key)
char * gdbscm_canonicalize_command_name(const char *name, int want_trailing_space)
LONGEST gdbscm_scm_to_longest(SCM l)
SCM gdbscm_scm_from_ulongest(ULONGEST l)
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)
SCM gdbscm_scm_from_string(const char *string, size_t len, const char *charset, int strict)
int gdbscm_guile_major_version
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)
int gdbscm_guile_version_is_at_least(int major, int minor, int micro)
gdb::unique_xmalloc_ptr< char > gdbscm_scm_to_c_string(SCM string)
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)
SCM gdbscm_unsafe_call_1(SCM proc, SCM arg0)
struct type * tyscm_scm_to_type(SCM t_scm)
void gdbscm_define_integer_constants(const scheme_integer_constant *, int is_public)
void gdbscm_initialize_lazy_strings(void)
void gdbscm_initialize_smobs(void)
void gdbscm_initialize_blocks(void)
const struct block * bkscm_scm_to_block(SCM block_scm, int arg_pos, const char *func_name, SCM *excp)
int itscm_is_iterator(SCM scm)
void gdbscm_initialize_frames(void)
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)
void gdbscm_initialize_objfiles(void)
eqable_gdb_smob ** gdbscm_find_eqable_gsmob_ptr_slot(htab_t htab, eqable_gdb_smob *base)
struct frame_info_ptr frscm_frame_smob_to_frame(frame_smob *)
const char gdbscm_print_excp_full[]
int frscm_is_frame(SCM scm)
#define GDBSCM_HANDLE_GDB_EXCEPTION(exception)
void gdbscm_fill_eqable_gsmob_ptr_slot(eqable_gdb_smob **slot, eqable_gdb_smob *base)
int gdbscm_valid_command_class_p(int command_class)
struct gdbarch * arscm_get_gdbarch(arch_smob *a_smob)
int itscm_is_end_of_iteration(SCM obj)
scm_t_bits gdbscm_make_smob_type(const char *name, size_t size)
SCM psscm_pspace_smob_pretty_printers(const pspace_smob *)
const char *const * gdbscm_gc_dup_argv(char **argv)
SCM stscm_scm_from_symtab(struct symtab *symtab)
void gdbscm_throw(SCM exception) ATTRIBUTE_NORETURN
gdb::unique_xmalloc_ptr< char > gdbscm_scm_to_host_string(SCM string, size_t *lenp, SCM *except)
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)
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)
int gdb_scheme_initialized
arch_smob * arscm_get_arch_smob_arg_unsafe(SCM arch_scm, int arg_pos, const char *func_name)
void gdbscm_initialize_ports(void)
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
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)
SCM gdbscm_make_exception(SCM tag, SCM args)
void gdbscm_enter_repl(void)
void(* func)(remote_target *remote, char *)
GDB_SMOB_HEAD chained_gdb_smob * prev
GDB_SMOB_HEAD SCM containing_scm
enum return_reason reason
void quit_force(int *exit_arg, int from_tty)