GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
py-block.c File Reference
#include "defs.h"
#include "block.h"
#include "dictionary.h"
#include "symtab.h"
#include "python-internal.h"
#include "objfiles.h"

Go to the source code of this file.

Classes

struct  block_object
 
struct  block_syms_iterator_object
 
struct  blpy_deleter
 

Macros

#define BLPY_REQUIRE_VALID(block_obj, block)
 
#define BLPY_ITER_REQUIRE_VALID(block_obj)
 

Functions

PyTypeObject block_syms_iterator_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object")
 
static PyObjectblpy_iter (PyObject *self)
 
static PyObjectblpy_get_start (PyObject *self, void *closure)
 
static PyObjectblpy_get_end (PyObject *self, void *closure)
 
static PyObjectblpy_get_function (PyObject *self, void *closure)
 
static PyObjectblpy_get_superblock (PyObject *self, void *closure)
 
static PyObjectblpy_get_global_block (PyObject *self, void *closure)
 
static PyObjectblpy_get_static_block (PyObject *self, void *closure)
 
static PyObjectblpy_is_global (PyObject *self, void *closure)
 
static PyObjectblpy_is_static (PyObject *self, void *closure)
 
static PyObjectblpy_getitem (PyObject *self, PyObject *key)
 
static void blpy_dealloc (PyObject *obj)
 
static void set_block (block_object *obj, const struct block *block, struct objfile *objfile)
 
PyObjectblock_to_block_object (const struct block *block, struct objfile *objfile)
 
const struct blockblock_object_to_block (PyObject *obj)
 
static PyObjectblpy_block_syms_iter (PyObject *self)
 
static PyObjectblpy_block_syms_iternext (PyObject *self)
 
static void blpy_block_syms_dealloc (PyObject *obj)
 
static PyObjectblpy_is_valid (PyObject *self, PyObject *args)
 
static PyObjectblpy_iter_is_valid (PyObject *self, PyObject *args)
 
static PyObjectblpy_repr (PyObject *self)
 
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_blocks (void)
 
 GDBPY_INITIALIZE_FILE (gdbpy_initialize_blocks)
 

Variables

static const registry< objfile >::key< block_object, blpy_deleterblpy_objfile_data_key
 
static PyMethodDef block_object_methods []
 
static gdb_PyGetSetDef block_object_getset []
 
static PyMappingMethods block_object_as_mapping
 
PyTypeObject block_object_type
 
static PyMethodDef block_iterator_object_methods []
 
PyTypeObject block_syms_iterator_object_type
 

Macro Definition Documentation

◆ BLPY_ITER_REQUIRE_VALID

#define BLPY_ITER_REQUIRE_VALID ( block_obj)
Value:
do { \
if (block_obj->block == NULL) \
{ \
PyErr_SetString (PyExc_RuntimeError, \
_("Source block for iterator is invalid.")); \
return NULL; \
} \
} while (0)

Definition at line 70 of file py-block.c.

Referenced by blpy_block_syms_iter(), and blpy_block_syms_iternext().

◆ BLPY_REQUIRE_VALID

#define BLPY_REQUIRE_VALID ( block_obj,
block )
Value:
do { \
block = block_object_to_block (block_obj); \
if (block == NULL) \
{ \
PyErr_SetString (PyExc_RuntimeError, \
_("Block is invalid.")); \
return NULL; \
} \
} while (0)
const struct block * block_object_to_block(PyObject *obj)
Definition py-block.c:336
Definition block.h:109

Definition at line 57 of file py-block.c.

Referenced by blpy_get_end(), blpy_get_function(), blpy_get_global_block(), blpy_get_start(), blpy_get_static_block(), blpy_get_superblock(), blpy_getitem(), blpy_is_global(), blpy_is_static(), and blpy_iter().

Function Documentation

◆ block_object_to_block()

const struct block * block_object_to_block ( PyObject * obj)

◆ block_to_block_object()

PyObject * block_to_block_object ( const struct block * block,
struct objfile * objfile )

◆ blpy_block_syms_dealloc()

static void blpy_block_syms_dealloc ( PyObject * obj)
static

Definition at line 383 of file py-block.c.

References block_syms_iterator_object::source.

◆ blpy_block_syms_iter()

static PyObject * blpy_block_syms_iter ( PyObject * self)
static

Definition at line 345 of file py-block.c.

References BLPY_ITER_REQUIRE_VALID, and block_syms_iterator_object::source.

◆ blpy_block_syms_iternext()

static PyObject * blpy_block_syms_iternext ( PyObject * self)
static

◆ blpy_dealloc()

static void blpy_dealloc ( PyObject * obj)
static

Definition at line 283 of file py-block.c.

References blpy_objfile_data_key, block::objfile(), and registry< T >::set().

◆ blpy_get_end()

static PyObject * blpy_get_end ( PyObject * self,
void * closure )
static

Definition at line 140 of file py-block.c.

References BLPY_REQUIRE_VALID, block::end(), and gdb_py_object_from_ulongest().

◆ blpy_get_function()

static PyObject * blpy_get_function ( PyObject * self,
void * closure )
static

Definition at line 150 of file py-block.c.

References BLPY_REQUIRE_VALID, block::function(), and symbol_to_symbol_object().

◆ blpy_get_global_block()

static PyObject * blpy_get_global_block ( PyObject * self,
void * closure )
static

◆ blpy_get_start()

static PyObject * blpy_get_start ( PyObject * self,
void * closure )
static

