GDB (xrefs)

Classes | Enumerations | Functions
py-prettyprint.c File Reference
`#include "defs.h"`
`#include "objfiles.h"`
`#include "symtab.h"`
`#include "language.h"`
`#include "valprint.h"`
`#include "extension-priv.h"`
`#include "python.h"`
`#include "python-internal.h"`
`#include "py-ref.h"`

Go to the source code of this file.

## Classes
class | dummy_python_frame

## Enumerations
enum | string_repr_result { STRING_REPR_NONE, STRING_REPR_ERROR, STRING_REPR_OK, string_repr_none, string_repr_error, string_repr_ok }

## Functions
static PyObject * | search_pp_list (PyObject *list, PyObject *value)
static PyObject * | find_pretty_printer_from_objfiles (PyObject *value)
static PyObject * | find_pretty_printer_from_progspace (PyObject *value)
static PyObject * | find_pretty_printer_from_gdb (PyObject *value)
static PyObject * | find_pretty_printer (PyObject *value)
static PyObject * | pretty_print_one_value (PyObject *printer, struct value **out_value)
gdb::unique_xmalloc_ptr< char > | gdbpy_get_display_hint (PyObject *printer)
static void | print_stack_unless_memory_error (struct ui_file *stream)
static enum string_repr_result | print_string_repr (PyObject *printer, const char *hint, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language, struct gdbarch *gdbarch)
static void | print_children (PyObject *printer, const char *hint, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language, int is_py_none)
enum ext_lang_rc | gdbpy_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)
PyObject * | apply_varobj_pretty_printer (PyObject *printer_obj, struct value **replacement, struct ui_file *stream)
PyObject * | gdbpy_get_varobj_pretty_printer (struct value *value)
PyObject * | gdbpy_default_visualizer (PyObject *self, PyObject *args)

## Enumeration Type Documentation

## ◆ 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 32 of file py-prettyprint.c.

## Function Documentation

## ◆ apply_varobj_pretty_printer()

PyObject* apply_varobj_pretty_printer | ( | PyObject * | printer_obj,
|  | struct value ** | replacement,
|  | struct ui_file * | stream
| ) |  |

Definition at line 723 of file py-prettyprint.c.

References pretty_print_one_value(), and print_stack_unless_memory_error().

Referenced by varobj_value_get_print_value().

## ◆ find_pretty_printer()

static PyObject* find_pretty_printer | ( | PyObject * | value | ) |
| static

Definition at line 165 of file py-prettyprint.c.

References find_pretty_printer_from_gdb(), find_pretty_printer_from_objfiles(), find_pretty_printer_from_progspace(), and gdb::ref_ptr< T, Policy >::release().

Referenced by gdbpy_apply_val_pretty_printer(), gdbpy_default_visualizer(), and gdbpy_get_varobj_pretty_printer().

## ◆ find_pretty_printer_from_gdb()

static PyObject* find_pretty_printer_from_gdb | ( | PyObject * | value | ) |
| static

Definition at line 146 of file py-prettyprint.c.

References gdb_python_module, gdb::ref_ptr< T, Policy >::get(), PyObject_GetAttrString, PyObject_HasAttrString, and search_pp_list().

Referenced by find_pretty_printer().

## ◆ find_pretty_printer_from_objfiles()

static PyObject* find_pretty_printer_from_objfiles | ( | PyObject * | value | ) |
| static

Definition at line 94 of file py-prettyprint.c.

References ALL_OBJFILES, gdb::ref_ptr< T, Policy >::get(), objfile_to_objfile_object(), objfpy_get_printers(), gdb::ref_ptr< T, Policy >::release(), and search_pp_list().

Referenced by find_pretty_printer().

## ◆ find_pretty_printer_from_progspace()

static PyObject* find_pretty_printer_from_progspace | ( | PyObject * | value | ) |
| static

Definition at line 129 of file py-prettyprint.c.

References current_program_space, gdb::ref_ptr< T, Policy >::get(), pspace_to_pspace_object(), pspy_get_printers(), and search_pp_list().

Referenced by find_pretty_printer().

## ◆ gdbpy_apply_val_pretty_printer()

enum ext_lang_rc gdbpy_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 654 of file py-prettyprint.c.

References value::embedded_offset, EXT_LANG_RC_ERROR, EXT_LANG_RC_NOP, EXT_LANG_RC_OK, find_pretty_printer(), gdb_python_initialized, gdbpy_get_display_hint(), gdb::ref_ptr< T, Policy >::get(), get_type_arch(), print_children(), print_stack_unless_memory_error(), print_string_repr(), string_repr_error, string_repr_none, TYPE_LENGTH, value_bytes_available(), value_contents_for_printing(), value_from_component(), and value_to_value_object().

## ◆ gdbpy_default_visualizer()

