57#define BLPY_REQUIRE_VALID(block_obj, block) \
59 block = block_object_to_block (block_obj); \
62 PyErr_SetString (PyExc_RuntimeError, \
63 _("Block is invalid.")); \
70#define BLPY_ITER_REQUIRE_VALID(block_obj) \
72 if (block_obj->block == NULL) \
74 PyErr_SetString (PyExc_RuntimeError, \
75 _("Source block for iterator is invalid.")); \
118 if (block_iter_obj == NULL)
168 const struct block *super_block;
278 PyErr_SetObject (PyExc_KeyError, key);
294 Py_TYPE (obj)->tp_free (obj);
375 PyErr_SetString (PyExc_StopIteration, _(
"Symbol is null."));
387 Py_XDECREF (iter_obj->
source);
388 Py_TYPE (obj)->tp_free (obj);
427 if (
block ==
nullptr)
428 return PyUnicode_FromFormat (
"<%s (invalid)>", Py_TYPE (self)->tp_name);
434 unsigned int written_symbols = 0;
436 static constexpr int SYMBOLS_TO_SHOW = 5;
439 if (written_symbols == SYMBOLS_TO_SHOW)
441 const int remaining = len - SYMBOLS_TO_SHOW;
443 str += string_printf (
"... (%d more symbol)", remaining);
445 str += string_printf (
"... (%d more symbols)", remaining);
449 if (++written_symbols < len)
452 return PyUnicode_FromFormat (
"<%s %s {%s}>", Py_TYPE (self)->tp_name,
481 "is_valid () -> Boolean.\n\
482Return true if this block is valid, false if not." },
487 {
"start",
blpy_get_start, NULL,
"Start address of the block.", NULL },
488 {
"end",
blpy_get_end, NULL,
"End address of the block.", NULL },
490 "Symbol that names the block, or None.", NULL },
492 "Block containing the block, or None.", NULL },
494 "Block containing the global block.", NULL },
496 "Block containing the static block.", NULL },
498 "Whether this block is a static block.", NULL },
500 "Whether this block is a global block.", NULL },
511 PyVarObject_HEAD_INIT (NULL, 0)
545 "is_valid () -> Boolean.\n\
546Return true if this block iterator is valid, false if not." },
551 PyVarObject_HEAD_INIT (NULL, 0)
571 "GDB block syms iterator object",
struct symbol * block_iterator_first(const struct block *block, struct block_iterator *iterator, const lookup_name_info *name)
struct symbol * block_iterator_next(struct block_iterator *iterator)
iterator_range< block_iterator_wrapper > block_iterator_range
void set(unsigned key, void *datum)
int mdict_size(const struct multidictionary *mdict)
static PyObject * blpy_getitem(PyObject *self, PyObject *key)
PyObject * block_to_block_object(const struct block *block, struct objfile *objfile)
static PyObject * blpy_get_static_block(PyObject *self, void *closure)
static PyObject * blpy_get_global_block(PyObject *self, void *closure)
PyTypeObject block_object_type
static void set_block(block_object *obj, const struct block *block, struct objfile *objfile)
static PyObject * blpy_block_syms_iter(PyObject *self)
static PyObject * blpy_is_valid(PyObject *self, PyObject *args)
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_blocks(void)
static PyMethodDef block_iterator_object_methods[]
static PyObject * blpy_is_global(PyObject *self, void *closure)
static PyObject * blpy_block_syms_iternext(PyObject *self)
static PyObject * blpy_get_function(PyObject *self, void *closure)
PyTypeObject block_syms_iterator_object_type
#define BLPY_REQUIRE_VALID(block_obj, block)
static PyMappingMethods block_object_as_mapping
static void blpy_dealloc(PyObject *obj)
static PyObject * blpy_get_start(PyObject *self, void *closure)
static PyObject * blpy_repr(PyObject *self)
static PyObject * blpy_get_end(PyObject *self, void *closure)
static gdb_PyGetSetDef block_object_getset[]
#define BLPY_ITER_REQUIRE_VALID(block_obj)
const struct block * block_object_to_block(PyObject *obj)
static PyObject * blpy_iter(PyObject *self)
static PyObject * blpy_get_superblock(PyObject *self, void *closure)
static PyObject * blpy_is_static(PyObject *self, void *closure)
static void blpy_block_syms_dealloc(PyObject *obj)
static PyObject * blpy_iter_is_valid(PyObject *self, PyObject *args)
static PyMethodDef block_object_methods[]
static const registry< objfile >::key< block_object, blpy_deleter > blpy_objfile_data_key
PyObject * symbol_to_symbol_object(struct symbol *sym)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
gdb::unique_xmalloc_ptr< char > python_string_to_host_string(PyObject *obj)
gdbpy_ref gdb_py_object_from_ulongest(ULONGEST l)
#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
#define GDBPY_INITIALIZE_FILE(INIT,...)
PyObject_HEAD const struct block * block
struct block_iterator iter
PyObject_HEAD const struct block * block
const block * superblock() const
multidictionary * multidict() const
const struct block * global_block() const
const struct block * static_block() const
symbol * function() const
struct objfile * objfile() const
void operator()(block_object *obj)
const char * print_name() const