GDB (xrefs)

Classes | Enumerations | Functions | Variables
scm-pretty-print.c File Reference
`#include "defs.h"`
`#include "charset.h"`
`#include "symtab.h"`
`#include "language.h"`
`#include "objfiles.h"`
`#include "value.h"`
`#include "valprint.h"`
`#include "guile-internal.h"`

Go to the source code of this file.

## Classes
struct | pretty_printer_smob
struct | pretty_printer_worker_smob

## Enumerations
enum | string_repr_result { STRING_REPR_NONE, STRING_REPR_ERROR, STRING_REPR_OK, string_repr_none, string_repr_error, string_repr_ok }
enum | display_hint { HINT_NONE, HINT_ERROR, HINT_ARRAY, HINT_MAP, HINT_STRING }

## Functions
static int | ppscm_print_pretty_printer_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM | gdbscm_make_pretty_printer (SCM name, SCM lookup)
static int | ppscm_is_pretty_printer (SCM scm)
static SCM | gdbscm_pretty_printer_p (SCM scm)
static SCM | ppscm_get_pretty_printer_arg_unsafe (SCM self, int arg_pos, const char *func_name)
static pretty_printer_smob * | ppscm_get_pretty_printer_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
static SCM | gdbscm_pretty_printer_enabled_p (SCM self)
static SCM | gdbscm_set_pretty_printer_enabled_x (SCM self, SCM enabled)
static SCM | gdbscm_pretty_printers (void)
static SCM | gdbscm_set_pretty_printers_x (SCM printers)
static int | ppscm_print_pretty_printer_worker_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM | gdbscm_make_pretty_printer_worker (SCM display_hint, SCM to_string, SCM children)
static int | ppscm_is_pretty_printer_worker (SCM scm)
static SCM | gdbscm_pretty_printer_worker_p (SCM scm)
static SCM | ppscm_make_pp_type_error_exception (const char *message, SCM object)
static void | ppscm_print_pp_type_error (const char *message, SCM object)
static SCM | ppscm_search_pp_list (SCM list, SCM value)
static SCM | ppscm_find_pretty_printer_from_objfiles (SCM value)
static SCM | ppscm_find_pretty_printer_from_progspace (SCM value)
static SCM | ppscm_find_pretty_printer_from_gdb (SCM value)
static SCM | ppscm_find_pretty_printer (SCM value)
static SCM | ppscm_pretty_print_one_value (SCM printer, struct value **out_value, struct gdbarch *gdbarch, const struct language_defn *language)
static SCM | ppscm_get_display_hint_scm (SCM printer)
static enum display_hint | ppscm_get_display_hint_enum (SCM printer)
static void | ppscm_print_exception_unless_memory_error (SCM exception, struct ui_file *stream)
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)
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)
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)
void | gdbscm_initialize_pretty_printers (void)

## Variables
static const char | pretty_printer_smob_name []
static const char | pretty_printer_worker_smob_name []
static scm_t_bits | pretty_printer_smob_tag
static scm_t_bits | pretty_printer_worker_smob_tag
static SCM | pretty_printer_list
static SCM | pp_type_error_symbol
static SCM | ppscm_map_string
static SCM | ppscm_array_string
static SCM | ppscm_string_string
static const scheme_function | pretty_printer_functions []

## Enumeration Type Documentation

## ◆ display_hint

enum display_hint

Enumerator
HINT_NONE |
HINT_ERROR |
HINT_ARRAY |
HINT_MAP |
HINT_STRING |

Definition at line 46 of file scm-pretty-print.c.

## ◆ string_repr_result

enum string_repr_result

Enumerator
STRING_REPR_NONE |
STRING_REPR_ERROR |
STRING_REPR_OK |
string_repr_none |
string_repr_error |
string_repr_ok |

Definition at line 34 of file scm-pretty-print.c.

## Function Documentation

## ◆ gdbscm_apply_val_pretty_printer()

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
| ) |  |

Definition at line 956 of file scm-pretty-print.c.

