GDB (xrefs)

Classes | Macros | Functions | Variables
py-unwind.c File Reference
`#include "defs.h"`
`#include "arch-utils.h"`
`#include "frame-unwind.h"`
`#include "gdb_obstack.h"`
`#include "gdbcmd.h"`
`#include "language.h"`
`#include "observer.h"`
`#include "python-internal.h"`
`#include "regcache.h"`
`#include "valprint.h"`
`#include "user-regs.h"`
`#include "py-ref.h"`

Go to the source code of this file.

## Classes
struct | pending_frame_object
struct | saved_reg
struct | unwind_info_object
struct | cached_frame_info
struct | pyuw_gdbarch_data_type

## Macros
#define | TRACE_PY_UNWIND(level, args...)

## Functions
| DEF_VEC_O (saved_reg)
PyTypeObject pending_frame_object_type | CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pending_frame_object")
PyTypeObject unwind_info_object_type | CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("unwind_info_object")
static int | pyuw_parse_register_id (struct gdbarch *gdbarch, PyObject *pyo_reg_id, int *reg_num)
static int | pyuw_value_obj_to_pointer (PyObject *pyo_value, CORE_ADDR *addr)
static int | pyuw_object_attribute_to_pointer (PyObject *pyo, const char *attr_name, CORE_ADDR *addr)
static PyObject * | unwind_infopy_str (PyObject *self)
static PyObject * | pyuw_create_unwind_info (PyObject *pyo_pending_frame, struct frame_id frame_id)
static PyObject * | unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
static void | unwind_infopy_dealloc (PyObject *self)
static PyObject * | pending_framepy_str (PyObject *self)
static PyObject * | pending_framepy_read_register (PyObject *self, PyObject *args)
static PyObject * | pending_framepy_create_unwind_info (PyObject *self, PyObject *args)
static void | pyuw_this_id (struct frame_info *this_frame, void **cache_ptr, struct frame_id *this_id)
static struct value * | pyuw_prev_register (struct frame_info *this_frame, void **cache_ptr, int regnum)
static int | pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, void **cache_ptr)
static void | pyuw_dealloc_cache (struct frame_info *this_frame, void *cache)
static void * | pyuw_gdbarch_data_init (struct gdbarch *gdbarch)
static void | pyuw_on_new_gdbarch (struct gdbarch *newarch)
int | gdbpy_initialize_unwind (void)

## Variables
static unsigned int | pyuw_debug = 0
static struct gdbarch_data * | pyuw_gdbarch_data
static PyMethodDef | pending_frame_object_methods []
PyTypeObject | pending_frame_object_type
static PyMethodDef | unwind_info_object_methods []
PyTypeObject | unwind_info_object_type

## Macro Definition Documentation

## ◆ TRACE_PY_UNWIND

#define TRACE_PY_UNWIND | ( |  | level,
|  |  | args...
| ) |  |

Value:
if (pyuw_debug >= level) \
{ fprintf_unfiltered (gdb_stdlog, args); }
pyuw_debug
static unsigned int pyuw_debug
Definition: py-unwind.c:96
fprintf_unfiltered
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
Definition: utils.c:2018
gdb_stdlog
#define gdb_stdlog
Definition: utils.h:349

Definition at line 33 of file py-unwind.c.

Referenced by pyuw_dealloc_cache(), pyuw_prev_register(), and pyuw_sniffer().

## Function Documentation

## ◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF() [1/2]

PyTypeObject pending_frame_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF | ( | "pending_frame_object" |  | ) |

## ◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF() [2/2]

PyTypeObject unwind_info_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF | ( | "unwind_info_object" |  | ) |

## ◆ DEF_VEC_O()

DEF_VEC_O | ( | saved_reg |  | ) |

## ◆ gdbpy_initialize_unwind()

int gdbpy_initialize_unwind | ( | void |  | ) |

Definition at line 653 of file py-unwind.c.

References _, add_setshow_zuinteger_cmd(), class_maintenance, gdb_module, gdb_pymodule_addobject(), gdbarch_data_register_post_init(), observer_attach_architecture_changed(), pending_frame_object_type, pyuw_debug, pyuw_gdbarch_data, pyuw_gdbarch_data_init(), pyuw_on_new_gdbarch(), setdebuglist, showdebuglist, and unwind_info_object_type.

Referenced by do_start_initialization().

## ◆ pending_framepy_create_unwind_info()

static PyObject* pending_framepy_create_unwind_info | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 421 of file py-unwind.c.

References _, frame_id_build(), frame_id_build_special(), frame_id_build_wild(), pyuw_create_unwind_info(), and pyuw_object_attribute_to_pointer().

## ◆ pending_framepy_read_register()

static PyObject* pending_framepy_read_register | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 374 of file py-unwind.c.