PyObject* gdbpy_default_visualizer | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |

Definition at line 767 of file py-prettyprint.c.

References _, find_pretty_printer(), and value_object_to_value().

## ◆ gdbpy_get_display_hint()

gdb::unique_xmalloc_ptr<char> gdbpy_get_display_hint | ( | PyObject * | printer | ) |

Definition at line 226 of file py-prettyprint.c.

References gdbpy_display_hint_cst, gdbpy_is_string(), gdbpy_print_stack(), gdb::ref_ptr< T, Policy >::get(), and python_string_to_host_string().

Referenced by gdbpy_apply_val_pretty_printer(), varobj_get_display_hint(), and varobj_value_get_print_value().

## ◆ gdbpy_get_varobj_pretty_printer()

PyObject* gdbpy_get_varobj_pretty_printer | ( | struct value * | value | ) |

Definition at line 743 of file py-prettyprint.c.

References CATCH, END_CATCH, find_pretty_printer(), GDB_PY_HANDLE_EXCEPTION, RETURN_MASK_ALL, TRY, value_copy(), and value_to_value_object().

Referenced by install_default_visualizer().

## ◆ pretty_print_one_value()

static PyObject* pretty_print_one_value | ( | PyObject * | printer,
|  | struct value ** | out_value
| ) |  |
| static

Definition at line 191 of file py-prettyprint.c.

References CATCH, convert_value_from_python(), END_CATCH, gdbpy_is_lazy_string(), gdbpy_is_string(), gdbpy_to_string_cst, gdb::ref_ptr< T, Policy >::get(), gdb::ref_ptr< T, Policy >::release(), gdb::ref_ptr< T, Policy >::reset(), RETURN_MASK_ALL, and TRY.

Referenced by apply_varobj_pretty_printer(), and print_string_repr().

## ◆ print_children()

static void print_children | ( | PyObject * | printer,
|  | const char * | hint,
|  | struct ui_file * | stream,
|  | int | recurse,
|  | const struct value_print_options * | options,
|  | const struct language_defn * | language,
|  | int | is_py_none
| ) |  |
| static

Definition at line 445 of file py-prettyprint.c.

References _, value_print_options::addressprint, common_val_print(), convert_value_from_python(), error(), dummy_python_frame::failed(), fprintf_filtered(), fprintf_unfiltered(), fputs_filtered(), gdb_stderr, gdbpy_children_cst, gdbpy_extract_lazy_string(), gdbpy_is_lazy_string(), gdbpy_is_string(), gdbpy_print_python_errors_p(), gdbpy_print_stack(), gdb::ref_ptr< T, Policy >::get(), type::length, n_spaces(), name, 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(), print_stack_unless_memory_error(), python_string_to_host_string(), value_print_options::summary, type, Val_prettyformat, val_print_string(), and wrap_here().

Referenced by gdbpy_apply_val_pretty_printer().

## ◆ print_stack_unless_memory_error()

static void print_stack_unless_memory_error | ( | struct ui_file * | stream | ) |
| static

Definition at line 253 of file py-prettyprint.c.

References _, fprintf_filtered(), gdbpy_exception_to_string(), gdbpy_gdb_memory_error, gdbpy_print_stack(), type, and value_ref().

Referenced by apply_varobj_pretty_printer(), gdbpy_apply_val_pretty_printer(), print_children(), and print_string_repr().

## ◆ print_string_repr()

static enum string_repr_result print_string_repr | ( | PyObject * | printer,
|  | const char * | hint,
|  | struct ui_file * | stream,
|  | int | recurse,
|  | const struct value_print_options * | options,
|  | const struct language_defn * | language,
|  | struct gdbarch * | gdbarch
| ) |  |
| static

Definition at line 282 of file py-prettyprint.c.

References value_print_options::addressprint, builtin_type::builtin_char, builtin_type(), common_val_print(), fputs_filtered(), gdbpy_extract_lazy_string(), gdbpy_is_lazy_string(), gdb::ref_ptr< T, Policy >::get(), LA_PRINT_STRING, type::length, pretty_print_one_value(), print_stack_unless_memory_error(), python_string_to_target_python_string(), string, string_repr_error, string_repr_none, string_repr_ok, type, and val_print_string().

Referenced by gdbpy_apply_val_pretty_printer().

## ◆ search_pp_list()

static PyObject* search_pp_list | ( | PyObject * | list,
|  | PyObject * | value
| ) |  |
| static

Definition at line 49 of file py-prettyprint.c.

References gdbpy_enabled_cst, gdb::ref_ptr< T, Policy >::get(), and gdb::ref_ptr< T, Policy >::release().

Referenced by find_pretty_printer_from_gdb(), find_pretty_printer_from_objfiles(), and find_pretty_printer_from_progspace().