References do_cleanups(), EXT_LANG_RC_ERROR, EXT_LANG_RC_NOP, EXT_LANG_RC_OK, gdb_assert, gdb_scheme_initialized, gdbscm_is_exception(), gdbscm_is_false, get_type_arch(), HINT_ERROR, HINT_NONE, make_cleanup(), null_cleanup(), ppscm_find_pretty_printer(), ppscm_get_display_hint_enum(), ppscm_get_display_hint_scm(), ppscm_is_pretty_printer_worker(), ppscm_print_children(), ppscm_print_exception_unless_memory_error(), ppscm_print_pp_type_error(), ppscm_print_string_repr(), STRING_REPR_ERROR, STRING_REPR_NONE, TYPE_LENGTH, value_bytes_available(), value_contents_for_printing(), value_from_component(), and vlscm_scm_from_value().

## ◆ gdbscm_initialize_pretty_printers()

void gdbscm_initialize_pretty_printers | ( | void |  | ) |

Definition at line 1100 of file scm-pretty-print.c.

References gdbscm_define_functions(), gdbscm_make_smob_type(), pp_type_error_symbol, ppscm_array_string, ppscm_map_string, ppscm_print_pretty_printer_smob(), ppscm_print_pretty_printer_worker_smob(), ppscm_string_string, pretty_printer_functions, pretty_printer_list, pretty_printer_smob_name, pretty_printer_smob_tag, pretty_printer_worker_smob_name, and pretty_printer_worker_smob_tag.

## ◆ gdbscm_make_pretty_printer()

static SCM gdbscm_make_pretty_printer | ( | SCM | name,
|  | SCM | lookup
| ) |  |
| static

Definition at line 148 of file scm-pretty-print.c.

References _, pretty_printer_smob::enabled, FUNC_NAME, gdbscm_init_gsmob(), gdbscm_is_procedure(), pretty_printer_smob::lookup, pretty_printer_smob::name, name, pretty_printer_smob_name, pretty_printer_smob_tag, and scm_new_smob().

## ◆ gdbscm_make_pretty_printer_worker()

static SCM gdbscm_make_pretty_printer_worker | ( | SCM | display_hint,
|  | SCM | to_string,
|  | SCM | children
| ) |  |
| static

Definition at line 292 of file scm-pretty-print.c.

References pretty_printer_worker_smob::children, pretty_printer_worker_smob::display_hint, gdbscm_init_gsmob(), pretty_printer_worker_smob_name, pretty_printer_worker_smob_tag, scm_new_smob(), and pretty_printer_worker_smob::to_string.

## ◆ gdbscm_pretty_printer_enabled_p()

static SCM gdbscm_pretty_printer_enabled_p | ( | SCM | self | ) |
| static

Definition at line 217 of file scm-pretty-print.c.

References pretty_printer_smob::enabled, FUNC_NAME, and ppscm_get_pretty_printer_smob_arg_unsafe().

## ◆ gdbscm_pretty_printer_p()

static SCM gdbscm_pretty_printer_p | ( | SCM | scm | ) |
| static

Definition at line 180 of file scm-pretty-print.c.

References ppscm_is_pretty_printer().

## ◆ gdbscm_pretty_printer_worker_p()

static SCM gdbscm_pretty_printer_worker_p | ( | SCM | scm | ) |
| static

Definition at line 319 of file scm-pretty-print.c.

References ppscm_is_pretty_printer_worker().

## ◆ gdbscm_pretty_printers()

static SCM gdbscm_pretty_printers | ( | void |  | ) |
| static

Definition at line 243 of file scm-pretty-print.c.

References pretty_printer_list.

## ◆ gdbscm_set_pretty_printer_enabled_x()

static SCM gdbscm_set_pretty_printer_enabled_x | ( | SCM | self,
|  | SCM | enabled
| ) |  |
| static

Definition at line 229 of file scm-pretty-print.c.

References pretty_printer_smob::enabled, FUNC_NAME, gdbscm_is_true, and ppscm_get_pretty_printer_smob_arg_unsafe().

## ◆ gdbscm_set_pretty_printers_x()

static SCM gdbscm_set_pretty_printers_x | ( | SCM | printers | ) |
| static

Definition at line 252 of file scm-pretty-print.c.

References _, FUNC_NAME, gdbscm_is_true, and pretty_printer_list.

## ◆ ppscm_find_pretty_printer()