References CATCH, END_CATCH, pending_frame_object::frame_info, GDB_PY_HANDLE_EXCEPTION, pending_frame_object::gdbarch, pyuw_parse_register_id(), regnum, RETURN_MASK_ALL, TRY, value_of_register(), and value_to_value_object().

## ◆ pending_framepy_str()

static PyObject* pending_framepy_str | ( | PyObject * | self | ) |
| static

Definition at line 348 of file py-unwind.c.

References CATCH, core_addr_to_string_nz(), END_CATCH, GDB_PY_HANDLE_EXCEPTION, get_frame_pc(), get_frame_sp(), RETURN_MASK_ALL, and TRY.

## ◆ pyuw_create_unwind_info()

static PyObject* pyuw_create_unwind_info | ( | PyObject * | pyo_pending_frame,
|  | struct frame_id | frame_id
| ) |  |
| static

Definition at line 237 of file py-unwind.c.

References unwind_info_object::frame_id, unwind_info_object::pending_frame, unwind_info_object_type, and VEC_alloc.

Referenced by pending_framepy_create_unwind_info().

## ◆ pyuw_dealloc_cache()

static void pyuw_dealloc_cache | ( | struct frame_info * | this_frame,
|  | void * | cache
| ) |  |
| static

Definition at line 600 of file py-unwind.c.

References cached_reg::data, cached_frame_info::reg, cached_frame_info::reg_count, TRACE_PY_UNWIND, and xfree().

Referenced by pyuw_on_new_gdbarch().

## ◆ pyuw_gdbarch_data_init()

static void* pyuw_gdbarch_data_init | ( | struct gdbarch * | gdbarch | ) |
| static

Definition at line 618 of file py-unwind.c.

References GDBARCH_OBSTACK_ZALLOC.

Referenced by gdbpy_initialize_unwind().

## ◆ pyuw_object_attribute_to_pointer()

static int pyuw_object_attribute_to_pointer | ( | PyObject * | pyo,
|  | const char * | attr_name,
|  | CORE_ADDR * | addr
| ) |  |
| static

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

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

Referenced by pending_framepy_create_unwind_info().

## ◆ pyuw_on_new_gdbarch()

static void pyuw_on_new_gdbarch | ( | struct gdbarch * | newarch | ) |
| static

Definition at line 627 of file py-unwind.c.

References frame_unwind::dealloc_cache, default_frame_unwind_stop_reason(), frame_unwind_prepend_unwinder(), GDBARCH_OBSTACK_ZALLOC, NORMAL_FRAME, frame_unwind::prev_register, pyuw_dealloc_cache(), pyuw_gdbarch_data, pyuw_prev_register(), pyuw_sniffer(), pyuw_this_id(), frame_unwind::sniffer, frame_unwind::stop_reason, frame_unwind::this_id, frame_unwind::type, frame_unwind::unwind_data, and pyuw_gdbarch_data_type::unwinder_registered.

Referenced by gdbpy_initialize_unwind().

## ◆ pyuw_parse_register_id()

static int pyuw_parse_register_id | ( | struct gdbarch * | gdbarch,
|  | PyObject * | pyo_reg_id,
|  | int * | reg_num
| ) |  |
| static

Definition at line 104 of file py-unwind.c.

References gdb_py_int_as_long(), gdbpy_is_string(), gdbpy_obj_to_string(), user_reg_map_name_to_regnum(), and user_reg_map_regnum_to_name().

Referenced by pending_framepy_read_register(), and unwind_infopy_add_saved_register().

## ◆ pyuw_prev_register()

static struct value* pyuw_prev_register | ( | struct frame_info * | this_frame,
|  | void ** | cache_ptr,
|  | int | regnum
| ) |  |
| static

Definition at line 473 of file py-unwind.c.

References cached_reg::data, frame_unwind_got_bytes(), frame_unwind_got_optimized(), cached_reg::num, cached_frame_info::reg, cached_frame_info::reg_count, regnum, and TRACE_PY_UNWIND.

Referenced by pyuw_on_new_gdbarch().

## ◆ pyuw_sniffer()

static int pyuw_sniffer | ( | const struct frame_unwind * | self,
|  | struct frame_info * | this_frame,
|  | void ** | cache_ptr
| ) |  |
| static

Definition at line 494 of file py-unwind.c.

References _, current_language, cached_reg::data, error(), unwind_info_object::frame_id, cached_frame_info::frame_id, gdb_assert, gdb_python_module, cached_frame_info::gdbarch, gdbpy_print_stack(), gdb::ref_ptr< T, Policy >::get(), get_frame_pc(), get_frame_sp(), make_scoped_restore(), MAX_REGISTER_SIZE, cached_reg::num, paddress(), pending_frame_object_type, PyObject_GetAttrString, PyObject_HasAttrString, quit(), cached_frame_info::reg, cached_frame_info::reg_count, register_size(), TRACE_PY_UNWIND, TYPE_LENGTH, unwind_info_object_type, value_contents(), value_object_to_value(), value_type(), VEC_iterate, VEC_length, and xmalloc().

