GDB (xrefs)
Classes | Macros | Typedefs | 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  blpy_block_object
 
struct  block_syms_iterator_object
 

Macros

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

Typedefs

typedef struct blpy_block_object block_object
 

Functions

PyTypeObject block_syms_iterator_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object")
 
static PyObject * blpy_iter (PyObject *self)
 
static PyObject * blpy_get_start (PyObject *self, void *closure)
 
static PyObject * blpy_get_end (PyObject *self, void *closure)
 
static PyObject * blpy_get_function (PyObject *self, void *closure)
 
static PyObject * blpy_get_superblock (PyObject *self, void *closure)
 
static PyObject * blpy_get_global_block (PyObject *self, void *closure)
 
static PyObject * blpy_get_static_block (PyObject *self, void *closure)
 
static PyObject * blpy_is_global (PyObject *self, void *closure)
 
static PyObject * blpy_is_static (PyObject *self, void *closure)
 
static void blpy_dealloc (PyObject *obj)
 
static void set_block (block_object *obj, const struct block *block, struct objfile *objfile)
 
PyObject * block_to_block_object (const struct block *block, struct objfile *objfile)
 
const struct blockblock_object_to_block (PyObject *obj)
 
static PyObject * blpy_block_syms_iter (PyObject *self)
 
static PyObject * blpy_block_syms_iternext (PyObject *self)
 
static void blpy_block_syms_dealloc (PyObject *obj)
 
static PyObject * blpy_is_valid (PyObject *self, PyObject *args)
 
static PyObject * blpy_iter_is_valid (PyObject *self, PyObject *args)
 
PyObject * gdbpy_block_for_pc (PyObject *self, PyObject *args)
 
static void del_objfile_blocks (struct objfile *objfile, void *datum)
 
int gdbpy_initialize_blocks (void)
 

Variables

static const struct objfile_data * blpy_objfile_data_key
 
static PyMethodDef block_object_methods []
 
static PyGetSetDef block_object_getset []
 
PyTypeObject block_object_type
 
static PyMethodDef block_iterator_object_methods []
 
PyTypeObject block_syms_iterator_object_type
 

Macro Definition Documentation

#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)
#define _(String)
Definition: gdb_locale.h:40
return
Definition: gnu-nat.c:1865

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

Referenced by blpy_block_syms_iter(), and blpy_block_syms_iternext().

#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)
#define _(String)
Definition: gdb_locale.h:40
const struct block * block_object_to_block(PyObject *obj)
Definition: py-block.c:284
Definition: block.h:60
return
Definition: gnu-nat.c:1865

Definition at line 58 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_is_global(), blpy_is_static(), and blpy_iter().

Typedef Documentation

Function Documentation

const struct block* block_object_to_block ( PyObject *  obj)
PyObject* block_to_block_object ( const struct block block,
struct objfile objfile 
)
static void blpy_block_syms_dealloc ( PyObject *  obj)
static

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

References block_syms_iterator_object::source.

static PyObject* blpy_block_syms_iter ( PyObject *  self)
static

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

References BLPY_ITER_REQUIRE_VALID, and block_syms_iterator_object::source.

static PyObject* blpy_block_syms_iternext ( PyObject *  self)
static
static void blpy_dealloc ( PyObject *  obj)
static
static PyObject* blpy_get_end ( PyObject *  self,
void *  closure 
)
static

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

References BLOCK_END, BLPY_REQUIRE_VALID, and gdb_py_object_from_ulongest().

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

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

References BLOCK_FUNCTION, BLPY_REQUIRE_VALID, and symbol_to_symbol_object().

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

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

References BLOCK_START, BLPY_REQUIRE_VALID, and gdb_py_object_from_ulongest().

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

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

References BLOCK_SUPERBLOCK, and BLPY_REQUIRE_VALID.

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

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

References BLOCK_SUPERBLOCK, and BLPY_REQUIRE_VALID.

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

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

References block_object_to_block().

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

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

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

PyTypeObject block_syms_iterator_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "block_syms_iterator_object"  )
static void del_objfile_blocks ( struct objfile objfile,
void *  datum 
)
static
PyObject* gdbpy_block_for_pc ( PyObject *  self,
PyObject *  args 
)
int gdbpy_initialize_blocks ( void  )
static void set_block ( block_object obj,
const struct block block,
struct objfile objfile 
)
static

Variable Documentation

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:357

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

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_global_block(PyObject *self, void *closure)
Definition: py-block.c:160
static PyObject * blpy_get_end(PyObject *self, void *closure)
Definition: py-block.c:117
static PyObject * blpy_is_static(PyObject *self, void *closure)
Definition: py-block.c:215
static PyObject * blpy_get_function(PyObject *self, void *closure)
Definition: py-block.c:127
static PyObject * blpy_get_superblock(PyObject *self, void *closure)
Definition: py-block.c:142
static PyObject * blpy_get_static_block(PyObject *self, void *closure)
Definition: py-block.c:179
static PyObject * blpy_get_start(PyObject *self, void *closure)
Definition: py-block.c:107
static PyObject * blpy_is_global(PyObject *self, void *closure)
Definition: py-block.c:199

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

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:342

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

PyTypeObject block_object_type
PyTypeObject block_syms_iterator_object_type
Initial value:
= {
"gdb.BlockIterator",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER,
"GDB block syms iterator object",
0,
0,
0,
0,
}
static PyObject * blpy_block_syms_iter(PyObject *self)
Definition: py-block.c:293
static PyMethodDef block_iterator_object_methods[]
Definition: py-block.c:514
static PyObject * blpy_block_syms_iternext(PyObject *self)
Definition: py-block.c:306
static void blpy_block_syms_dealloc(PyObject *obj)
Definition: py-block.c:331
#define PyVarObject_HEAD_INIT(type, size)

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

Referenced by blpy_iter(), and gdbpy_initialize_blocks().

const struct objfile_data* blpy_objfile_data_key
static

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

Referenced by blpy_dealloc(), gdbpy_initialize_blocks(), and set_block().