static SCM ppscm_find_pretty_printer | ( | SCM | value | ) |
| static

Definition at line 492 of file scm-pretty-print.c.

References gdbscm_is_true, ppscm_find_pretty_printer_from_gdb(), ppscm_find_pretty_printer_from_objfiles(), and ppscm_find_pretty_printer_from_progspace().

Referenced by gdbscm_apply_val_pretty_printer().

## ◆ ppscm_find_pretty_printer_from_gdb()

static SCM ppscm_find_pretty_printer_from_gdb | ( | SCM | value | ) |
| static

Definition at line 476 of file scm-pretty-print.c.

References ppscm_search_pp_list(), and pretty_printer_list.

Referenced by ppscm_find_pretty_printer().

## ◆ ppscm_find_pretty_printer_from_objfiles()

static SCM ppscm_find_pretty_printer_from_objfiles | ( | SCM | value | ) |
| static

Definition at line 434 of file scm-pretty-print.c.

References ALL_OBJFILES, gdbscm_is_true, objfile::objfile(), ofscm_objfile_smob_from_objfile(), ofscm_objfile_smob_pretty_printers(), and ppscm_search_pp_list().

Referenced by ppscm_find_pretty_printer().

## ◆ ppscm_find_pretty_printer_from_progspace()

static SCM ppscm_find_pretty_printer_from_progspace | ( | SCM | value | ) |
| static

Definition at line 460 of file scm-pretty-print.c.

References current_program_space, ppscm_search_pp_list(), psscm_pspace_smob_from_pspace(), and psscm_pspace_smob_pretty_printers().

Referenced by ppscm_find_pretty_printer().

## ◆ ppscm_get_display_hint_enum()

static enum display_hint ppscm_get_display_hint_enum | ( | SCM | printer | ) |
| static

Definition at line 595 of file scm-pretty-print.c.

References gdbscm_is_false, gdbscm_is_true, HINT_ERROR, HINT_NONE, HINT_STRING, ppscm_array_string, ppscm_get_display_hint_scm(), ppscm_map_string, and ppscm_string_string.

Referenced by gdbscm_apply_val_pretty_printer().

## ◆ ppscm_get_display_hint_scm()

static SCM ppscm_get_display_hint_scm | ( | SCM | printer | ) |
| static

Definition at line 581 of file scm-pretty-print.c.

References pretty_printer_worker_smob::display_hint.

Referenced by gdbscm_apply_val_pretty_printer(), and ppscm_get_display_hint_enum().

## ◆ ppscm_get_pretty_printer_arg_unsafe()

static SCM ppscm_get_pretty_printer_arg_unsafe | ( | SCM | self,
|  | int | arg_pos,
|  | const char * | func_name
| ) |  |
| static

Definition at line 189 of file scm-pretty-print.c.

References ppscm_is_pretty_printer(), and pretty_printer_smob_name.

Referenced by ppscm_get_pretty_printer_smob_arg_unsafe().

## ◆ ppscm_get_pretty_printer_smob_arg_unsafe()

static pretty_printer_smob* ppscm_get_pretty_printer_smob_arg_unsafe | ( | SCM | self,
|  | int | arg_pos,
|  | const char * | func_name
| ) |  |
| static

Definition at line 202 of file scm-pretty-print.c.

References ppscm_get_pretty_printer_arg_unsafe().

Referenced by gdbscm_pretty_printer_enabled_p(), and gdbscm_set_pretty_printer_enabled_x().

## ◆ ppscm_is_pretty_printer()

static int ppscm_is_pretty_printer | ( | SCM | scm | ) |
| static

Definition at line 172 of file scm-pretty-print.c.

References pretty_printer_smob_tag.

Referenced by gdbscm_pretty_printer_p(), ppscm_get_pretty_printer_arg_unsafe(), and ppscm_search_pp_list().

## ◆ ppscm_is_pretty_printer_worker()

static int ppscm_is_pretty_printer_worker | ( | SCM | scm | ) |
| static

Definition at line 311 of file scm-pretty-print.c.

References pretty_printer_worker_smob_tag.

Referenced by gdbscm_apply_val_pretty_printer(), gdbscm_pretty_printer_worker_p(), and ppscm_search_pp_list().

