105 "gdb:pretty-printer";
107 "gdb:pretty-printer-worker";
134 scm_write (pp_smob->
name, port);
137 scm_puts (
">", port);
139 scm_remember_upto_here_1 (
self);
190 const char *func_name)
203 const char *func_name)
236 return SCM_UNSPECIFIED;
254 SCM_ASSERT_TYPE (
gdbscm_is_true (scm_list_p (printers)), printers,
259 return SCM_UNSPECIFIED;
276 scm_puts (
" ", port);
278 scm_puts (
" ", port);
280 scm_puts (
">", port);
282 scm_remember_upto_here_1 (
self);
335 scm_list_1 (
object), scm_list_1 (
object));
369 SCM orig_list = list;
371 if (scm_is_null (list))
376 (
_(
"pretty-printer list is not a list"), list);
379 for ( ; scm_is_pair (list); list = scm_cdr (list))
381 SCM matcher = scm_car (list);
388 (
_(
"pretty-printer list contains non-pretty-printer object"),
401 (
_(
"invalid lookup object in pretty-printer matcher"),
414 (
_(
"invalid result from pretty-printer lookup"), worker);
418 if (!scm_is_null (list))
421 (
_(
"pretty-printer list is not a list"), orig_list);
531 SCM result = SCM_BOOL_F;
543 else if (scm_is_string (result)
554 if (*out_value != NULL)
565 (
_(
"invalid result from pretty-printer to-string"), result);
601 if (scm_is_string (hint))
627 if (msg == NULL || *msg ==
'\0')
634 size_t len = strlen (msg);
636 if (msg[len - 1] ==
'\n')
652 struct ui_file *stream,
int recurse,
657 struct value *replacement = NULL;
667 else if (scm_is_eq (str_scm, SCM_BOOL_T))
676 else if (scm_is_string (str_scm))
690 length, NULL, 0, options);
698 for (i = 0; i <
length; ++i)
700 if (
string[i] ==
'\0')
735 struct ui_file *stream,
int recurse,
743 int is_map, is_array, done_flag, pretty;
746 SCM iter = SCM_BOOL_F;
754 (
_(
"pretty-printer \"children\" object is not a procedure or #f"),
779 (
_(
"result of pretty-printer \"children\" procedure is not" 780 " a <gdb:iterator> object"), children);
818 if (! scm_is_pair (item))
821 (
_(
"result of pretty-printer children iterator is not a pair" 822 " or (end-of-iteration)"),
826 scm_name = scm_car (item);
827 v_scm = scm_cdr (item);
828 if (!scm_is_string (scm_name))
831 (
_(
"first element of pretty-printer children iterator is not" 850 else if (! is_map || i % 2 == 0)
865 if (! is_map || i % 2 == 0)
876 if (is_map && i % 2 == 0)
898 else if (scm_is_string (v_scm))
921 if (is_map && i % 2 == 0)
950 scm_remember_upto_here_1 (iter);
959 struct ui_file *stream,
int recurse,
965 SCM exception = SCM_BOOL_F;
966 SCM printer = SCM_BOOL_F;
967 SCM val_obj = SCM_BOOL_F;
1045 {
"make-pretty-printer", 2, 0, 0,
1048 Create a <gdb:pretty-printer> object.\n\ 1050 Arguments: name lookup\n\ 1051 name: a string naming the matcher\n\ 1052 lookup: a procedure:\n\ 1053 (pretty-printer <gdb:value>) -> <gdb:pretty-printer-worker> | #f." },
1057 Return #t if the object is a <gdb:pretty-printer> object." },
1059 {
"pretty-printer-enabled?", 1, 0, 0,
1062 Return #t if the pretty-printer is enabled." },
1064 {
"set-pretty-printer-enabled!", 2, 0, 0,
1067 Set the enabled flag of the pretty-printer.\n\ 1068 Returns \"unspecified\"." },
1070 {
"make-pretty-printer-worker", 3, 0, 0,
1073 Create a <gdb:pretty-printer-worker> object.\n\ 1075 Arguments: display-hint to-string children\n\ 1076 display-hint: either #f or one of \"array\", \"map\", or \"string\"\n\ 1077 to-string: a procedure:\n\ 1078 (pretty-printer) -> string | #f | <gdb:value>\n\ 1079 children: either #f or a procedure:\n\ 1080 (pretty-printer) -> <gdb:iterator>" },
1082 {
"pretty-printer-worker?", 1, 0, 0,
1085 Return #t if the object is a <gdb:pretty-printer-worker> object." },
1089 Return the list of global pretty-printers." },
1091 {
"set-pretty-printers!", 1, 0, 0,
1094 Set the list of global pretty-printers." },
static enum display_hint ppscm_get_display_hint_enum(SCM printer)
static SCM ppscm_array_string
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
const char * target_charset(struct gdbarch *gdbarch)
static SCM scm_new_smob(scm_t_bits tc, scm_t_bits data)
static SCM gdbscm_set_pretty_printer_enabled_x(SCM self, SCM enabled)
static SCM ppscm_find_pretty_printer_from_objfiles(SCM value)
static SCM gdbscm_make_pretty_printer(SCM name, SCM lookup)
void gdbscm_define_functions(const scheme_function *, int is_public)
static pretty_printer_smob * ppscm_get_pretty_printer_smob_arg_unsafe(SCM self, int arg_pos, const char *func_name)
static SCM ppscm_search_pp_list(SCM list, SCM value)
int fputc_filtered(int c, struct ui_file *stream)
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)
static SCM ppscm_get_pretty_printer_arg_unsafe(SCM self, int arg_pos, const char *func_name)
static SCM ppscm_map_string
char * gdbscm_scm_to_c_string(SCM string)
static SCM ppscm_find_pretty_printer(SCM value)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
void common_val_print(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
enum ext_lang_rc gdbscm_apply_val_pretty_printer(const struct extension_language_defn *extlang, 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)
int vlscm_is_value(SCM scm)
static int ppscm_print_pretty_printer_worker_smob(SCM self, SCM port, scm_print_state *pstate)
scm_t_bits gdbscm_make_smob_type(const char *name, size_t size)
const gdb_byte * value_contents_for_printing(struct value *value)
int value_bytes_available(const struct value *value, LONGEST offset, LONGEST length)
static SCM gdbscm_pretty_printer_p(SCM scm)
static SCM gdbscm_pretty_printer_enabled_p(SCM self)
enum val_prettyformat prettyformat
SCM vlscm_scm_from_value(struct value *value)
int gdbscm_is_exception(SCM scm)
#define gdbscm_is_true(scm)
void null_cleanup(void *arg)
void gdbscm_init_gsmob(gdb_smob *base)
void gdbscm_initialize_pretty_printers(void)
#define CATCH(EXCEPTION, MASK)
char * gdbscm_exception_message_to_string(SCM exception)
objfile_smob * ofscm_objfile_smob_from_objfile(struct objfile *objfile)
static scm_t_bits pretty_printer_smob_tag
static struct parser_state * pstate
static scm_t_bits pretty_printer_worker_smob_tag
static SCM gdbscm_pretty_printer_worker_p(SCM scm)
objfile(bfd *, const char *, objfile_flags)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
SCM gdbscm_exception_key(SCM excp)
excp_matcher_func gdbscm_memory_error_p
#define gdbscm_is_false(scm)
static int ppscm_is_pretty_printer(SCM scm)
static SCM ppscm_find_pretty_printer_from_gdb(SCM value)
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
SCM gdbscm_safe_call_2(SCM proc, SCM arg0, SCM arg1, excp_matcher_func *ok_excps)
struct gdbarch * get_type_arch(const struct type *type)
SCM ofscm_objfile_smob_pretty_printers(objfile_smob *o_smob)
static void ppscm_print_pp_type_error(const char *message, SCM object)
static SCM gdbscm_make_pretty_printer_worker(SCM display_hint, SCM to_string, SCM children)
static int ppscm_print_pretty_printer_smob(SCM self, SCM port, scm_print_state *pstate)
static SCM gdbscm_set_pretty_printers_x(SCM printers)
void lsscm_val_print_lazy_string(SCM string, struct ui_file *stream, const struct value_print_options *options)
int lsscm_is_lazy_string(SCM scm)
char * xstrprintf(const char *format,...)
void gdbscm_printf(SCM port, const char *format,...) ATTRIBUTE_PRINTF(2
static SCM ppscm_get_display_hint_scm(SCM printer)
void wrap_here(const char *indent)
static SCM ppscm_pretty_print_one_value(SCM printer, struct value **out_value, struct gdbarch *gdbarch, const struct language_defn *language)
int itscm_is_end_of_iteration(SCM obj)
SCM gdbscm_safe_call_1(SCM proc, SCM arg0, excp_matcher_func *ok_excps)
static int ppscm_is_pretty_printer_worker(SCM scm)
void print_spaces_filtered(int n, struct ui_file *stream)
struct type * builtin_char
void gdbscm_print_gdb_exception(SCM port, SCM exception)
static SCM ppscm_string_string
static void ppscm_print_children(SCM printer, enum display_hint hint, struct ui_file *stream, int recurse, const struct value_print_options *options, struct gdbarch *gdbarch, const struct language_defn *language, int printed_nothing)
SCM psscm_pspace_smob_pretty_printers(const pspace_smob *)
static const char pretty_printer_smob_name[]
static SCM pretty_printer_list
static SCM ppscm_make_pp_type_error_exception(const char *message, SCM object)
struct program_space * current_program_space
SCM gdbscm_make_error(SCM key, const char *subr, const char *message, SCM args, SCM data)
SCM itscm_safe_call_next_x(SCM iter, excp_matcher_func *ok_excps)
static SCM gdbscm_pretty_printers(void)
static enum string_repr_result ppscm_print_string_repr(SCM printer, enum display_hint hint, struct ui_file *stream, int recurse, const struct value_print_options *options, struct gdbarch *gdbarch, const struct language_defn *language)
int gdb_scheme_initialized
static void ppscm_print_exception_unless_memory_error(SCM exception, struct ui_file *stream)
#define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options)
static SCM pp_type_error_symbol
int itscm_is_iterator(SCM scm)
static const scheme_function pretty_printer_functions[]
#define TYPE_LENGTH(thistype)
static SCM ppscm_find_pretty_printer_from_progspace(SCM value)
#define ALL_OBJFILES(obj)
pspace_smob * psscm_pspace_smob_from_pspace(struct program_space *)
struct value * value_from_component(struct value *whole, struct type *type, LONGEST offset)
int gdbscm_is_procedure(SCM proc)
static const char pretty_printer_worker_smob_name[]
SCM char * gdbscm_scm_to_string(SCM string, size_t *lenp, const char *charset, int strict, SCM *except_scmp)
void do_cleanups(struct cleanup *old_chain)