GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | 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"
#include "stack.h"
#include "charset.h"
#include "block.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")
 
#define PENDING_FRAMEPY_REQUIRE_VALID(pending_frame)
 

Enumerations

enum class  pyuw_get_attr_code { ATTR_OK , ATTR_MISSING , ATTR_ERROR }
 

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 pyuw_get_attr_code pyuw_object_attribute_to_pointer (PyObject *pyo, const char *attr_name, CORE_ADDR *addr)
 
static PyObjectunwind_infopy_str (PyObject *self)
 
static PyObjectunwind_infopy_repr (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, PyObject *kw)
 
static void unwind_infopy_dealloc (PyObject *self)
 
static PyObjectpending_framepy_str (PyObject *self)
 
static PyObjectpending_framepy_repr (PyObject *self)
 
static PyObjectpending_framepy_read_register (PyObject *self, PyObject *args, PyObject *kw)
 
static PyObjectpending_framepy_is_valid (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_name (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_pc (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_language (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_find_sal (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_block (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_function (PyObject *self, PyObject *args)
 
static PyObjectpending_framepy_create_unwind_info (PyObject *self, PyObject *args, PyObject *kw)
 
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)
 
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_unwind (void)
 
void _initialize_py_unwind ()
 
 GDBPY_INITIALIZE_FILE (gdbpy_initialize_unwind)
 

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

◆ PENDING_FRAMEPY_REQUIRE_VALID

#define PENDING_FRAMEPY_REQUIRE_VALID ( pending_frame)
Value:
do { \
if ((pending_frame)->frame_info == nullptr) \
{ \
PyErr_SetString (PyExc_ValueError, \
_("gdb.PendingFrame is invalid.")); \
return nullptr; \
} \
} while (0)

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

Referenced by pending_framepy_architecture(), pending_framepy_block(), pending_framepy_create_unwind_info(), pending_framepy_find_sal(), pending_framepy_function(), pending_framepy_language(), pending_framepy_level(), pending_framepy_name(), pending_framepy_pc(), and pending_framepy_read_register().

◆ pyuw_debug_printf

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

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

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

◆ PYUW_SCOPED_DEBUG_ENTER_EXIT

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

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

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

Enumeration Type Documentation

◆ pyuw_get_attr_code

enum class pyuw_get_attr_code
strong
Enumerator
ATTR_OK 
ATTR_MISSING 
ATTR_ERROR 

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

Function Documentation

◆ _initialize_py_unwind()

void _initialize_py_unwind ( )

Definition at line 995 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" )
extern

◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF() [2/2]

PyTypeObject unwind_info_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "unwind_info_object" )
extern

◆ GDBPY_INITIALIZE_FILE()

GDBPY_INITIALIZE_FILE ( gdbpy_initialize_unwind )

◆ gdbpy_initialize_unwind()

static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_unwind ( void )
static

◆ pending_framepy_architecture()

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

◆ pending_framepy_block()

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

◆ pending_framepy_create_unwind_info()

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

◆ pending_framepy_find_sal()

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

◆ pending_framepy_function()

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

◆ pending_framepy_is_valid()

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

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

References pending_frame_object::frame_info.

◆ pending_framepy_language()

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

◆ pending_framepy_level()

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

◆ pending_framepy_name()

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

◆ pending_framepy_pc()

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

◆ pending_framepy_read_register()

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

◆ pending_framepy_repr()

static PyObject * pending_framepy_repr ( PyObject * self)
static

◆ pending_framepy_str()

static PyObject * pending_framepy_str ( PyObject * self)
static

Definition at line 390 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 pyuw_get_attr_code pyuw_object_attribute_to_pointer ( PyObject * pyo,
const char * attr_name,
CORE_ADDR * addr )
static

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

References ATTR_ERROR, ATTR_MISSING, ATTR_OK, and get_addr_from_python().

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

References pyuw_debug_printf, and frame_id::to_string().

Referenced by pyuw_on_new_gdbarch().

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

References gdb_printf().

◆ unwind_infopy_add_saved_register()

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

◆ unwind_infopy_dealloc()

static void unwind_infopy_dealloc ( PyObject * self)
static

◆ unwind_infopy_repr()

static PyObject * unwind_infopy_repr ( 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

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

◆ pending_frame_object_type

PyTypeObject pending_frame_object_type

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

Referenced by gdbpy_initialize_unwind(), and pyuw_sniffer().

◆ pyuw_debug

bool pyuw_debug
static

Definition at line 38 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 942 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",
METH_VARARGS | METH_KEYWORDS,
"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, PyObject *kw)
Definition py-unwind.c:295

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

◆ unwind_info_object_type

PyTypeObject unwind_info_object_type

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

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