## ◆ ppscm_make_pp_type_error_exception()

static SCM ppscm_make_pp_type_error_exception | ( | const char * | message,
|  | SCM | object
| ) |  |
| static

Definition at line 328 of file scm-pretty-print.c.

References do_cleanups(), gdbscm_make_error(), make_cleanup(), pp_type_error_symbol, xfree(), and xstrprintf().

Referenced by ppscm_pretty_print_one_value(), ppscm_print_pp_type_error(), and ppscm_search_pp_list().

## ◆ ppscm_pretty_print_one_value()

static SCM ppscm_pretty_print_one_value | ( | SCM | printer,
|  | struct value ** | out_value,
|  | struct gdbarch * | gdbarch,
|  | const struct language_defn * | language
| ) |  |
| static

Definition at line 527 of file scm-pretty-print.c.

References _, CATCH, END_CATCH, FUNC_NAME, GDBSCM_ARG_NONE, gdbscm_is_exception(), gdbscm_is_false, gdbscm_memory_error_p, gdbscm_safe_call_1(), lsscm_is_lazy_string(), ppscm_make_pp_type_error_exception(), RETURN_MASK_ALL, pretty_printer_worker_smob::to_string, TRY, vlscm_convert_value_from_scheme(), and vlscm_is_value().

Referenced by ppscm_print_string_repr().

## ◆ ppscm_print_children()

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
| ) |  |
| static

Definition at line 734 of file scm-pretty-print.c.

References _, value_print_options::addressprint, pretty_printer_worker_smob::children, common_val_print(), do_cleanups(), fprintf_filtered(), fputs_filtered(), FUNC_NAME, GDBSCM_ARG_NONE, gdbscm_is_exception(), gdbscm_is_false, gdbscm_is_procedure(), gdbscm_memory_error_p, gdbscm_safe_call_1(), gdbscm_scm_to_c_string(), HINT_ARRAY, HINT_MAP, itscm_is_end_of_iteration(), itscm_is_iterator(), itscm_safe_call_next_x(), lsscm_is_lazy_string(), lsscm_val_print_lazy_string(), make_cleanup(), n_spaces(), name, null_cleanup(), ppscm_print_exception_unless_memory_error(), ppscm_print_pp_type_error(), value_print_options::prettyformat, value_print_options::prettyformat_arrays, value_print_options::prettyformat_structs, value_print_options::print_array_indexes, value_print_options::print_max, print_spaces_filtered(), value_print_options::summary, Val_prettyformat, vlscm_convert_value_from_scheme(), wrap_here(), and xfree().

Referenced by gdbscm_apply_val_pretty_printer().

## ◆ ppscm_print_exception_unless_memory_error()

static void ppscm_print_exception_unless_memory_error | ( | SCM | exception,
|  | struct ui_file * | stream
| ) |  |
| static

Definition at line 618 of file scm-pretty-print.c.

References _, do_cleanups(), fprintf_filtered(), gdbscm_exception_key(), gdbscm_exception_message_to_string(), gdbscm_memory_error_p, gdbscm_print_gdb_exception(), make_cleanup(), and xfree().

Referenced by gdbscm_apply_val_pretty_printer(), ppscm_print_children(), and ppscm_print_string_repr().

## ◆ ppscm_print_pp_type_error()

static void ppscm_print_pp_type_error | ( | const char * | message,
|  | SCM | object
| ) |  |
| static

Definition at line 348 of file scm-pretty-print.c.

References gdbscm_print_gdb_exception(), and ppscm_make_pp_type_error_exception().

Referenced by gdbscm_apply_val_pretty_printer(), and ppscm_print_children().

## ◆ ppscm_print_pretty_printer_smob()

static int ppscm_print_pretty_printer_smob | ( | SCM | self,
|  | SCM | port,
|  | scm_print_state * | pstate
| ) |  |
| static

Definition at line 129 of file scm-pretty-print.c.

References pretty_printer_smob::enabled, gdbscm_is_true, gdbscm_printf(), pretty_printer_smob::name, and pretty_printer_smob_name.

Referenced by gdbscm_initialize_pretty_printers().

## ◆ ppscm_print_pretty_printer_worker_smob()