Definition at line 130 of file py-block.c.

References BLPY_REQUIRE_VALID, gdb_py_object_from_ulongest(), and block::start().

◆ blpy_get_static_block()

static PyObject * blpy_get_static_block ( PyObject * self,
void * closure )
static

◆ blpy_get_superblock()

static PyObject * blpy_get_superblock ( PyObject * self,
void * closure )
static

◆ blpy_getitem()

static PyObject * blpy_getitem ( PyObject * self,
PyObject * key )
static

◆ blpy_is_global()

static PyObject * blpy_is_global ( PyObject * self,
void * closure )
static

Definition at line 222 of file py-block.c.

References BLPY_REQUIRE_VALID, and block::superblock().

◆ blpy_is_static()

static PyObject * blpy_is_static ( PyObject * self,
void * closure )
static

Definition at line 238 of file py-block.c.

References BLPY_REQUIRE_VALID, and block::superblock().

◆ blpy_is_valid()

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

Definition at line 395 of file py-block.c.

References block_object_to_block().

◆ blpy_iter()

static PyObject * blpy_iter ( PyObject * self)
static

◆ blpy_iter_is_valid()

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

Definition at line 410 of file py-block.c.

References block_object::block, and block_syms_iterator_object::source.

◆ blpy_repr()

static PyObject * blpy_repr ( PyObject * self)
static

◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject block_syms_iterator_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "block_syms_iterator_object" )
extern

◆ gdbpy_initialize_blocks()

static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_blocks ( void )
static

◆ GDBPY_INITIALIZE_FILE()

GDBPY_INITIALIZE_FILE ( gdbpy_initialize_blocks )

◆ set_block()

static void set_block ( block_object * obj,
const struct block * block,
struct objfile * objfile )
static

Variable Documentation

◆ block_iterator_object_methods

PyMethodDef block_iterator_object_methods[]
static
Initial value:
= {
{ "is_valid", blpy_iter_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return true if this block iterator is valid, false if not." },
{NULL}
}
static PyObject * blpy_iter_is_valid(PyObject *self, PyObject *args)
Definition py-block.c:410

Definition at line 543 of file py-block.c.

◆ block_object_as_mapping

PyMappingMethods block_object_as_mapping
static
Initial value:
= {
NULL,
NULL
}
static PyObject * blpy_getitem(PyObject *self, PyObject *key)
Definition py-block.c:256

Definition at line 504 of file py-block.c.

◆ block_object_getset

gdb_PyGetSetDef block_object_getset[]
static
Initial value:
= {
{ "start", blpy_get_start, NULL, "Start address of the block.", NULL },
{ "end", blpy_get_end, NULL, "End address of the block.", NULL },
{ "function", blpy_get_function, NULL,
"Symbol that names the block, or None.", NULL },
{ "superblock", blpy_get_superblock, NULL,
"Block containing the block, or None.", NULL },
{ "global_block", blpy_get_global_block, NULL,
"Block containing the global block.", NULL },
{ "static_block", blpy_get_static_block, NULL,
"Block containing the static block.", NULL },
{ "is_static", blpy_is_static, NULL,
"Whether this block is a static block.", NULL },
{ "is_global", blpy_is_global, NULL,
"Whether this block is a global block.", NULL },
{ NULL }
}
static PyObject * blpy_get_static_block(PyObject *self, void *closure)
Definition py-block.c:202
static PyObject * blpy_get_global_block(PyObject *self, void *closure)
Definition py-block.c:183
static PyObject * blpy_is_global(PyObject *self, void *closure)
Definition py-block.c:222
static PyObject * blpy_get_function(PyObject *self, void *closure)
Definition py-block.c:150
static PyObject * blpy_get_start(PyObject *self, void *closure)
Definition py-block.c:130
static PyObject * blpy_get_end(PyObject *self, void *closure)
Definition py-block.c:140
static PyObject * blpy_get_superblock(PyObject *self, void *closure)
Definition py-block.c:165
static PyObject * blpy_is_static(PyObject *self, void *closure)
Definition py-block.c:238

Definition at line 486 of file py-block.c.

◆ block_object_methods

PyMethodDef block_object_methods[]
static
Initial value:
= {
{ "is_valid", blpy_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return true if this block is valid, false if not." },
{NULL}
}
static PyObject * blpy_is_valid(PyObject *self, PyObject *args)
Definition py-block.c:395

Definition at line 479 of file py-block.c.

◆ block_object_type

PyTypeObject block_object_type

◆ block_syms_iterator_object_type

PyTypeObject block_syms_iterator_object_type
Initial value:
= {
PyVarObject_HEAD_INIT (NULL, 0)
"gdb.BlockIterator",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
Py_TPFLAGS_DEFAULT,
"GDB block syms iterator object",
0,
0,
0,
0,
}
static PyObject * blpy_block_syms_iter(PyObject *self)
Definition py-block.c:345
static PyMethodDef block_iterator_object_methods[]
Definition py-block.c:543
static PyObject * blpy_block_syms_iternext(PyObject *self)
Definition py-block.c:358
static void blpy_block_syms_dealloc(PyObject *obj)
Definition py-block.c:383

Definition at line 550 of file py-block.c.

Referenced by blpy_iter(), and gdbpy_initialize_blocks().

◆ blpy_objfile_data_key

const registry<objfile>::key<block_object, blpy_deleter> blpy_objfile_data_key
static

Definition at line 106 of file py-block.c.

Referenced by blpy_dealloc(), and set_block().