py-block.c revision 1.9 1 1.1 christos /* Python interface to blocks.
2 1.1 christos
3 1.9 christos Copyright (C) 2008-2020 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.1 christos typedef struct blpy_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.1 christos struct blpy_block_object *prev;
38 1.1 christos struct blpy_block_object *next;
39 1.1 christos } block_object;
40 1.1 christos
41 1.1 christos typedef struct {
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.1 christos struct blpy_block_object *source;
53 1.1 christos } block_syms_iterator_object;
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.5 christos extern PyTypeObject block_syms_iterator_object_type
81 1.1 christos CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
82 1.1 christos static const struct objfile_data *blpy_objfile_data_key;
83 1.1 christos
84 1.1 christos static PyObject *
85 1.1 christos blpy_iter (PyObject *self)
86 1.1 christos {
87 1.1 christos block_syms_iterator_object *block_iter_obj;
88 1.1 christos const struct block *block = NULL;
89 1.1 christos
90 1.1 christos BLPY_REQUIRE_VALID (self, block);
91 1.1 christos
92 1.1 christos block_iter_obj = PyObject_New (block_syms_iterator_object,
93 1.1 christos &block_syms_iterator_object_type);
94 1.1 christos if (block_iter_obj == NULL)
95 1.1 christos return NULL;
96 1.1 christos
97 1.1 christos block_iter_obj->block = block;
98 1.1 christos block_iter_obj->initialized_p = 0;
99 1.1 christos Py_INCREF (self);
100 1.1 christos block_iter_obj->source = (block_object *) self;
101 1.1 christos
102 1.1 christos return (PyObject *) block_iter_obj;
103 1.1 christos }
104 1.1 christos
105 1.1 christos static PyObject *
106 1.1 christos blpy_get_start (PyObject *self, void *closure)
107 1.1 christos {
108 1.1 christos const struct block *block = NULL;
109 1.1 christos
110 1.1 christos BLPY_REQUIRE_VALID (self, block);
111 1.1 christos
112 1.8 christos return gdb_py_object_from_ulongest (BLOCK_START (block)).release ();
113 1.1 christos }
114 1.1 christos
115 1.1 christos static PyObject *
116 1.1 christos blpy_get_end (PyObject *self, void *closure)
117 1.1 christos {
118 1.1 christos const struct block *block = NULL;
119 1.1 christos
120 1.1 christos BLPY_REQUIRE_VALID (self, block);
121 1.1 christos
122 1.8 christos return gdb_py_object_from_ulongest (BLOCK_END (block)).release ();
123 1.1 christos }
124 1.1 christos
125 1.1 christos static PyObject *
126 1.1 christos blpy_get_function (PyObject *self, void *closure)
127 1.1 christos {
128 1.1 christos struct symbol *sym;
129 1.1 christos const struct block *block;
130 1.1 christos
131 1.1 christos BLPY_REQUIRE_VALID (self, block);
132 1.1 christos
133 1.1 christos sym = BLOCK_FUNCTION (block);
134 1.1 christos if (sym)
135 1.1 christos return symbol_to_symbol_object (sym);
136 1.1 christos
137 1.1 christos Py_RETURN_NONE;
138 1.1 christos }
139 1.1 christos
140 1.1 christos static PyObject *
141 1.1 christos blpy_get_superblock (PyObject *self, void *closure)
142 1.1 christos {
143 1.1 christos const struct block *block;
144 1.1 christos const struct block *super_block;
145 1.1 christos block_object *self_obj = (block_object *) self;
146 1.1 christos
147 1.1 christos BLPY_REQUIRE_VALID (self, block);
148 1.1 christos
149 1.1 christos super_block = BLOCK_SUPERBLOCK (block);
150 1.1 christos if (super_block)
151 1.1 christos return block_to_block_object (super_block, self_obj->objfile);
152 1.1 christos
153 1.1 christos Py_RETURN_NONE;
154 1.1 christos }
155 1.1 christos
156 1.1 christos /* Return the global block associated to this block. */
157 1.1 christos
158 1.1 christos static PyObject *
159 1.1 christos blpy_get_global_block (PyObject *self, void *closure)
160 1.1 christos {
161 1.1 christos const struct block *block;
162 1.1 christos const struct block *global_block;
163 1.1 christos block_object *self_obj = (block_object *) self;
164 1.1 christos
165 1.1 christos BLPY_REQUIRE_VALID (self, block);
166 1.1 christos
167 1.1 christos global_block = block_global_block (block);
168 1.1 christos
169 1.1 christos return block_to_block_object (global_block,
170 1.1 christos self_obj->objfile);
171 1.1 christos
172 1.1 christos }
173 1.1 christos
174 1.1 christos /* Return the static block associated to this block. Return None
175 1.1 christos if we cannot get the static block (this is the global block). */
176 1.1 christos
177 1.1 christos static PyObject *
178 1.1 christos blpy_get_static_block (PyObject *self, void *closure)
179 1.1 christos {
180 1.1 christos const struct block *block;
181 1.1 christos const struct block *static_block;
182 1.1 christos block_object *self_obj = (block_object *) self;
183 1.1 christos
184 1.1 christos BLPY_REQUIRE_VALID (self, block);
185 1.1 christos
186 1.1 christos if (BLOCK_SUPERBLOCK (block) == NULL)
187 1.1 christos Py_RETURN_NONE;
188 1.1 christos
189 1.1 christos static_block = block_static_block (block);
190 1.1 christos
191 1.1 christos return block_to_block_object (static_block, self_obj->objfile);
192 1.1 christos }
193 1.1 christos
194 1.1 christos /* Implementation of gdb.Block.is_global (self) -> Boolean.
195 1.1 christos Returns True if this block object is a global block. */
196 1.1 christos
197 1.1 christos static PyObject *
198 1.1 christos blpy_is_global (PyObject *self, void *closure)
199 1.1 christos {
200 1.1 christos const struct block *block;
201 1.1 christos
202 1.1 christos BLPY_REQUIRE_VALID (self, block);
203 1.1 christos
204 1.1 christos if (BLOCK_SUPERBLOCK (block))
205 1.1 christos Py_RETURN_FALSE;
206 1.1 christos
207 1.1 christos Py_RETURN_TRUE;
208 1.1 christos }
209 1.1 christos
210 1.1 christos /* Implementation of gdb.Block.is_static (self) -> Boolean.
211 1.1 christos Returns True if this block object is a static block. */
212 1.1 christos
213 1.1 christos static PyObject *
214 1.1 christos blpy_is_static (PyObject *self, void *closure)
215 1.1 christos {
216 1.1 christos const struct block *block;
217 1.1 christos
218 1.1 christos BLPY_REQUIRE_VALID (self, block);
219 1.1 christos
220 1.1 christos if (BLOCK_SUPERBLOCK (block) != NULL
221 1.1 christos && BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL)
222 1.1 christos Py_RETURN_TRUE;
223 1.1 christos
224 1.1 christos Py_RETURN_FALSE;
225 1.1 christos }
226 1.1 christos
227 1.9 christos /* Given a string, returns the gdb.Symbol representing that symbol in this
228 1.9 christos block. If such a symbol does not exist, returns NULL with a Python
229 1.9 christos exception. */
230 1.9 christos
231 1.9 christos static PyObject *
232 1.9 christos blpy_getitem (PyObject *self, PyObject *key)
233 1.9 christos {
234 1.9 christos const struct block *block;
235 1.9 christos
236 1.9 christos BLPY_REQUIRE_VALID (self, block);
237 1.9 christos
238 1.9 christos gdb::unique_xmalloc_ptr<char> name = python_string_to_host_string (key);
239 1.9 christos if (name == nullptr)
240 1.9 christos return nullptr;
241 1.9 christos
242 1.9 christos lookup_name_info lookup_name (name.get(), symbol_name_match_type::FULL);
243 1.9 christos
244 1.9 christos /* We use ALL_BLOCK_SYMBOLS_WITH_NAME instead of block_lookup_symbol so
245 1.9 christos that we can look up symbols irrespective of the domain, matching the
246 1.9 christos iterator. It would be confusing if the iterator returns symbols you
247 1.9 christos can't find via getitem. */
248 1.9 christos struct block_iterator iter;
249 1.9 christos struct symbol *sym = nullptr;
250 1.9 christos ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym)
251 1.9 christos {
252 1.9 christos /* Just stop at the first match */
253 1.9 christos break;
254 1.9 christos }
255 1.9 christos
256 1.9 christos if (sym == nullptr)
257 1.9 christos {
258 1.9 christos PyErr_SetObject (PyExc_KeyError, key);
259 1.9 christos return nullptr;
260 1.9 christos }
261 1.9 christos return symbol_to_symbol_object (sym);
262 1.9 christos }
263 1.9 christos
264 1.1 christos static void
265 1.1 christos blpy_dealloc (PyObject *obj)
266 1.1 christos {
267 1.1 christos block_object *block = (block_object *) obj;
268 1.1 christos
269 1.1 christos if (block->prev)
270 1.1 christos block->prev->next = block->next;
271 1.1 christos else if (block->objfile)
272 1.1 christos {
273 1.1 christos set_objfile_data (block->objfile, blpy_objfile_data_key,
274 1.1 christos block->next);
275 1.1 christos }
276 1.1 christos if (block->next)
277 1.1 christos block->next->prev = block->prev;
278 1.1 christos block->block = NULL;
279 1.9 christos Py_TYPE (obj)->tp_free (obj);
280 1.1 christos }
281 1.1 christos
282 1.1 christos /* Given a block, and a block_object that has previously been
283 1.1 christos allocated and initialized, populate the block_object with the
284 1.1 christos struct block data. Also, register the block_object life-cycle
285 1.1 christos with the life-cycle of the object file associated with this
286 1.1 christos block, if needed. */
287 1.1 christos static void
288 1.1 christos set_block (block_object *obj, const struct block *block,
289 1.1 christos struct objfile *objfile)
290 1.1 christos {
291 1.1 christos obj->block = block;
292 1.1 christos obj->prev = NULL;
293 1.1 christos if (objfile)
294 1.1 christos {
295 1.1 christos obj->objfile = objfile;
296 1.6 christos obj->next = ((struct blpy_block_object *)
297 1.6 christos objfile_data (objfile, blpy_objfile_data_key));
298 1.1 christos if (obj->next)
299 1.1 christos obj->next->prev = obj;
300 1.1 christos set_objfile_data (objfile, blpy_objfile_data_key, obj);
301 1.1 christos }
302 1.1 christos else
303 1.1 christos obj->next = NULL;
304 1.1 christos }
305 1.1 christos
306 1.1 christos /* Create a new block object (gdb.Block) that encapsulates the struct
307 1.1 christos block object from GDB. */
308 1.1 christos PyObject *
309 1.1 christos block_to_block_object (const struct block *block, struct objfile *objfile)
310 1.1 christos {
311 1.1 christos block_object *block_obj;
312 1.1 christos
313 1.1 christos block_obj = PyObject_New (block_object, &block_object_type);
314 1.1 christos if (block_obj)
315 1.1 christos set_block (block_obj, block, objfile);
316 1.1 christos
317 1.1 christos return (PyObject *) block_obj;
318 1.1 christos }
319 1.1 christos
320 1.1 christos /* Return struct block reference that is wrapped by this object. */
321 1.1 christos const struct block *
322 1.1 christos block_object_to_block (PyObject *obj)
323 1.1 christos {
324 1.1 christos if (! PyObject_TypeCheck (obj, &block_object_type))
325 1.1 christos return NULL;
326 1.1 christos return ((block_object *) obj)->block;
327 1.1 christos }
328 1.1 christos
329 1.1 christos /* Return a reference to the block iterator. */
330 1.1 christos static PyObject *
331 1.1 christos blpy_block_syms_iter (PyObject *self)
332 1.1 christos {
333 1.1 christos block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) self;
334 1.1 christos
335 1.1 christos BLPY_ITER_REQUIRE_VALID (iter_obj->source);
336 1.1 christos
337 1.1 christos Py_INCREF (self);
338 1.1 christos return self;
339 1.1 christos }
340 1.1 christos
341 1.1 christos /* Return the next symbol in the iteration through the block's
342 1.1 christos dictionary. */
343 1.1 christos static PyObject *
344 1.1 christos blpy_block_syms_iternext (PyObject *self)
345 1.1 christos {
346 1.1 christos block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) self;
347 1.1 christos struct symbol *sym;
348 1.1 christos
349 1.1 christos BLPY_ITER_REQUIRE_VALID (iter_obj->source);
350 1.1 christos
351 1.1 christos if (!iter_obj->initialized_p)
352 1.1 christos {
353 1.1 christos sym = block_iterator_first (iter_obj->block, &(iter_obj->iter));
354 1.1 christos iter_obj->initialized_p = 1;
355 1.1 christos }
356 1.1 christos else
357 1.1 christos sym = block_iterator_next (&(iter_obj->iter));
358 1.1 christos
359 1.1 christos if (sym == NULL)
360 1.1 christos {
361 1.1 christos PyErr_SetString (PyExc_StopIteration, _("Symbol is null."));
362 1.1 christos return NULL;
363 1.1 christos }
364 1.1 christos
365 1.1 christos return symbol_to_symbol_object (sym);
366 1.1 christos }
367 1.1 christos
368 1.1 christos static void
369 1.1 christos blpy_block_syms_dealloc (PyObject *obj)
370 1.1 christos {
371 1.1 christos block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) obj;
372 1.1 christos
373 1.1 christos Py_XDECREF (iter_obj->source);
374 1.9 christos Py_TYPE (obj)->tp_free (obj);
375 1.1 christos }
376 1.1 christos
377 1.1 christos /* Implementation of gdb.Block.is_valid (self) -> Boolean.
378 1.1 christos Returns True if this block object still exists in GDB. */
379 1.1 christos
380 1.1 christos static PyObject *
381 1.1 christos blpy_is_valid (PyObject *self, PyObject *args)
382 1.1 christos {
383 1.1 christos const struct block *block;
384 1.1 christos
385 1.1 christos block = block_object_to_block (self);
386 1.1 christos if (block == NULL)
387 1.1 christos Py_RETURN_FALSE;
388 1.1 christos
389 1.1 christos Py_RETURN_TRUE;
390 1.1 christos }
391 1.1 christos
392 1.1 christos /* Implementation of gdb.BlockIterator.is_valid (self) -> Boolean.
393 1.1 christos Returns True if this block iterator object still exists in GDB */
394 1.1 christos
395 1.1 christos static PyObject *
396 1.1 christos blpy_iter_is_valid (PyObject *self, PyObject *args)
397 1.1 christos {
398 1.1 christos block_syms_iterator_object *iter_obj =
399 1.1 christos (block_syms_iterator_object *) self;
400 1.1 christos
401 1.1 christos if (iter_obj->source->block == NULL)
402 1.1 christos Py_RETURN_FALSE;
403 1.1 christos
404 1.1 christos Py_RETURN_TRUE;
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.9 christos
483 1.9 christos static PyMappingMethods block_object_as_mapping = {
484 1.9 christos NULL,
485 1.9 christos blpy_getitem,
486 1.9 christos NULL
487 1.9 christos };
488 1.1 christos
489 1.1 christos PyTypeObject block_object_type = {
490 1.1 christos PyVarObject_HEAD_INIT (NULL, 0)
491 1.1 christos "gdb.Block", /*tp_name*/
492 1.1 christos sizeof (block_object), /*tp_basicsize*/
493 1.1 christos 0, /*tp_itemsize*/
494 1.1 christos blpy_dealloc, /*tp_dealloc*/
495 1.1 christos 0, /*tp_print*/
496 1.1 christos 0, /*tp_getattr*/
497 1.1 christos 0, /*tp_setattr*/
498 1.1 christos 0, /*tp_compare*/
499 1.1 christos 0, /*tp_repr*/
500 1.1 christos 0, /*tp_as_number*/
501 1.9 christos 0, /*tp_as_sequence*/
502 1.1 christos &block_object_as_mapping, /*tp_as_mapping*/
503 1.1 christos 0, /*tp_hash */
504 1.1 christos 0, /*tp_call*/
505 1.1 christos 0, /*tp_str*/
506 1.1 christos 0, /*tp_getattro*/
507 1.1 christos 0, /*tp_setattro*/
508 1.1 christos 0, /*tp_as_buffer*/
509 1.1 christos Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/
510 1.1 christos "GDB block object", /* tp_doc */
511 1.1 christos 0, /* tp_traverse */
512 1.1 christos 0, /* tp_clear */
513 1.1 christos 0, /* tp_richcompare */
514 1.1 christos 0, /* tp_weaklistoffset */
515 1.1 christos blpy_iter, /* tp_iter */
516 1.1 christos 0, /* tp_iternext */
517 1.1 christos block_object_methods, /* tp_methods */
518 1.1 christos 0, /* tp_members */
519 1.1 christos block_object_getset /* tp_getset */
520 1.1 christos };
521 1.1 christos
522 1.1 christos static PyMethodDef block_iterator_object_methods[] = {
523 1.1 christos { "is_valid", blpy_iter_is_valid, METH_NOARGS,
524 1.1 christos "is_valid () -> Boolean.\n\
525 1.1 christos Return true if this block iterator is valid, false if not." },
526 1.1 christos {NULL} /* Sentinel */
527 1.1 christos };
528 1.5 christos
529 1.1 christos PyTypeObject block_syms_iterator_object_type = {
530 1.1 christos PyVarObject_HEAD_INIT (NULL, 0)
531 1.1 christos "gdb.BlockIterator", /*tp_name*/
532 1.1 christos sizeof (block_syms_iterator_object), /*tp_basicsize*/
533 1.1 christos 0, /*tp_itemsize*/
534 1.1 christos blpy_block_syms_dealloc, /*tp_dealloc*/
535 1.1 christos 0, /*tp_print*/
536 1.1 christos 0, /*tp_getattr*/
537 1.1 christos 0, /*tp_setattr*/
538 1.1 christos 0, /*tp_compare*/
539 1.1 christos 0, /*tp_repr*/
540 1.1 christos 0, /*tp_as_number*/
541 1.1 christos 0, /*tp_as_sequence*/
542 1.1 christos 0, /*tp_as_mapping*/
543 1.1 christos 0, /*tp_hash */
544 1.1 christos 0, /*tp_call*/
545 1.1 christos 0, /*tp_str*/
546 1.1 christos 0, /*tp_getattro*/
547 1.1 christos 0, /*tp_setattro*/
548 1.1 christos 0, /*tp_as_buffer*/
549 1.1 christos Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/
550 1.1 christos "GDB block syms iterator object", /*tp_doc */
551 1.1 christos 0, /*tp_traverse */
552 1.1 christos 0, /*tp_clear */
553 1.1 christos 0, /*tp_richcompare */
554 1.1 christos 0, /*tp_weaklistoffset */
555 1.1 christos blpy_block_syms_iter, /*tp_iter */
556 1.1 christos blpy_block_syms_iternext, /*tp_iternext */
557 1.1 christos block_iterator_object_methods /*tp_methods */
558 };
559