GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
py-unwind.c File Reference
#include "defs.h"
#include "arch-utils.h"
#include "frame-unwind.h"
#include "gdbsupport/gdb_obstack.h"
#include "gdbcmd.h"
#include "language.h"
#include "observable.h"
#include "python-internal.h"
#include "regcache.h"
#include "valprint.h"
#include "user-regs.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 pyuw_debug_printf(fmt, ...)    debug_prefixed_printf_cond (pyuw_debug, "py-unwind", fmt, ##__VA_ARGS__)
 
#define PYUW_SCOPED_DEBUG_ENTER_EXIT    scoped_debug_enter_exit (pyuw_debug, "py-unwind")
 

Functions

static void show_pyuw_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
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_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 PyObjectunwind_infopy_str (PyObject *self)
 
static PyObjectpyuw_create_unwind_info (PyObject *pyo_pending_frame, struct frame_id frame_id)
 
static PyObjectunwind_infopy_add_saved_register (PyObject *self, PyObject *args)
 
static void unwind_infopy_dealloc (PyObject *self)
 
static PyObjectpending_framepy_str (PyObject *self)
 
static PyObjectpending_framepy_read_register (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_create_unwind_info (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_architecture (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_level (PyObject *self, PyObject *args)
 
static void pyuw_this_id (frame_info_ptr this_frame, void **cache_ptr, struct frame_id *this_id)
 
static struct valuepyuw_prev_register (frame_info_ptr this_frame, void **cache_ptr, int regnum)
 
static int pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame, void **cache_ptr)
 
static void pyuw_dealloc_cache (frame_info *this_frame, void *cache)
 
static void pyuw_on_new_gdbarch (struct gdbarch *newarch)
 
void _initialize_py_unwind ()
 
int gdbpy_initialize_unwind (void)
 

Variables

static bool pyuw_debug
 
static const registry< gdbarch >::key< pyuw_gdbarch_data_typepyuw_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

◆ pyuw_debug_printf

#define pyuw_debug_printf (   fmt,
  ... 
)     debug_prefixed_printf_cond (pyuw_debug, "py-unwind", fmt, ##__VA_ARGS__)

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

◆ PYUW_SCOPED_DEBUG_ENTER_EXIT

#define PYUW_SCOPED_DEBUG_ENTER_EXIT    scoped_debug_enter_exit (pyuw_debug, "py-unwind")

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

Function Documentation

◆ _initialize_py_unwind()

void _initialize_py_unwind ( )

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

Referenced by initialize_all_files().

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

◆ gdbpy_initialize_unwind()

int gdbpy_initialize_unwind ( void  )

◆ pending_framepy_architecture()

static PyObject * pending_framepy_architecture ( PyObject self,
PyObject args 
)
static

◆ pending_framepy_create_unwind_info()

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

◆ pending_framepy_level()

static PyObject * pending_framepy_level ( PyObject self,
PyObject args 
)
static

◆ pending_framepy_read_register()

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

◆ pending_framepy_str()

static PyObject * pending_framepy_str ( PyObject self)
static

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

References GDB_PY_HANDLE_EXCEPTION, get_frame_pc(), and get_frame_sp().

◆ pyuw_create_unwind_info()

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

◆ pyuw_dealloc_cache()

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

◆ 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 152 of file py-unwind.c.

References 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

◆ pyuw_prev_register()

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

◆ pyuw_sniffer()

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

◆ pyuw_this_id()

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

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

References pyuw_debug_printf, and frame_id::to_string().

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

◆ show_pyuw_debug()

static void show_pyuw_debug ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

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

References gdb_printf().

◆ unwind_infopy_add_saved_register()

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

◆ unwind_infopy_dealloc()

static void unwind_infopy_dealloc ( PyObject self)
static

◆ unwind_infopy_str()

static PyObject * unwind_infopy_str ( PyObject self)
static

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",
"create_unwind_info (FRAME_ID) -> gdb.UnwindInfo\n"
"Construct UnwindInfo for this PendingFrame, using FRAME_ID\n"
"to identify it." },
{ "architecture",
"architecture () -> gdb.Architecture\n"
"The architecture for this PendingFrame." },
{ "level", pending_framepy_level, METH_NOARGS,
"The stack level of this frame." },
{NULL}
}
static PyObject * pending_framepy_level(PyObject *self, PyObject *args)
Definition py-unwind.c:461
static PyObject * pending_framepy_read_register(PyObject *self, PyObject *args)
Definition py-unwind.c:365
static PyObject * pending_framepy_create_unwind_info(PyObject *self, PyObject *args)
Definition py-unwind.c:408
static PyObject * pending_framepy_architecture(PyObject *self, PyObject *args)
Definition py-unwind.c:445

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

◆ pending_frame_object_type

PyTypeObject pending_frame_object_type

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

Referenced by gdbpy_initialize_unwind(), and pyuw_sniffer().

◆ pyuw_debug

bool pyuw_debug
static

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

Referenced by pyuw_sniffer().

◆ pyuw_gdbarch_data

const registry<gdbarch>::key<pyuw_gdbarch_data_type> pyuw_gdbarch_data
static

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

Referenced by pyuw_on_new_gdbarch().

◆ unwind_info_object_methods

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

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

◆ unwind_info_object_type

PyTypeObject unwind_info_object_type

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

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