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