GDB (xrefs)

Functions
py-utils.c File Reference
`#include "defs.h"`
`#include "charset.h"`
`#include "value.h"`
`#include "python-internal.h"`
`#include "py-ref.h"`

Go to the source code of this file.

## Functions
PyObject * | python_string_to_unicode (PyObject *obj)
static gdb::unique_xmalloc_ptr< char > | unicode_to_encoded_string (PyObject *unicode_str, const char *charset)
static PyObject * | unicode_to_encoded_python_string (PyObject *unicode_str, const char *charset)
gdb::unique_xmalloc_ptr< char > | unicode_to_target_string (PyObject *unicode_str)
static PyObject * | unicode_to_target_python_string (PyObject *unicode_str)
gdb::unique_xmalloc_ptr< char > | python_string_to_target_string (PyObject *obj)
PyObject * | python_string_to_target_python_string (PyObject *obj)
gdb::unique_xmalloc_ptr< char > | python_string_to_host_string (PyObject *obj)
PyObject * | host_string_to_python_string (const char *str)
int | gdbpy_is_string (PyObject *obj)
gdb::unique_xmalloc_ptr< char > | gdbpy_obj_to_string (PyObject *obj)
gdb::unique_xmalloc_ptr< char > | gdbpy_exception_to_string (PyObject *ptype, PyObject *pvalue)
void | gdbpy_convert_exception (struct gdb_exception exception)
int | get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
PyObject * | gdb_py_object_from_longest (LONGEST l)
PyObject * | gdb_py_object_from_ulongest (ULONGEST l)
int | gdb_py_int_as_long (PyObject *obj, long *result)
PyObject * | gdb_py_generic_dict (PyObject *self, void *closure)
int | gdb_pymodule_addobject (PyObject *module, const char *name, PyObject *object)

## Function Documentation

## ◆ gdb_py_generic_dict()

PyObject* gdb_py_generic_dict | ( | PyObject * | self,
|  | void * | closure
| ) |  |

Definition at line 359 of file py-utils.c.

## ◆ gdb_py_int_as_long()

int gdb_py_int_as_long | ( | PyObject * | obj,
|  | long * | result
| ) |  |

Definition at line 346 of file py-utils.c.

Referenced by bppy_set_hit_count(), bppy_set_ignore_count(), bppy_set_task(), bppy_set_thread(), cmdpy_completer(), cmdpy_completer_handle_brkchars(), pyuw_parse_register_id(), set_parameter_value(), typy_array_1(), and valpy_getitem().

## ◆ gdb_py_object_from_longest()

PyObject* gdb_py_object_from_longest | ( | LONGEST | l | ) |

Definition at line 299 of file py-utils.c.

Referenced by ltpy_entry_get_line(), ltpy_entry_get_pc(), ltpy_get_all_source_lines(), and valpy_int().

## ◆ gdb_py_object_from_ulongest()

PyObject* gdb_py_object_from_ulongest | ( | ULONGEST | l | ) |

Definition at line 321 of file py-utils.c.

Referenced by blpy_get_end(), and blpy_get_start().

## ◆ gdb_pymodule_addobject()

int gdb_pymodule_addobject | ( | PyObject * | module,
|  | const char * | name,
|  | PyObject * | object
| ) |  |

Definition at line 376 of file py-utils.c.

References name, and Py_DECREF.

Referenced by add_new_registry(), do_finish_initialization(), do_start_initialization(), gdbpy_initialize_arch(), gdbpy_initialize_blocks(), gdbpy_initialize_breakpoints(), gdbpy_initialize_commands(), gdbpy_initialize_event_generic(), gdbpy_initialize_eventregistry(), gdbpy_initialize_finishbreakpoints(), gdbpy_initialize_frames(), gdbpy_initialize_functions(), gdbpy_initialize_inferior(), gdbpy_initialize_linetable(), gdbpy_initialize_objfile(), gdbpy_initialize_parameters(), gdbpy_initialize_pspace(), gdbpy_initialize_py_events(), gdbpy_initialize_symbols(), gdbpy_initialize_symtabs(), gdbpy_initialize_thread(), gdbpy_initialize_types(), gdbpy_initialize_unwind(), and gdbpy_initialize_values().

## ◆ gdbpy_convert_exception()

void gdbpy_convert_exception | ( | struct gdb_exception | exception | ) |

Definition at line 235 of file py-utils.c.

References gdb_exception::error, gdbpy_gdb_error, gdbpy_gdb_memory_error, MEMORY_ERROR, gdb_exception::message, gdb_exception::reason, and RETURN_QUIT.

Referenced by archpy_disassemble(), bpfinishpy_detect_out_scope_cb(), bpfinishpy_init(), bpfinishpy_post_stop_hook(), bpfinishpy_pre_stop_hook(), bppy_get_commands(), enumerate_args(), enumerate_locals(), frame_info_to_frame_object(), frapy_read_var(), gdbpy_decode_line(), gdbpy_readline_wrapper(), gdbpy_start_recording(), gdbpy_stop_recording(), py_print_args(), py_print_frame(), py_print_single_arg(), py_print_type(), py_print_value(), pyuw_value_obj_to_pointer(), and recpy_bt_insn_decoded().

## ◆ gdbpy_exception_to_string()

gdb::unique_xmalloc_ptr<char> gdbpy_exception_to_string | ( | PyObject * | ptype,
|  | PyObject * | pvalue
| ) |  |

