py-block.c revision 1.10 1 1.1 christos /* Python interface to blocks.
2 1.1 christos
3 1.10 christos Copyright (C) 2008-2023 Free Software Foundation, Inc.
4 1.1 christos
5 1.1 christos This file is part of GDB.
6 1.1 christos
7 1.1 christos This program is free software; you can redistribute it and/or modify
8 1.1 christos it under the terms of the GNU General Public License as published by
9 1.1 christos the Free Software Foundation; either version 3 of the License, or
10 1.1 christos (at your option) any later version.
11 1.1 christos
12 1.1 christos This program is distributed in the hope that it will be useful,
13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 1.1 christos GNU General Public License for more details.
16 1.1 christos
17 1.1 christos You should have received a copy of the GNU General Public License
18 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 1.1 christos
20 1.1 christos #include "defs.h"
21 1.1 christos #include "block.h"
22 1.1 christos #include "dictionary.h"
23 1.1 christos #include "symtab.h"
24 1.1 christos #include "python-internal.h"
25 1.1 christos #include "objfiles.h"
26 1.1 christos
27 1.10 christos struct block_object {
28 1.1 christos PyObject_HEAD
29 1.1 christos /* The GDB block structure that represents a frame's code block. */
30 1.1 christos const struct block *block;
31 1.1 christos /* The backing object file. There is no direct relationship in GDB
32 1.1 christos between a block and an object file. When a block is created also
33 1.1 christos store a pointer to the object file for later use. */
34 1.1 christos struct objfile *objfile;
35 1.1 christos /* Keep track of all blocks with a doubly-linked list. Needed for
36 1.1 christos block invalidation if the source object file has been freed. */
37 1.10 christos block_object *prev;
38 1.10 christos block_object *next;
39 1.10 christos };
40 1.1 christos
41 1.10 christos struct block_syms_iterator_object {
42 1.1 christos PyObject_HEAD
43 1.1 christos /* The block. */
44 1.1 christos const struct block *block;
45 1.1 christos /* The iterator for that block. */
46 1.1 christos struct block_iterator iter;
47 1.1 christos /* Has the iterator been initialized flag. */
48 1.1 christos int initialized_p;
49 1.1 christos /* Pointer back to the original source block object. Needed to
50 1.1 christos check if the block is still valid, and has not been invalidated
51 1.1 christos when an object file has been freed. */
52 1.10 christos block_object *source;
53 1.10 christos };
54 1.1 christos
55 1.1 christos /* Require a valid block. All access to block_object->block should be
56 1.1 christos gated by this call. */
57 1.1 christos #define BLPY_REQUIRE_VALID(block_obj, block) \
58 1.1 christos do { \
59 1.1 christos block = block_object_to_block (block_obj); \
60 1.1 christos if (block == NULL) \
61 1.1 christos { \
62 1.1 christos PyErr_SetString (PyExc_RuntimeError, \
63 1.1 christos _("Block is invalid.")); \
64 1.1 christos return NULL; \
65 1.1 christos } \
66 1.1 christos } while (0)
67 1.1 christos
68 1.1 christos /* Require a valid block. This macro is called during block iterator
69 1.1 christos creation, and at each next call. */
70 1.1 christos #define BLPY_ITER_REQUIRE_VALID(block_obj) \
71 1.1 christos do { \
72 1.1 christos if (block_obj->block == NULL) \
73 1.1 christos { \
74 1.1 christos PyErr_SetString (PyExc_RuntimeError, \
75 1.1 christos _("Source block for iterator is invalid.")); \
76 1.1 christos return NULL; \
77 1.1 christos } \
78 1.1 christos } while (0)
79 1.1 christos
80 1.10 christos /* This is called when an objfile is about to be freed.
81 1.10 christos Invalidate the block as further actions on the block would result
82 1.10 christos in bad data. All access to obj->symbol should be gated by
83 1.10 christos BLPY_REQUIRE_VALID which will raise an exception on invalid
84 1.10 christos blocks. */
85 1.10 christos struct blpy_deleter
86 1.10 christos {
87 1.10 christos void operator() (block_object *obj)
88 1.10 christos {
89 1.10 christos while (obj)
90 1.10 christos {
91 1.10 christos block_object *next = obj->next;
92 1.10 christos
93 1.10 christos obj->block = NULL;
94 1.10 christos obj->objfile = NULL;
95 1.10 christos obj->next = NULL;
96 1.10 christos obj->prev = NULL;
97 1.10 christos
98 1.10 christos obj = next;
99 1.10 christos }
100 1.10 christos }
101 1.10 christos };
102 1.10 christos
103 1.5 christos extern PyTypeObject block_syms_iterator_object_type
104 1.1 christos CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
105 1.10 christos static const registry<objfile>::key<block_object, blpy_deleter>
106 1.10 christos blpy_objfile_data_key;
107 1.1 christos
108 1.1 christos static PyObject *
109 1.1 christos blpy_iter (PyObject *self)
110 1.1 christos {
111 1.1 christos block_syms_iterator_object *block_iter_obj;
112 1.1 christos const struct block *block = NULL;
113 1.1 christos
114 1.1 christos BLPY_REQUIRE_VALID (self, block);
115 1.1 christos
116 1.1 christos block_iter_obj = PyObject_New (block_syms_iterator_object,
117 1.1 christos &block_syms_iterator_object_type);
118 1.1 christos if (block_iter_obj == NULL)
119 1.1 christos return NULL;
120 1.1 christos
121 1.1 christos block_iter_obj->block = block;
122 1.1 christos block_iter_obj->initialized_p = 0;
123 1.1 christos Py_INCREF (self);
124 1.1 christos block_iter_obj->source = (block_object *) self;
125 1.1 christos
126 1.1 christos return (PyObject *) block_iter_obj;
127 1.1 christos }
128 1.1 christos
129 1.1 christos static PyObject *
130 1.1 christos blpy_get_start (PyObject *self, void *closure)
131 1.1 christos {
132 1.1 christos const struct block *block = NULL;
133 1.1 christos
134 1.1 christos BLPY_REQUIRE_VALID (self, block);
135 1.1 christos
136 1.10 christos return gdb_py_object_from_ulongest (block->start ()).release ();
137 1.1 christos }
138 1.1 christos
139 1.1 christos static PyObject *
140 1.1 christos blpy_get_end (PyObject *self, void *closure)
141 1.1 christos {
142 1.1 christos const struct block *block = NULL;
143 1.1 christos
144 1.1 christos BLPY_REQUIRE_VALID (self, block);
145 1.1 christos
146 1.10 christos return gdb_py_object_from_ulongest (block->end ()).release ();
147 1.1 christos }
148 1.1 christos
149 1.1 christos static PyObject *
150 1.1 christos blpy_get_function (PyObject *self, void *closure)
151 1.1 christos {
152 1.1 christos struct symbol *sym;
153 1.1 christos const struct block *block;
154 1.1 christos
155 1.1 christos BLPY_REQUIRE_VALID (self, block);
156 1.1 christos
157 1.10 christos sym = block->function ();
158 1.1 christos if (sym)
159 1.1 christos return symbol_to_symbol_object (sym);
160 1.1 christos
161 1.1 christos Py_RETURN_NONE;
162 1.1 christos }
163 1.1 christos
164 1.1 christos static PyObject *
165 1.1 christos blpy_get_superblock (PyObject *self, void *closure)
166 1.1 christos {
167 1.1 christos const struct block *block;
168 1.1 christos const struct block *super_block;
169 1.1 christos block_object *self_obj = (block_object *) self;
170 1.1 christos
171 1.1 christos BLPY_REQUIRE_VALID (self, block);
172 1.1 christos
173 1.10 christos super_block = block->superblock ();
174 1.1 christos if (super_block)
175 1.1 christos return block_to_block_object (super_block, self_obj->objfile);
176 1.1 christos
177 1.1 christos Py_RETURN_NONE;
178 1.1 christos }
179 1.1 christos
180 1.1 christos /* Return the global block associated to this block. */
181 1.1 christos
182 1.1 christos static PyObject *
183 1.1 christos blpy_get_global_block (PyObject *self, void *closure)
184 1.1 christos {
185 1.1 christos const struct block *block;
186 1.1 christos const struct block *global_block;
187 1.1 christos block_object *self_obj = (block_object *) self;
188 1.1 christos
189 1.1 christos BLPY_REQUIRE_VALID (self, block);
190 1.1 christos
191 1.1 christos global_block = block_global_block (block);
192 1.1 christos
193 1.1 christos return block_to_block_object (global_block,
194 1.1 christos self_obj->objfile);
195 1.1 christos
196 1.1 christos }
197 1.1 christos
198 1.1 christos /* Return the static block associated to this block. Return None
199 1.1 christos if we cannot get the static block (this is the global block). */
200 1.1 christos
201 1.1 christos static PyObject *
202 1.1 christos blpy_get_static_block (PyObject *self, void *closure)
203 1.1 christos {
204 1.1 christos const struct block *block;
205 1.1 christos const struct block *static_block;
206 1.1 christos block_object *self_obj = (block_object *) self;
207 1.1 christos
208 1.1 christos BLPY_REQUIRE_VALID (self, block);
209 1.1 christos
210 1.10 christos if (block->superblock () == NULL)
211 1.1 christos Py_RETURN_NONE;
212 1.1 christos
213 1.1 christos static_block = block_static_block (block);
214 1.1 christos
215 1.1 christos return block_to_block_object (static_block, self_obj->objfile);
216 1.1 christos }
217 1.1 christos
218 1.1 christos /* Implementation of gdb.Block.is_global (self) -> Boolean.
219 1.1 christos Returns True if this block object is a global block. */
220 1.1 christos
221 1.1 christos static PyObject *
222 1.1 christos blpy_is_global (PyObject *self, void *closure)
223 1.1 christos {
224 1.1 christos const struct block *block;
225 1.1 christos
226 1.1 christos BLPY_REQUIRE_VALID (self, block);
227 1.1 christos
228 1.10 christos if (block->superblock ())
229 1.1 christos Py_RETURN_FALSE;
230 1.1 christos
231 1.1 christos Py_RETURN_TRUE;
232 1.1 christos }
233 1.1 christos
234 1.1 christos /* Implementation of gdb.Block.is_static (self) -> Boolean.
235 1.1 christos Returns True if this block object is a static block. */
236 1.1 christos
237 1.1 christos static PyObject *
238 1.1 christos blpy_is_static (PyObject *self, void *closure)
239 1.1 christos {
240 1.1 christos const struct block *block;
241 1.1 christos
242 1.1 christos BLPY_REQUIRE_VALID (self, block);
243 1.1 christos
244 1.10 christos if (block->superblock () != NULL
245 1.10 christos && block->superblock ()->superblock () == NULL)
246 1.1 christos Py_RETURN_TRUE;
247 1.1 christos
248 1.1 christos Py_RETURN_FALSE;
249 1.1 christos }
250 1.1 christos
251 1.9 christos /* Given a string, returns the gdb.Symbol representing that symbol in this
252 1.9 christos block. If such a symbol does not exist, returns NULL with a Python
253 1.9 christos exception. */
254 1.9 christos
255 1.9 christos static PyObject *
256 1.9 christos blpy_getitem (PyObject *self, PyObject *key)
257 1.9 christos {
258 1.9 christos const struct block *block;
259 1.9 christos
260 1.9 christos BLPY_REQUIRE_VALID (self, block);
261 1.9 christos
262 1.9 christos gdb::unique_xmalloc_ptr<char> name = python_string_to_host_string (key);
263 1.9 christos if (name == nullptr)
264 1.9 christos return nullptr;
265 1.9 christos
266 1.9 christos lookup_name_info lookup_name (name.get(), symbol_name_match_type::FULL);
267 1.9 christos
268 1.9 christos /* We use ALL_BLOCK_SYMBOLS_WITH_NAME instead of block_lookup_symbol so
269 1.9 christos that we can look up symbols irrespective of the domain, matching the
270 1.9 christos iterator. It would be confusing if the iterator returns symbols you
271 1.9 christos can't find via getitem. */
272 1.9 christos struct block_iterator iter;
273 1.9 christos struct symbol *sym = nullptr;
274 1.9 christos ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym)
275 1.9 christos {
276 1.9 christos /* Just stop at the first match */
277 1.9 christos break;
278 1.9 christos }
279 1.9 christos
280 1.9 christos if (sym == nullptr)
281 1.9 christos {
282 1.9 christos PyErr_SetObject (PyExc_KeyError, key);
283 1.9 christos return nullptr;
284 1.9 christos }
285 1.9 christos return symbol_to_symbol_object (sym);
286 1.9 christos }
287 1.9 christos
288 1.1 christos static void
289 1.1 christos blpy_dealloc (PyObject *obj)
290 1.1 christos {
291 1.1 christos block_object *block = (block_object *) obj;
292 1.1 christos
293 1.1 christos if (block->prev)
294 1.1 christos block->prev->next = block->next;
295 1.1 christos else if (block->objfile)
296 1.10 christos blpy_objfile_data_key.set (block->objfile, block->next);
297 1.1 christos if (block->next)
298 1.1 christos block->next->prev = block->prev;
299 1.1 christos block->block = NULL;
300 1.9 christos Py_TYPE (obj)->tp_free (obj);
301 1.1 christos }
302 1.1 christos
303 1.1 christos /* Given a block, and a block_object that has previously been
304 1.1 christos allocated and initialized, populate the block_object with the
305 1.1 christos struct block data. Also, register the block_object life-cycle
306 1.1 christos with the life-cycle of the object file associated with this
307 1.1 christos block, if needed. */
308 1.1 christos static void
309 1.1 christos set_block (block_object *obj, const struct block *block,
310 1.1 christos struct objfile *objfile)
311 1.1 christos {
312 1.1 christos obj->block = block;
313 1.1 christos obj->prev = NULL;
314 1.1 christos if (objfile)
315 1.1 christos {
316 1.1 christos obj->objfile = objfile;
317 1.10 christos obj->next = blpy_objfile_data_key.get (objfile);
318 1.1 christos if (obj->next)
319 1.1 christos obj->next->prev = obj;
320 1.10 christos blpy_objfile_data_key.set (objfile, obj);
321 1.1 christos }
322 1.1 christos else
323 1.1 christos obj->next = NULL;
324 1.1 christos }
325 1.1 christos
326 1.1 christos /* Create a new block object (gdb.Block) that encapsulates the struct
327 1.1 christos block object from GDB. */
328 1.1 christos PyObject *
329 1.1 christos block_to_block_object (const struct block *block, struct objfile *objfile)
330 1.1 christos {
331 1.1 christos block_object *block_obj;
332 1.1 christos
333 1.1 christos block_obj = PyObject_New (block_object, &block_object_type);
334 1.1 christos if (block_obj)
335 1.1 christos set_block (block_obj, block, objfile);
336 1.1 christos
337 1.1 christos return (PyObject *) block_obj;
338 1.1 christos }
339 1.1 christos
340 1.1 christos /* Return struct block reference that is wrapped by this object. */
341 1.1 christos const struct block *
342 1.1 christos block_object_to_block (PyObject *obj)
343 1.1 christos {
344 1.1 christos if (! PyObject_TypeCheck (obj, &block_object_type))
345 1.1 christos return NULL;
346 1.1 christos return ((block_object *) obj)->block;
347 1.1 christos }
348 1.1 christos
349 1.1 christos /* Return a reference to the block iterator. */
350 1.1 christos static PyObject *
351 1.1 christos blpy_block_syms_iter (PyObject *self)
352 1.1 christos {
353 1.1 christos block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) self;
354 1.1 christos
355 1.1 christos BLPY_ITER_REQUIRE_VALID (iter_obj->source);
356 1.1 christos
357 1.1 christos Py_INCREF (self);
358 1.1 christos return self;
359 1.1 christos }
360 1.1 christos
361 1.1 christos /* Return the next symbol in the iteration through the block's
362 1.1 christos dictionary. */
363 1.1 christos static PyObject *
364 1.1 christos blpy_block_syms_iternext (PyObject *self)
365 1.1 christos {
366 1.1 christos block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) self;
367 1.1 christos struct symbol *sym;
368 1.1 christos
369 1.1 christos BLPY_ITER_REQUIRE_VALID (iter_obj->source);
370 1.1 christos
371 1.1 christos if (!iter_obj->initialized_p)
372 1.1 christos {
373 1.1 christos sym = block_iterator_first (iter_obj->block, &(iter_obj->iter));
374 1.1 christos iter_obj->initialized_p = 1;
375 1.1 christos }
376 1.1 christos else
377 1.1 christos sym = block_iterator_next (&(iter_obj->iter));
378 1.1 christos
379 1.1 christos if (sym == NULL)
380 1.1 christos {
381 1.1 christos PyErr_SetString (PyExc_StopIteration, _("Symbol is null."));
382 1.1 christos return NULL;
383 1.1 christos }
384 1.1 christos
385 1.1 christos return symbol_to_symbol_object (sym);
386 1.1 christos }
387 1.1 christos
388 1.1 christos static void
389 1.1 christos blpy_block_syms_dealloc (PyObject *obj)
390 1.1 christos {
391 1.1 christos block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) obj;
392 1.1 christos
393 1.1 christos Py_XDECREF (iter_obj->source);
394 1.9 christos Py_TYPE (obj)->tp_free (obj);
395 1.1 christos }
396 1.1 christos
397 1.1 christos /* Implementation of gdb.Block.is_valid (self) -> Boolean.
398 1.1 christos Returns True if this block object still exists in GDB. */
399 1.1 christos
400 1.1 christos static PyObject *
401 1.1 christos blpy_is_valid (PyObject *self, PyObject *args)
402 1.1 christos {
403 1.1 christos const struct block *block;
404 1.1 christos
405 1.1 christos block = block_object_to_block (self);
406 1.1 christos if (block == NULL)
407 1.1 christos Py_RETURN_FALSE;
408 1.1 christos
409 1.1 christos Py_RETURN_TRUE;
410 1.1 christos }
411 1.1 christos
412 1.1 christos /* Implementation of gdb.BlockIterator.is_valid (self) -> Boolean.
413 1.1 christos Returns True if this block iterator object still exists in GDB */
414 1.1 christos
415 1.1 christos static PyObject *
416 1.1 christos blpy_iter_is_valid (PyObject *self, PyObject *args)
417 1.1 christos {
418 1.1 christos block_syms_iterator_object *iter_obj =
419 1.1 christos (block_syms_iterator_object *) self;
420 1.1 christos
421 1.1 christos if (iter_obj->source->block == NULL)
422 1.1 christos Py_RETURN_FALSE;
423 1.1 christos
424 1.1 christos Py_RETURN_TRUE;
425 1.1 christos }
426 1.1 christos
427 1.1 christos int
428 1.1 christos gdbpy_initialize_blocks (void)
429 1.1 christos {
430 1.1 christos block_object_type.tp_new = PyType_GenericNew;
431 1.1 christos if (PyType_Ready (&block_object_type) < 0)
432 1.1 christos return -1;
433 1.1 christos
434 1.1 christos block_syms_iterator_object_type.tp_new = PyType_GenericNew;
435 1.1 christos if (PyType_Ready (&block_syms_iterator_object_type) < 0)
436 1.1 christos return -1;
437 1.1 christos
438 1.1 christos if (gdb_pymodule_addobject (gdb_module, "Block",
439 1.1 christos (PyObject *) &block_object_type) < 0)
440 1.1 christos return -1;
441 1.1 christos
442 1.1 christos return gdb_pymodule_addobject (gdb_module, "BlockIterator",
443 1.1 christos (PyObject *) &block_syms_iterator_object_type);
444 1.1 christos }
445 1.1 christos
446 1.1 christos
447 1.1 christos
449 1.1 christos static PyMethodDef block_object_methods[] = {
450 1.1 christos { "is_valid", blpy_is_valid, METH_NOARGS,
451 1.1 christos "is_valid () -> Boolean.\n\
452 1.1 christos Return true if this block is valid, false if not." },
453 1.1 christos {NULL} /* Sentinel */
454 1.1 christos };
455 1.7 christos
456 1.1 christos static gdb_PyGetSetDef block_object_getset[] = {
457 1.1 christos { "start", blpy_get_start, NULL, "Start address of the block.", NULL },
458 1.1 christos { "end", blpy_get_end, NULL, "End address of the block.", NULL },
459 1.1 christos { "function", blpy_get_function, NULL,
460 1.1 christos "Symbol that names the block, or None.", NULL },
461 1.1 christos { "superblock", blpy_get_superblock, NULL,
462 1.1 christos "Block containing the block, or None.", NULL },
463 1.1 christos { "global_block", blpy_get_global_block, NULL,
464 1.1 christos "Block containing the global block.", NULL },
465 1.1 christos { "static_block", blpy_get_static_block, NULL,
466 1.1 christos "Block containing the static block.", NULL },
467 1.1 christos { "is_static", blpy_is_static, NULL,
468 1.1 christos "Whether this block is a static block.", NULL },
469 1.1 christos { "is_global", blpy_is_global, NULL,
470 1.1 christos "Whether this block is a global block.", NULL },
471 1.1 christos { NULL } /* Sentinel */
472 1.1 christos };
473 1.9 christos
474 1.9 christos static PyMappingMethods block_object_as_mapping = {
475 1.9 christos NULL,
476 1.9 christos blpy_getitem,
477 1.9 christos NULL
478 1.9 christos };
479 1.1 christos
480 1.1 christos PyTypeObject block_object_type = {
481 1.1 christos PyVarObject_HEAD_INIT (NULL, 0)
482 1.1 christos "gdb.Block", /*tp_name*/
483 1.1 christos sizeof (block_object), /*tp_basicsize*/
484 1.1 christos 0, /*tp_itemsize*/
485 1.1 christos blpy_dealloc, /*tp_dealloc*/
486 1.1 christos 0, /*tp_print*/
487 1.1 christos 0, /*tp_getattr*/
488 1.1 christos 0, /*tp_setattr*/
489 1.1 christos 0, /*tp_compare*/
490 1.1 christos 0, /*tp_repr*/
491 1.1 christos 0, /*tp_as_number*/
492 1.9 christos 0, /*tp_as_sequence*/
493 1.1 christos &block_object_as_mapping, /*tp_as_mapping*/
494 1.1 christos 0, /*tp_hash */
495 1.1 christos 0, /*tp_call*/
496 1.1 christos 0, /*tp_str*/
497 1.1 christos 0, /*tp_getattro*/
498 1.1 christos 0, /*tp_setattro*/
499 1.10 christos 0, /*tp_as_buffer*/
500 1.1 christos Py_TPFLAGS_DEFAULT, /*tp_flags*/
501 1.1 christos "GDB block object", /* tp_doc */
502 1.1 christos 0, /* tp_traverse */
503 1.1 christos 0, /* tp_clear */
504 1.1 christos 0, /* tp_richcompare */
505 1.1 christos 0, /* tp_weaklistoffset */
506 1.1 christos blpy_iter, /* tp_iter */
507 1.1 christos 0, /* tp_iternext */
508 1.1 christos block_object_methods, /* tp_methods */
509 1.1 christos 0, /* tp_members */
510 1.1 christos block_object_getset /* tp_getset */
511 1.1 christos };
512 1.1 christos
513 1.1 christos static PyMethodDef block_iterator_object_methods[] = {
514 1.1 christos { "is_valid", blpy_iter_is_valid, METH_NOARGS,
515 1.1 christos "is_valid () -> Boolean.\n\
516 1.1 christos Return true if this block iterator is valid, false if not." },
517 1.1 christos {NULL} /* Sentinel */
518 1.1 christos };
519 1.5 christos
520 1.1 christos PyTypeObject block_syms_iterator_object_type = {
521 1.1 christos PyVarObject_HEAD_INIT (NULL, 0)
522 1.1 christos "gdb.BlockIterator", /*tp_name*/
523 1.1 christos sizeof (block_syms_iterator_object), /*tp_basicsize*/
524 1.1 christos 0, /*tp_itemsize*/
525 1.1 christos blpy_block_syms_dealloc, /*tp_dealloc*/
526 1.1 christos 0, /*tp_print*/
527 1.1 christos 0, /*tp_getattr*/
528 1.1 christos 0, /*tp_setattr*/
529 1.1 christos 0, /*tp_compare*/
530 1.1 christos 0, /*tp_repr*/
531 1.1 christos 0, /*tp_as_number*/
532 1.1 christos 0, /*tp_as_sequence*/
533 1.1 christos 0, /*tp_as_mapping*/
534 1.1 christos 0, /*tp_hash */
535 1.1 christos 0, /*tp_call*/
536 1.1 christos 0, /*tp_str*/
537 1.1 christos 0, /*tp_getattro*/
538 1.1 christos 0, /*tp_setattro*/
539 1.10 christos 0, /*tp_as_buffer*/
540 1.1 christos Py_TPFLAGS_DEFAULT, /*tp_flags*/
541 1.1 christos "GDB block syms iterator object", /*tp_doc */
542 1.1 christos 0, /*tp_traverse */
543 1.1 christos 0, /*tp_clear */
544 1.1 christos 0, /*tp_richcompare */
545 1.1 christos 0, /*tp_weaklistoffset */
546 1.1 christos blpy_block_syms_iter, /*tp_iter */
547 1.1 christos blpy_block_syms_iternext, /*tp_iternext */
548 1.1 christos block_iterator_object_methods /*tp_methods */
549 };
550