static int pascm_print_param_smob (SCM self, SCM port, scm_print_state *pstate) { param_smob *p_smob = (param_smob *) SCM_SMOB_DATA (self); SCM value; gdbscm_printf (port, "#<%s", param_smob_name); gdbscm_printf (port, " %s", p_smob->name); if (! pascm_is_valid (p_smob)) scm_puts (" {invalid}", port); gdbscm_printf (port, " %s ", pascm_param_type_name (p_smob->type)); value = pascm_param_value (p_smob->type, &p_smob->value, GDBSCM_ARG_NONE, NULL); scm_display (value, port); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int arscm_print_arch_smob (SCM self, SCM port, scm_print_state *pstate) { arch_smob *a_smob = (arch_smob *) SCM_SMOB_DATA (self); struct gdbarch *gdbarch = a_smob->gdbarch; gdbscm_printf (port, "#<%s", arch_smob_name); gdbscm_printf (port, " %s", gdbarch_bfd_arch_info (gdbarch)->printable_name); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int stscm_print_sal_smob (SCM self, SCM port, scm_print_state *pstate) { sal_smob *s_smob = (sal_smob *) SCM_SMOB_DATA (self); symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (s_smob->symtab_scm); gdbscm_printf (port, "#<%s ", symtab_smob_name); scm_write (s_smob->symtab_scm, port); if (s_smob->sal.line != 0) gdbscm_printf (port, " line %d", s_smob->sal.line); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int stscm_print_symtab_smob (SCM self, SCM port, scm_print_state *pstate) { symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (self); gdbscm_printf (port, "#<%s ", symtab_smob_name); gdbscm_printf (port, "%s", st_smob->symtab != NULL ? symtab_to_filename_for_display (st_smob->symtab) : "<invalid>"); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int lsscm_print_lazy_string_smob (SCM self, SCM port, scm_print_state *pstate) { lazy_string_smob *ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (self); gdbscm_printf (port, "#<%s", lazy_string_smob_name); gdbscm_printf (port, " @%s", hex_string (ls_smob->address)); if (ls_smob->length >= 0) gdbscm_printf (port, " length %d", ls_smob->length); if (ls_smob->encoding != NULL) gdbscm_printf (port, " encoding %s", ls_smob->encoding); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate) { symbol_smob *s_smob = (symbol_smob *) SCM_SMOB_DATA (self); if (pstate->writingp) gdbscm_printf (port, "#<%s ", symbol_smob_name); gdbscm_printf (port, "%s", s_smob->symbol != NULL ? SYMBOL_PRINT_NAME (s_smob->symbol) : "<invalid>"); if (pstate->writingp) scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static void gdbscm_print_exception_message (SCM port, SCM frame, SCM key, SCM args) { SCM printer, status; if (gdbscm_is_false (port)) port = scm_current_error_port (); gdb_assert (!scm_is_eq (key, with_stack_error_symbol)); /* This does not use scm_print_exception because we tweak the output a bit. Compare Guile's print-exception with our %print-exception-message for details. */ if (gdbscm_is_false (percent_print_exception_message_var)) { percent_print_exception_message_var = scm_c_private_variable (gdbscm_init_module_name, percent_print_exception_message_name); /* If we can't find %print-exception-message, there's a problem on the Scheme side. Don't kill GDB, just flag an error and leave it at that. */ if (gdbscm_is_false (percent_print_exception_message_var)) { gdbscm_printf (port, _("Error in Scheme exception printing," " can't find %s.\n"), percent_print_exception_message_name); return; } } printer = scm_variable_ref (percent_print_exception_message_var); status = gdbscm_safe_call_4 (printer, port, frame, key, args, NULL); /* If that failed still tell the user something. But don't use the exception printing machinery! */ if (gdbscm_is_exception (status)) { gdbscm_printf (port, _("Error in Scheme exception printing:\n")); scm_display (status, port); scm_newline (port); } }
static int cmdscm_print_command_smob (SCM self, SCM port, scm_print_state *pstate) { command_smob *c_smob = (command_smob *) SCM_SMOB_DATA (self); gdbscm_printf (port, "#<%s", command_smob_name); gdbscm_printf (port, " %s", c_smob->name != NULL ? c_smob->name : "{unnamed}"); if (! cmdscm_is_valid (c_smob)) scm_puts (" {invalid}", port); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int bpscm_print_breakpoint_smob (SCM self, SCM port, scm_print_state *pstate) { breakpoint_smob *bp_smob = (breakpoint_smob *) SCM_SMOB_DATA (self); struct breakpoint *b = bp_smob->bp; gdbscm_printf (port, "#<%s", breakpoint_smob_name); /* Only print what we export to the user. The rest are possibly internal implementation details. */ gdbscm_printf (port, " #%d", bp_smob->number); /* Careful, the breakpoint may be invalid. */ if (b != NULL) { gdbscm_printf (port, " %s %s %s", bpscm_type_to_string (b->type), bpscm_enable_state_to_string (b->enable_state), b->silent ? "silent" : "noisy"); gdbscm_printf (port, " hit:%d", b->hit_count); gdbscm_printf (port, " ignore:%d", b->ignore_count); if (b->addr_string != NULL) gdbscm_printf (port, " @%s", b->addr_string); } scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int frscm_print_frame_smob (SCM self, SCM port, scm_print_state *pstate) { frame_smob *f_smob = (frame_smob *) SCM_SMOB_DATA (self); struct ui_file *strfile; char *s; gdbscm_printf (port, "#<%s ", frame_smob_name); strfile = mem_fileopen (); fprint_frame_id (strfile, f_smob->frame_id); s = ui_file_xstrdup (strfile, NULL); gdbscm_printf (port, "%s", s); ui_file_delete (strfile); xfree (s); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int gdbscm_memory_port_print (SCM exp, SCM port, scm_print_state *pstate) { ioscm_memory_port *iomem = (ioscm_memory_port *) SCM_STREAM (exp); char *type = SCM_PTOBNAME (SCM_PTOBNUM (exp)); scm_puts ("#<", port); scm_print_port_mode (exp, port); /* scm_print_port_mode includes a trailing space. */ gdbscm_printf (port, "%s %s-%s", type, hex_string (iomem->start), hex_string (iomem->end)); scm_putc ('>', port); return 1; }
void gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key, SCM args) { SCM printer, status; if (gdbscm_is_false (port)) port = scm_current_error_port (); if (gdbscm_is_false (percent_print_exception_with_stack_var)) { percent_print_exception_with_stack_var = scm_c_private_variable (gdbscm_init_module_name, percent_print_exception_with_stack_name); /* If we can't find %print-exception-with-stack, there's a problem on the Scheme side. Don't kill GDB, just flag an error and leave it at that. */ if (gdbscm_is_false (percent_print_exception_with_stack_var)) { gdbscm_printf (port, _("Error in Scheme exception printing," " can't find %s.\n"), percent_print_exception_with_stack_name); return; } } printer = scm_variable_ref (percent_print_exception_with_stack_var); status = gdbscm_safe_call_4 (printer, port, stack, key, args, NULL); /* If that failed still tell the user something. But don't use the exception printing machinery! */ if (gdbscm_is_exception (status)) { gdbscm_printf (port, _("Error in Scheme exception printing:\n")); scm_display (status, port); scm_newline (port); } }
static int ppscm_print_pretty_printer_smob (SCM self, SCM port, scm_print_state *pstate) { pretty_printer_smob *pp_smob = (pretty_printer_smob *) SCM_SMOB_DATA (self); gdbscm_printf (port, "#<%s ", pretty_printer_smob_name); scm_write (pp_smob->name, port); scm_puts (gdbscm_is_true (pp_smob->enabled) ? " enabled" : " disabled", port); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int exscm_print_exception_smob (SCM self, SCM port, scm_print_state *pstate) { exception_smob *e_smob = (exception_smob *) SCM_SMOB_DATA (self); gdbscm_printf (port, "#<%s ", exception_smob_name); scm_write (e_smob->key, port); scm_puts (" ", port); scm_write (e_smob->args, port); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }
static int ppscm_print_pretty_printer_worker_smob (SCM self, SCM port, scm_print_state *pstate) { pretty_printer_worker_smob *w_smob = (pretty_printer_worker_smob *) SCM_SMOB_DATA (self); gdbscm_printf (port, "#<%s ", pretty_printer_worker_smob_name); scm_write (w_smob->display_hint, port); scm_puts (" ", port); scm_write (w_smob->to_string, port); scm_puts (" ", port); scm_write (w_smob->children, port); scm_puts (">", port); scm_remember_upto_here_1 (self); /* Non-zero means success. */ return 1; }