Definition at line 212 of file py-utils.c.

References gdbpy_obj_to_string().

Referenced by cmdpy_function(), fnpy_call(), gdbpy_print_stack(), print_stack_unless_memory_error(), and py_varobj_iter_next().

## ◆ gdbpy_is_string()

int gdbpy_is_string | ( | PyObject * | obj | ) |

Definition at line 173 of file py-utils.c.

Referenced by call_doc_function(), cmdpy_completer(), cmdpy_init(), compute_enum_values(), convert_value_from_python(), extract_sym(), fnpy_init(), frapy_read_var(), gdbpy_get_display_hint(), get_doc_string(), pretty_print_one_value(), print_children(), py_print_frame(), pyuw_parse_register_id(), set_parameter_value(), thpy_set_name(), and valpy_getitem().

## ◆ gdbpy_obj_to_string()

gdb::unique_xmalloc_ptr<char> gdbpy_obj_to_string | ( | PyObject * | obj | ) |

Definition at line 186 of file py-utils.c.

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

Referenced by gdbpy_exception_to_string(), gdbpy_print_stack(), and pyuw_parse_register_id().

## ◆ get_addr_from_python()

int get_addr_from_python | ( | PyObject * | obj,
|  | CORE_ADDR * | addr
| ) |  |

Definition at line 255 of file py-utils.c.

References _, CATCH, END_CATCH, gdb_py_long_as_ulongest, GDB_PY_SET_HANDLE_EXCEPTION, gdbpy_is_value_object(), gdb::ref_ptr< T, Policy >::get(), RETURN_MASK_ALL, TRY, value_as_address(), and value_object_to_value().

Referenced by infpy_read_memory(), infpy_search_memory(), infpy_write_memory(), and py_print_frame().

## ◆ host_string_to_python_string()

PyObject* host_string_to_python_string | ( | const char * | str | ) |

Definition at line 164 of file py-utils.c.

References host_charset().

Referenced by bppy_get_commands(), bppy_get_condition(), bppy_get_expression(), bppy_get_location(), gdbpy_parameter_value(), gdbpy_solib_name(), objfpy_get_build_id(), objfpy_get_filename(), objfpy_get_username(), pspy_get_filename(), stpy_fullname(), stpy_get_filename(), and stpy_get_producer().

## ◆ python_string_to_host_string()

gdb::unique_xmalloc_ptr<char> python_string_to_host_string | ( | PyObject * | obj | ) |

Definition at line 152 of file py-utils.c.

References gdb::ref_ptr< T, Policy >::get(), host_charset(), python_string_to_unicode(), and unicode_to_encoded_string().

Referenced by bppy_init(), bppy_set_condition(), call_doc_function(), cmdpy_completer(), cmdpy_init(), compute_enum_values(), extract_sym(), fnpy_init(), gdbpy_apply_type_printers(), gdbpy_before_prompt_hook(), gdbpy_get_display_hint(), gdbpy_obj_to_string(), get_doc_string(), local_setattro(), print_children(), py_print_frame(), set_parameter_value(), thpy_set_name(), typy_getitem(), and valpy_getitem().

## ◆ python_string_to_target_python_string()

PyObject* python_string_to_target_python_string | ( | PyObject * | obj | ) |

Definition at line 139 of file py-utils.c.

References gdb::ref_ptr< T, Policy >::get(), python_string_to_unicode(), and unicode_to_target_python_string().

Referenced by print_string_repr().

## ◆ python_string_to_target_string()

gdb::unique_xmalloc_ptr<char> python_string_to_target_string | ( | PyObject * | obj | ) |

Definition at line 124 of file py-utils.c.

References gdb::ref_ptr< T, Policy >::get(), python_string_to_unicode(), and unicode_to_target_string().

Referenced by convert_value_from_python(), frapy_read_var(), gdbpy_rbreak(), and varobj_value_get_print_value().

## ◆ python_string_to_unicode()

PyObject* python_string_to_unicode | ( | PyObject * | obj | ) |

Definition at line 38 of file py-utils.c.

References _, and host_charset().

Referenced by python_string_to_host_string(), python_string_to_target_python_string(), and python_string_to_target_string().

## ◆ unicode_to_encoded_python_string()

static PyObject* unicode_to_encoded_python_string | ( | PyObject * | unicode_str,
|  | const char * | charset
| ) |  |
| static

Definition at line 92 of file py-utils.c.

Referenced by unicode_to_target_python_string().

## ◆ unicode_to_encoded_string()

static gdb::unique_xmalloc_ptr<char> unicode_to_encoded_string | ( | PyObject * | unicode_str,
|  | const char * | charset
| ) |  |
| static

Definition at line 69 of file py-utils.c.

References string.

Referenced by python_string_to_host_string(), and unicode_to_target_string().

## ◆ unicode_to_target_python_string()

static PyObject* unicode_to_target_python_string | ( | PyObject * | unicode_str | ) |
| static

Definition at line 114 of file py-utils.c.

References python_gdbarch, target_charset(), and unicode_to_encoded_python_string().

Referenced by python_string_to_target_python_string().

## ◆ unicode_to_target_string()

gdb::unique_xmalloc_ptr<char> unicode_to_target_string | ( | PyObject * | unicode_str | ) |

Definition at line 103 of file py-utils.c.

References python_gdbarch, target_charset(), and unicode_to_encoded_string().

Referenced by python_string_to_target_string().