static int ppscm_print_pretty_printer_worker_smob | ( | SCM | self,
|  | SCM | port,
|  | scm_print_state * | pstate
| ) |  |
| static

Definition at line 268 of file scm-pretty-print.c.

References pretty_printer_worker_smob::children, pretty_printer_worker_smob::display_hint, gdbscm_printf(), pretty_printer_worker_smob_name, and pretty_printer_worker_smob::to_string.

Referenced by gdbscm_initialize_pretty_printers().

## ◆ ppscm_print_string_repr()

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
| ) |  |
| static

strict

Definition at line 651 of file scm-pretty-print.c.

References value_print_options::addressprint, builtin_type::builtin_char, builtin_type(), common_val_print(), do_cleanups(), fputc_filtered(), fputs_filtered(), gdb_assert, gdbscm_is_exception(), gdbscm_is_false, gdbscm_scm_to_string(), HINT_STRING, LA_PRINT_STRING, type::length, lsscm_is_lazy_string(), lsscm_val_print_lazy_string(), make_cleanup(), ppscm_pretty_print_one_value(), ppscm_print_exception_unless_memory_error(), STRING_REPR_ERROR, STRING_REPR_NONE, STRING_REPR_OK, target_charset(), and xfree().

Referenced by gdbscm_apply_val_pretty_printer().

## ◆ ppscm_search_pp_list()

static SCM ppscm_search_pp_list | ( | SCM | list,
|  | SCM | value
| ) |  |
| static

Definition at line 367 of file scm-pretty-print.c.

References _, pretty_printer_smob::enabled, gdbscm_is_exception(), gdbscm_is_false, gdbscm_is_procedure(), gdbscm_memory_error_p, gdbscm_safe_call_2(), pretty_printer_smob::lookup, ppscm_is_pretty_printer(), ppscm_is_pretty_printer_worker(), and ppscm_make_pp_type_error_exception().

Referenced by ppscm_find_pretty_printer_from_gdb(), ppscm_find_pretty_printer_from_objfiles(), and ppscm_find_pretty_printer_from_progspace().

## Variable Documentation

## ◆ pp_type_error_symbol

SCM pp_type_error_symbol
| static

Definition at line 117 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), and ppscm_make_pp_type_error_exception().

## ◆ ppscm_array_string

SCM ppscm_array_string
| static

Definition at line 121 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), and ppscm_get_display_hint_enum().

## ◆ ppscm_map_string

SCM ppscm_map_string
| static

Definition at line 120 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), and ppscm_get_display_hint_enum().

## ◆ ppscm_string_string

SCM ppscm_string_string
| static

Definition at line 122 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), and ppscm_get_display_hint_enum().

## ◆ pretty_printer_functions

const scheme_function pretty_printer_functions[]
| static

Definition at line 1043 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers().

## ◆ pretty_printer_list

SCM pretty_printer_list
| static

Definition at line 114 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), gdbscm_pretty_printers(), gdbscm_set_pretty_printers_x(), and ppscm_find_pretty_printer_from_gdb().

## ◆ pretty_printer_smob_name

const char pretty_printer_smob_name[]
| static

Initial value:
=
"gdb:pretty-printer"

Definition at line 104 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), gdbscm_make_pretty_printer(), ppscm_get_pretty_printer_arg_unsafe(), and ppscm_print_pretty_printer_smob().

## ◆ pretty_printer_smob_tag

scm_t_bits pretty_printer_smob_tag
| static

Definition at line 110 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), gdbscm_make_pretty_printer(), and ppscm_is_pretty_printer().

## ◆ pretty_printer_worker_smob_name

const char pretty_printer_worker_smob_name[]
| static

Initial value:
=
"gdb:pretty-printer-worker"

Definition at line 106 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), gdbscm_make_pretty_printer_worker(), and ppscm_print_pretty_printer_worker_smob().

## ◆ pretty_printer_worker_smob_tag

scm_t_bits pretty_printer_worker_smob_tag
| static

Definition at line 111 of file scm-pretty-print.c.

Referenced by gdbscm_initialize_pretty_printers(), gdbscm_make_pretty_printer_worker(), and ppscm_is_pretty_printer_worker().