Referenced by pyuw_on_new_gdbarch().

## ◆ pyuw_this_id()

static void pyuw_this_id | ( | struct frame_info * | this_frame,
|  | void ** | cache_ptr,
|  | struct frame_id * | this_id
| ) |  |
| static

Definition at line 458 of file py-unwind.c.

References fprint_frame_id(), fprintf_unfiltered(), gdb_stdlog, and pyuw_debug.

Referenced by pyuw_on_new_gdbarch().

## ◆ pyuw_value_obj_to_pointer()

static int pyuw_value_obj_to_pointer | ( | PyObject * | pyo_value,
|  | CORE_ADDR * | addr
| ) |  |
| static

Definition at line 135 of file py-unwind.c.

References CATCH, END_CATCH, gdbpy_convert_exception(), RETURN_MASK_ALL, TRY, unpack_pointer(), value_contents(), value_object_to_value(), and value_type().

Referenced by pyuw_object_attribute_to_pointer().

## ◆ unwind_infopy_add_saved_register()

static PyObject* unwind_infopy_add_saved_register | ( | PyObject * | self,
|  | PyObject * | args
| ) |  |
| static

Definition at line 260 of file py-unwind.c.

References pending_frame_object::frame_info, pending_frame_object::gdbarch, unwind_info_object::pending_frame, Py_DECREF, pyuw_parse_register_id(), value::reg, register_size(), regnum, TYPE_LENGTH, value_object_to_value(), value_type(), VEC_iterate, and VEC_safe_push.

## ◆ unwind_infopy_dealloc()

static void unwind_infopy_dealloc | ( | PyObject * | self | ) |
| static

Definition at line 331 of file py-unwind.c.

References unwind_info_object::pending_frame, Py_DECREF, Py_TYPE, value::reg, VEC_free, and VEC_iterate.

## ◆ unwind_infopy_str()

static PyObject* unwind_infopy_str | ( | PyObject * | self | ) |
| static

Definition at line 190 of file py-unwind.c.

References string_file::c_str(), CATCH, END_CATCH, fprint_frame_id(), unwind_info_object::frame_id, GDB_PY_HANDLE_EXCEPTION, get_user_print_options(), ui_file::printf(), ui_file::puts(), RETURN_MASK_ALL, TRY, value_object_to_value(), value_print(), and VEC_iterate.

## Variable Documentation

## ◆ pending_frame_object_methods

PyMethodDef pending_frame_object_methods[]
| static

Initial value:
=
{
{ "read_register", pending_framepy_read_register, METH_VARARGS,
"read_register (REG) -> gdb.Value\n"
"Return the value of the REG in the frame." },
{ "create_unwind_info",
pending_framepy_create_unwind_info, METH_VARARGS,
"create_unwind_info (FRAME_ID) -> gdb.UnwindInfo\n"
"Construct UnwindInfo for this PendingFrame, using FRAME_ID\n"
"to identify it." },
{NULL}
}
pending_framepy_create_unwind_info
static PyObject * pending_framepy_create_unwind_info(PyObject *self, PyObject *args)
Definition: py-unwind.c:421
pending_framepy_read_register
static PyObject * pending_framepy_read_register(PyObject *self, PyObject *args)
Definition: py-unwind.c:374

Definition at line 681 of file py-unwind.c.

## ◆ pending_frame_object_type

PyTypeObject pending_frame_object_type

Definition at line 694 of file py-unwind.c.

Referenced by gdbpy_initialize_unwind(), and pyuw_sniffer().

## ◆ pyuw_debug

unsigned int pyuw_debug = 0
| static

Definition at line 96 of file py-unwind.c.

Referenced by gdbpy_initialize_unwind(), and pyuw_this_id().

## ◆ pyuw_gdbarch_data

struct gdbarch_data* pyuw_gdbarch_data
| static

Definition at line 98 of file py-unwind.c.

Referenced by gdbpy_initialize_unwind(), and pyuw_on_new_gdbarch().

## ◆ unwind_info_object_methods

PyMethodDef unwind_info_object_methods[]
| static

Initial value:
=
{
{ "add_saved_register",
unwind_infopy_add_saved_register, METH_VARARGS,
"add_saved_register (REG, VALUE) -> None\n"
"Set the value of the REG in the previous frame to VALUE." },
{ NULL }
}
unwind_infopy_add_saved_register
static PyObject * unwind_infopy_add_saved_register(PyObject *self, PyObject *args)
Definition: py-unwind.c:260

Definition at line 735 of file py-unwind.c.

## ◆ unwind_info_object_type

PyTypeObject unwind_info_object_type

Definition at line 744 of file py-unwind.c.

Referenced by gdbpy_initialize_unwind(), pyuw_create_unwind_info(), and pyuw_sniffer().