92 &guile_extension_script_ops,
102 static void gdbscm_finish_initialization
105 static void gdbscm_eval_from_control_command
115 static SCM from_tty_keyword;
116 static SCM to_string_keyword;
123 static const char boot_scm_filename[] =
"boot.scm";
129 gdbscm_source_script,
139 gdbscm_finish_initialization,
142 gdbscm_eval_from_control_command,
177 error (
_(
"guile-repl currently does not take any arguments."));
231 for (iter = l; iter; iter = iter->
next)
236 for (iter = l; iter; iter = iter->
next)
238 int len = strlen (iter->
line);
240 strcpy (&script[here], iter->
line);
242 script[here++] =
'\n';
253 gdbscm_eval_from_control_command
260 error (
_(
"Invalid \"guile\" block structure."));
264 script = compute_scheme_string (cmd->
body_list[0]);
284 FILE *file,
const char *filename)
299 gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
301 int from_tty_arg_pos = -1, to_string_arg_pos = -1;
302 int from_tty = 0, to_string = 0;
303 const SCM keywords[] = { from_tty_keyword, to_string_keyword, SCM_BOOL_F };
309 command_scm, &command, rest,
310 &from_tty_arg_pos, &from_tty,
311 &to_string_arg_pos, &to_string);
344 return SCM_UNSPECIFIED;
350 gdbscm_data_directory (
void)
358 gdbscm_guile_data_directory (
void)
366 gdbscm_gdb_version (
void)
374 gdbscm_host_config (
void)
382 gdbscm_target_config (
void)
397 error (
_(
"guile-repl currently does not take any arguments."));
398 error (
_(
"Guile scripting is not supported in this copy of GDB."));
406 error (
_(
"Guile scripting is not supported in this copy of GDB."));
449 " by the name of an info command.\n"));
461 Execute the given GDB command.\n\ 463 Arguments: string [#:to-string boolean] [#:from-tty boolean]\n\ 464 If #:from-tty is true then the command executes as if entered\n\ 465 from the keyboard. The default is false (#f).\n\ 466 If #:to-string is true then the result is returned as a string.\n\ 467 Otherwise output is sent to the current output port,\n\ 468 which is the default.\n\ 469 Returns: The result of the command if #:to-string is true.\n\ 470 Otherwise returns unspecified." },
474 Return the name of GDB's data directory." },
476 {
"guile-data-directory", 0, 0, 0,
479 Return the name of the Guile directory within GDB's data directory." },
483 Return GDB's version string." },
487 Return the name of the host configuration." },
491 Return the name of the target configuration." },
499 boot_guile_support (
void *boot_scm_file)
507 return scm_c_primitive_load ((
const char *) boot_scm_file);
516 standard_throw_args_p (SCM args)
519 && scm_ilength (args) >= 3)
522 SCM arg0 = scm_list_ref (args, scm_from_int (0));
524 SCM arg1 = scm_list_ref (args, scm_from_int (1));
526 SCM arg2 = scm_list_ref (args, scm_from_int (2));
529 && scm_is_string (arg1)
540 print_standard_throw_error (SCM args)
543 SCM arg0 = scm_list_ref (args, scm_from_int (0));
545 SCM arg1 = scm_list_ref (args, scm_from_int (1));
547 SCM arg2 = scm_list_ref (args, scm_from_int (2));
552 scm_simple_format (scm_current_error_port (),
553 scm_from_latin1_string (
_(
"Error in function ~s:~%")),
556 scm_simple_format (scm_current_error_port (), arg1, arg2);
565 print_throw_error (SCM key, SCM args)
572 if (standard_throw_args_p (args))
573 print_standard_throw_error (args);
576 scm_simple_format (scm_current_error_port (),
577 scm_from_latin1_string (
_(
"Throw to key `~a' with args `~s'.~%")),
578 scm_list_2 (key, args));
585 handle_boot_error (
void *boot_scm_file, SCM key, SCM args)
589 print_throw_error (key, args);
592 warning (
_(
"Could not complete Guile gdb module initialization from:\n" 594 "Limited Guile support is available.\n" 595 "Suggest passing --data-directory=/path/to/gdb/data-directory.\n"),
596 (
const char *) boot_scm_file);
598 return SCM_UNSPECIFIED;
605 initialize_scheme_side (
void)
613 scm_c_catch (SCM_BOOL_T, boot_guile_support, boot_scm_path,
614 handle_boot_error, boot_scm_path, NULL, NULL);
616 xfree (boot_scm_path);
625 initialize_gdb_module (
void *data)
666 from_tty_keyword = scm_from_latin1_keyword (
"from-tty");
667 to_string_keyword = scm_from_latin1_keyword (
"to-string");
669 initialize_scheme_side ();
678 call_initialize_gdb_module (
void *data)
685 #if HAVE_GUILE_MANUAL_FINALIZATION 686 scm_run_finalizers ();
700 scm_set_current_module (scm_interaction_environment ());
714 gdbscm_set_backtrace (
int enable)
716 static const char disable_bt[] =
"(debug-disable 'backtrace)";
717 static const char enable_bt[] =
"(debug-enable 'backtrace)";
736 Start an interactive Guile prompt.\n\ 738 To return to GDB, type the EOF character (e.g., Ctrl-D on an empty\n\ 742 Start a Guile interactive prompt.\n\ 744 Guile scripting is not supported in this copy of GDB.\n\ 745 This command is only a placeholder.")
755 Evaluate one or more Guile expressions.\n\ 757 The expression(s) can be given as an argument, for instance:\n\ 759 guile (display 23)\n\ 761 The result of evaluating the last expression is printed.\n\ 763 If no argument is given, the following lines are read and passed\n\ 764 to Guile for evaluation. Type a line containing \"end\" to indicate\n\ 765 the end of the set of expressions.\n\ 767 The Guile GDB module must first be imported before it can be used.\n\ 769 (gdb) guile (use-modules (gdb))\n\ 770 or if you want to import the (gdb) module with a prefix, use:\n\ 771 (gdb) guile (use-modules ((gdb) #:renamer (symbol-prefix-proc 'gdb:)))\n\ 773 The Guile interactive session, started with the \"guile-repl\"\n\ 774 command, provides extensive help and apropos capabilities.\n\ 775 Type \",help\" once in a Guile interactive session.")
778 Evaluate a Guile expression.\n\ 780 Guile scripting is not supported in this copy of GDB.\n\ 781 This command is only a placeholder.")
787 _(
"Prefix command for Guile preference settings."),
793 _(
"Prefix command for Guile preference settings."),
799 _(
"Prefix command for Guile info displays."),
808 Set mode for Guile exception printing on error."),
_(
"\ 809 Show the mode of Guile exception printing on error."),
_(
"\ 810 none == no stack or message will be printed.\n\ 811 full == a message and a stack will be printed.\n\ 812 message == an error message without a stack will be printed."),
824 #ifdef HAVE_SIGPROCMASK 825 sigset_t sigchld_mask, prev_mask;
832 #if HAVE_GUILE_MANUAL_FINALIZATION 836 scm_set_automatic_finalization_enabled (0);
839 #ifdef HAVE_SIGPROCMASK 845 sigemptyset (&sigchld_mask);
846 sigaddset (&sigchld_mask, SIGCHLD);
847 sigprocmask (SIG_BLOCK, &sigchld_mask, &prev_mask);
853 scm_with_guile (call_initialize_gdb_module, NULL);
855 #ifdef HAVE_SIGPROCMASK 856 sigprocmask (SIG_SETMASK, &prev_mask, NULL);
866 gdbscm_set_backtrace (0);
void gdbscm_initialize_exceptions(void)
static void set_guile_command(const char *args, int from_tty)
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
static const char *const guile_print_excp_enums[]
void gdbscm_define_functions(const scheme_function *, int is_public)
enum command_control_type execute_control_command_untraced(struct command_line *cmd)
void gdbscm_initialize_frames(void)
void warning(const char *fmt,...)
void gdbscm_initialize_values(void)
command_line_up get_command_line(enum command_control_type type, const char *arg)
const char * gdbscm_print_excp
static void install_gdb_commands(void)
void add_setshow_enum_cmd(const char *name, enum command_class theclass, const char *const *enumlist, const char **var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
const struct gdb_exception exception_none
const char gdbscm_print_excp_full[]
int gdbscm_guile_micro_version
char * skip_spaces(char *chp)
const char gdbscm_print_excp_message[]
static struct cmd_list_element * show_guile_list
char * gdbscm_safe_source_script(const char *filename)
static void show_guile_command(const char *args, int from_tty)
#define gdbscm_is_true(scm)
static void guile_repl_command(const char *arg, int from_tty)
void execute_command(const char *, int)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
scoped_restore_tmpl< T > make_scoped_restore(T *var)
void null_cleanup(void *arg)
void gdbscm_initialize_iterators(void)
void gdbscm_initialize_pspaces(void)
const char gdbscm_print_excp_none[]
struct cmd_list_element * infolist
struct cmd_list_element * setlist
objfile_script_executor_func gdbscm_execute_objfile_script
int gdbscm_auto_load_enabled(const struct extension_language_defn *)
void gdbscm_initialize_smobs(void)
#define CATCH(EXCEPTION, MASK)
void gdbscm_initialize_objfiles(void)
SCM gdbscm_scm_from_c_string(const char *string)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
std::string execute_command_to_string(const char *p, int from_tty)
#define gdbscm_is_false(scm)
static void info_guile_command(const char *args, int from_tty)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
static void guile_command(const char *arg, int from_tty)
struct cmd_list_element * showlist
void gdbscm_initialize_pretty_printers(void)
struct cmd_list_element * add_com_alias(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag)
scoped_restore_tmpl< int > prevent_dont_repeat(void)
int gdbscm_guile_minor_version
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
void gdbscm_initialize_auto_load(void)
void script_sourcer_func(const struct extension_language_defn *, FILE *stream, const char *filename)
int gdbscm_guile_major_version
void gdbscm_initialize_breakpoints(void)
static const char * guile_datadir
void gdbscm_initialize_commands(void)
void printf_unfiltered(const char *format,...)
objfile_script_sourcer_func gdbscm_source_objfile_script
int gdbscm_scm_string_to_int(SCM string)
void _initialize_guile(void)
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
void gdbscm_initialize_symtabs(void)
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *old, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
enum ext_lang_bp_stop gdbscm_breakpoint_cond_says_stop(const struct extension_language_defn *, struct breakpoint *b)
void gdbscm_initialize_math(void)
char * gdbscm_safe_eval_string(const char *string, int display_result)
struct command_line * next
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
void gdbscm_initialize_arches(void)
void gdbscm_enter_repl(void)
void gdbscm_initialize_symbols(void)
void gdbscm_preserve_values(const struct extension_language_defn *, struct objfile *, htab_t copied_types)
SCM gdbscm_documentation_symbol
enum ext_lang_rc gdbscm_apply_val_pretty_printer(const struct extension_language_defn *, struct type *type, LONGEST embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options, const struct language_defn *language)
static struct cmd_list_element * set_guile_list
void gdbscm_initialize_lazy_strings(void)
const char gdbscm_module_name[]
void gdbscm_parse_function_args(const char *function_name, int beginning_arg_pos, const SCM *keywords, const char *format,...)
void gdbscm_initialize_blocks(void)
int gdbscm_breakpoint_has_cond(const struct extension_language_defn *, struct breakpoint *b)
struct cmd_list_element * add_info_alias(const char *name, const char *oldname, int abbrev_flag)
void gdbscm_initialize_parameters(void)
static struct cmd_list_element * info_guile_list
#define GDBSCM_HANDLE_GDB_EXCEPTION(exception)
void gdbscm_initialize_strings(void)
void gdbscm_initialize_types(void)
void bpstat_do_actions(void)
int gdb_scheme_initialized
std::unique_ptr< command_line, command_lines_deleter > command_line_up
const struct extension_language_defn extension_language_guile
const char gdbscm_init_module_name[]
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc)
struct command_line ** body_list
void error(const char *fmt,...)
void do_cleanups(struct cleanup *old_chain)
void gdbscm_initialize_ports(void)
void gdbscm_initialize_disasm(void)