2009-12-03 Richard Ward <richard.j.ward1@googlemail.com>
[deliverable/binutils-gdb.git] / gdb / python / py-type.c
1 /* Python interface to types.
2
3 Copyright (C) 2008, 2009 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #include "defs.h"
21 #include "value.h"
22 #include "exceptions.h"
23 #include "python-internal.h"
24 #include "charset.h"
25 #include "gdbtypes.h"
26 #include "cp-support.h"
27 #include "demangle.h"
28 #include "objfiles.h"
29 #include "language.h"
30
31 typedef struct pyty_type_object
32 {
33 PyObject_HEAD
34 struct type *type;
35
36 /* If a Type object is associated with an objfile, it is kept on a
37 doubly-linked list, rooted in the objfile. This lets us copy the
38 underlying struct type when the objfile is deleted. */
39 struct pyty_type_object *prev;
40 struct pyty_type_object *next;
41 } type_object;
42
43 static PyTypeObject type_object_type;
44
45 /* A Field object. */
46 typedef struct pyty_field_object
47 {
48 PyObject_HEAD
49
50 /* Dictionary holding our attributes. */
51 PyObject *dict;
52 } field_object;
53
54 static PyTypeObject field_object_type;
55
56 /* This is used to initialize various gdb.TYPE_ constants. */
57 struct pyty_code
58 {
59 /* The code. */
60 enum type_code code;
61 /* The name. */
62 const char *name;
63 };
64
65 #define ENTRY(X) { X, #X }
66
67 static struct pyty_code pyty_codes[] =
68 {
69 ENTRY (TYPE_CODE_PTR),
70 ENTRY (TYPE_CODE_ARRAY),
71 ENTRY (TYPE_CODE_STRUCT),
72 ENTRY (TYPE_CODE_UNION),
73 ENTRY (TYPE_CODE_ENUM),
74 ENTRY (TYPE_CODE_FLAGS),
75 ENTRY (TYPE_CODE_FUNC),
76 ENTRY (TYPE_CODE_INT),
77 ENTRY (TYPE_CODE_FLT),
78 ENTRY (TYPE_CODE_VOID),
79 ENTRY (TYPE_CODE_SET),
80 ENTRY (TYPE_CODE_RANGE),
81 ENTRY (TYPE_CODE_STRING),
82 ENTRY (TYPE_CODE_BITSTRING),
83 ENTRY (TYPE_CODE_ERROR),
84 ENTRY (TYPE_CODE_METHOD),
85 ENTRY (TYPE_CODE_METHODPTR),
86 ENTRY (TYPE_CODE_MEMBERPTR),
87 ENTRY (TYPE_CODE_REF),
88 ENTRY (TYPE_CODE_CHAR),
89 ENTRY (TYPE_CODE_BOOL),
90 ENTRY (TYPE_CODE_COMPLEX),
91 ENTRY (TYPE_CODE_TYPEDEF),
92 ENTRY (TYPE_CODE_NAMESPACE),
93 ENTRY (TYPE_CODE_DECFLOAT),
94 ENTRY (TYPE_CODE_INTERNAL_FUNCTION),
95 { TYPE_CODE_UNDEF, NULL }
96 };
97
98 \f
99
100 static void
101 field_dealloc (PyObject *obj)
102 {
103 field_object *f = (field_object *) obj;
104 Py_XDECREF (f->dict);
105 f->ob_type->tp_free (obj);
106 }
107
108 static PyObject *
109 field_new (void)
110 {
111 field_object *result = PyObject_New (field_object, &field_object_type);
112 if (result)
113 {
114 result->dict = PyDict_New ();
115 if (!result->dict)
116 {
117 Py_DECREF (result);
118 result = NULL;
119 }
120 }
121 return (PyObject *) result;
122 }
123
124 \f
125
126 /* Return the code for this type. */
127 static PyObject *
128 typy_get_code (PyObject *self, void *closure)
129 {
130 struct type *type = ((type_object *) self)->type;
131 return PyInt_FromLong (TYPE_CODE (type));
132 }
133
134 /* Helper function for typy_fields which converts a single field to a
135 dictionary. Returns NULL on error. */
136 static PyObject *
137 convert_field (struct type *type, int field)
138 {
139 PyObject *result = field_new ();
140 PyObject *arg;
141
142 if (!result)
143 return NULL;
144
145 if (!field_is_static (&TYPE_FIELD (type, field)))
146 {
147 arg = PyLong_FromLong (TYPE_FIELD_BITPOS (type, field));
148 if (!arg)
149 goto fail;
150
151 if (PyObject_SetAttrString (result, "bitpos", arg) < 0)
152 goto failarg;
153 }
154
155 if (TYPE_FIELD_NAME (type, field))
156 arg = PyString_FromString (TYPE_FIELD_NAME (type, field));
157 else
158 {
159 arg = Py_None;
160 Py_INCREF (arg);
161 }
162 if (!arg)
163 goto fail;
164 if (PyObject_SetAttrString (result, "name", arg) < 0)
165 goto failarg;
166
167 arg = TYPE_FIELD_ARTIFICIAL (type, field) ? Py_True : Py_False;
168 Py_INCREF (arg);
169 if (PyObject_SetAttrString (result, "artificial", arg) < 0)
170 goto failarg;
171
172 if (TYPE_CODE (type) == TYPE_CODE_CLASS)
173 arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
174 else
175 arg = Py_False;
176 Py_INCREF (arg);
177 if (PyObject_SetAttrString (result, "is_base_class", arg) < 0)
178 goto failarg;
179
180 arg = PyLong_FromLong (TYPE_FIELD_BITSIZE (type, field));
181 if (!arg)
182 goto fail;
183 if (PyObject_SetAttrString (result, "bitsize", arg) < 0)
184 goto failarg;
185
186 /* A field can have a NULL type in some situations. */
187 if (TYPE_FIELD_TYPE (type, field) == NULL)
188 {
189 arg = Py_None;
190 Py_INCREF (arg);
191 }
192 else
193 arg = type_to_type_object (TYPE_FIELD_TYPE (type, field));
194 if (!arg)
195 goto fail;
196 if (PyObject_SetAttrString (result, "type", arg) < 0)
197 goto failarg;
198
199 return result;
200
201 failarg:
202 Py_DECREF (arg);
203 fail:
204 Py_DECREF (result);
205 return NULL;
206 }
207
208 /* Return a sequence of all fields. Each field is a dictionary with
209 some pre-defined keys. */
210 static PyObject *
211 typy_fields (PyObject *self, PyObject *args)
212 {
213 PyObject *result;
214 int i;
215 struct type *type = ((type_object *) self)->type;
216
217 /* We would like to make a tuple here, make fields immutable, and
218 then memoize the result (and perhaps make Field.type() lazy).
219 However, that can lead to cycles. */
220 result = PyList_New (0);
221
222 for (i = 0; i < TYPE_NFIELDS (type); ++i)
223 {
224 PyObject *dict = convert_field (type, i);
225 if (!dict)
226 {
227 Py_DECREF (result);
228 return NULL;
229 }
230 if (PyList_Append (result, dict))
231 {
232 Py_DECREF (dict);
233 Py_DECREF (result);
234 return NULL;
235 }
236 }
237
238 return result;
239 }
240
241 /* Return the type's tag, or None. */
242 static PyObject *
243 typy_get_tag (PyObject *self, void *closure)
244 {
245 struct type *type = ((type_object *) self)->type;
246 if (!TYPE_TAG_NAME (type))
247 Py_RETURN_NONE;
248 return PyString_FromString (TYPE_TAG_NAME (type));
249 }
250
251 /* Return the type, stripped of typedefs. */
252 static PyObject *
253 typy_strip_typedefs (PyObject *self, PyObject *args)
254 {
255 struct type *type = ((type_object *) self)->type;
256
257 return type_to_type_object (check_typedef (type));
258 }
259
260 /* Return a Type object which represents a pointer to SELF. */
261 static PyObject *
262 typy_pointer (PyObject *self, PyObject *args)
263 {
264 struct type *type = ((type_object *) self)->type;
265 volatile struct gdb_exception except;
266
267 TRY_CATCH (except, RETURN_MASK_ALL)
268 {
269 type = lookup_pointer_type (type);
270 }
271 GDB_PY_HANDLE_EXCEPTION (except);
272
273 return type_to_type_object (type);
274 }
275
276 /* Return a Type object which represents a reference to SELF. */
277 static PyObject *
278 typy_reference (PyObject *self, PyObject *args)
279 {
280 struct type *type = ((type_object *) self)->type;
281 volatile struct gdb_exception except;
282
283 TRY_CATCH (except, RETURN_MASK_ALL)
284 {
285 type = lookup_reference_type (type);
286 }
287 GDB_PY_HANDLE_EXCEPTION (except);
288
289 return type_to_type_object (type);
290 }
291
292 /* Return a Type object which represents the target type of SELF. */
293 static PyObject *
294 typy_target (PyObject *self, PyObject *args)
295 {
296 struct type *type = ((type_object *) self)->type;
297
298 if (!TYPE_TARGET_TYPE (type))
299 {
300 PyErr_SetString (PyExc_RuntimeError, "type does not have a target");
301 return NULL;
302 }
303
304 return type_to_type_object (TYPE_TARGET_TYPE (type));
305 }
306
307 /* Return a const-qualified type variant. */
308 static PyObject *
309 typy_const (PyObject *self, PyObject *args)
310 {
311 struct type *type = ((type_object *) self)->type;
312 volatile struct gdb_exception except;
313
314 TRY_CATCH (except, RETURN_MASK_ALL)
315 {
316 type = make_cv_type (1, 0, type, NULL);
317 }
318 GDB_PY_HANDLE_EXCEPTION (except);
319
320 return type_to_type_object (type);
321 }
322
323 /* Return a volatile-qualified type variant. */
324 static PyObject *
325 typy_volatile (PyObject *self, PyObject *args)
326 {
327 struct type *type = ((type_object *) self)->type;
328 volatile struct gdb_exception except;
329
330 TRY_CATCH (except, RETURN_MASK_ALL)
331 {
332 type = make_cv_type (0, 1, type, NULL);
333 }
334 GDB_PY_HANDLE_EXCEPTION (except);
335
336 return type_to_type_object (type);
337 }
338
339 /* Return an unqualified type variant. */
340 static PyObject *
341 typy_unqualified (PyObject *self, PyObject *args)
342 {
343 struct type *type = ((type_object *) self)->type;
344 volatile struct gdb_exception except;
345
346 TRY_CATCH (except, RETURN_MASK_ALL)
347 {
348 type = make_cv_type (0, 0, type, NULL);
349 }
350 GDB_PY_HANDLE_EXCEPTION (except);
351
352 return type_to_type_object (type);
353 }
354
355 /* Return the size of the type represented by SELF, in bytes. */
356 static PyObject *
357 typy_get_sizeof (PyObject *self, void *closure)
358 {
359 struct type *type = ((type_object *) self)->type;
360 volatile struct gdb_exception except;
361
362 TRY_CATCH (except, RETURN_MASK_ALL)
363 {
364 check_typedef (type);
365 }
366 /* Ignore exceptions. */
367
368 return PyLong_FromLong (TYPE_LENGTH (type));
369 }
370
371 static struct type *
372 typy_lookup_typename (char *type_name)
373 {
374 struct type *type = NULL;
375 volatile struct gdb_exception except;
376 TRY_CATCH (except, RETURN_MASK_ALL)
377 {
378 if (!strncmp (type_name, "struct ", 7))
379 type = lookup_struct (type_name + 7, NULL);
380 else if (!strncmp (type_name, "union ", 6))
381 type = lookup_union (type_name + 6, NULL);
382 else if (!strncmp (type_name, "enum ", 5))
383 type = lookup_enum (type_name + 5, NULL);
384 else
385 type = lookup_typename (python_language, python_gdbarch,
386 type_name, NULL, 0);
387 }
388 if (except.reason < 0)
389 {
390 PyErr_Format (except.reason == RETURN_QUIT
391 ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
392 "%s", except.message);
393 return NULL;
394 }
395
396 return type;
397 }
398
399 static struct type *
400 typy_lookup_type (struct demangle_component *demangled)
401 {
402 struct type *type;
403 char *type_name;
404 enum demangle_component_type demangled_type;
405
406 /* Save the type: typy_lookup_type() may (indirectly) overwrite
407 memory pointed by demangled. */
408 demangled_type = demangled->type;
409
410 if (demangled_type == DEMANGLE_COMPONENT_POINTER
411 || demangled_type == DEMANGLE_COMPONENT_REFERENCE
412 || demangled_type == DEMANGLE_COMPONENT_CONST
413 || demangled_type == DEMANGLE_COMPONENT_VOLATILE)
414 {
415 type = typy_lookup_type (demangled->u.s_binary.left);
416 if (! type)
417 return NULL;
418
419 switch (demangled_type)
420 {
421 case DEMANGLE_COMPONENT_REFERENCE:
422 return lookup_reference_type (type);
423 case DEMANGLE_COMPONENT_POINTER:
424 return lookup_pointer_type (type);
425 case DEMANGLE_COMPONENT_CONST:
426 return make_cv_type (1, 0, type, NULL);
427 case DEMANGLE_COMPONENT_VOLATILE:
428 return make_cv_type (0, 1, type, NULL);
429 }
430 }
431
432 type_name = cp_comp_to_string (demangled, 10);
433 type = typy_lookup_typename (type_name);
434 xfree (type_name);
435
436 return type;
437 }
438
439 static PyObject *
440 typy_template_argument (PyObject *self, PyObject *args)
441 {
442 int i, argno, n_pointers;
443 struct type *type = ((type_object *) self)->type;
444 struct demangle_component *demangled;
445 const char *err;
446 struct type *argtype;
447
448 if (! PyArg_ParseTuple (args, "i", &argno))
449 return NULL;
450
451 type = check_typedef (type);
452 if (TYPE_CODE (type) == TYPE_CODE_REF)
453 type = check_typedef (TYPE_TARGET_TYPE (type));
454
455 if (TYPE_NAME (type) == NULL)
456 {
457 PyErr_SetString (PyExc_RuntimeError, "null type name");
458 return NULL;
459 }
460
461 /* Note -- this is not thread-safe. */
462 demangled = cp_demangled_name_to_comp (TYPE_NAME (type), &err);
463 if (! demangled)
464 {
465 PyErr_SetString (PyExc_RuntimeError, err);
466 return NULL;
467 }
468
469 /* Strip off component names. */
470 while (demangled->type == DEMANGLE_COMPONENT_QUAL_NAME
471 || demangled->type == DEMANGLE_COMPONENT_LOCAL_NAME)
472 demangled = demangled->u.s_binary.right;
473
474 if (demangled->type != DEMANGLE_COMPONENT_TEMPLATE)
475 {
476 PyErr_SetString (PyExc_RuntimeError, "type is not a template");
477 return NULL;
478 }
479
480 /* Skip from the template to the arguments. */
481 demangled = demangled->u.s_binary.right;
482
483 for (i = 0; demangled && i < argno; ++i)
484 demangled = demangled->u.s_binary.right;
485
486 if (! demangled)
487 {
488 PyErr_Format (PyExc_RuntimeError, "no argument %d in template",
489 argno);
490 return NULL;
491 }
492
493 argtype = typy_lookup_type (demangled->u.s_binary.left);
494 if (! argtype)
495 return NULL;
496
497 return type_to_type_object (argtype);
498 }
499
500 static PyObject *
501 typy_str (PyObject *self)
502 {
503 volatile struct gdb_exception except;
504 char *thetype = NULL;
505 long length = 0;
506 PyObject *result;
507
508 TRY_CATCH (except, RETURN_MASK_ALL)
509 {
510 struct cleanup *old_chain;
511 struct ui_file *stb;
512
513 stb = mem_fileopen ();
514 old_chain = make_cleanup_ui_file_delete (stb);
515
516 type_print (type_object_to_type (self), "", stb, -1);
517
518 thetype = ui_file_xstrdup (stb, &length);
519 do_cleanups (old_chain);
520 }
521 if (except.reason < 0)
522 {
523 xfree (thetype);
524 GDB_PY_HANDLE_EXCEPTION (except);
525 }
526
527 result = PyUnicode_Decode (thetype, length, host_charset (), NULL);
528 xfree (thetype);
529
530 return result;
531 }
532
533 \f
534
535 static const struct objfile_data *typy_objfile_data_key;
536
537 static void
538 save_objfile_types (struct objfile *objfile, void *datum)
539 {
540 type_object *obj = datum;
541 htab_t copied_types;
542 struct cleanup *cleanup;
543
544 /* This prevents another thread from freeing the objects we're
545 operating on. */
546 cleanup = ensure_python_env (get_objfile_arch (objfile), current_language);
547
548 copied_types = create_copied_types_hash (objfile);
549
550 while (obj)
551 {
552 type_object *next = obj->next;
553
554 htab_empty (copied_types);
555
556 obj->type = copy_type_recursive (objfile, obj->type, copied_types);
557
558 obj->next = NULL;
559 obj->prev = NULL;
560
561 obj = next;
562 }
563
564 htab_delete (copied_types);
565
566 do_cleanups (cleanup);
567 }
568
569 static void
570 set_type (type_object *obj, struct type *type)
571 {
572 obj->type = type;
573 obj->prev = NULL;
574 if (type && TYPE_OBJFILE (type))
575 {
576 struct objfile *objfile = TYPE_OBJFILE (type);
577
578 obj->next = objfile_data (objfile, typy_objfile_data_key);
579 if (obj->next)
580 obj->next->prev = obj;
581 set_objfile_data (objfile, typy_objfile_data_key, obj);
582 }
583 else
584 obj->next = NULL;
585 }
586
587 static void
588 typy_dealloc (PyObject *obj)
589 {
590 type_object *type = (type_object *) obj;
591
592 if (type->prev)
593 type->prev->next = type->next;
594 else if (type->type && TYPE_OBJFILE (type->type))
595 {
596 /* Must reset head of list. */
597 struct objfile *objfile = TYPE_OBJFILE (type->type);
598 if (objfile)
599 set_objfile_data (objfile, typy_objfile_data_key, type->next);
600 }
601 if (type->next)
602 type->next->prev = type->prev;
603
604 type->ob_type->tp_free (type);
605 }
606
607 /* Create a new Type referring to TYPE. */
608 PyObject *
609 type_to_type_object (struct type *type)
610 {
611 type_object *type_obj;
612
613 type_obj = PyObject_New (type_object, &type_object_type);
614 if (type_obj)
615 set_type (type_obj, type);
616
617 return (PyObject *) type_obj;
618 }
619
620 struct type *
621 type_object_to_type (PyObject *obj)
622 {
623 if (! PyObject_TypeCheck (obj, &type_object_type))
624 return NULL;
625 return ((type_object *) obj)->type;
626 }
627
628 \f
629
630 /* Implementation of gdb.lookup_type. */
631 PyObject *
632 gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
633 {
634 static char *keywords[] = { "name", NULL };
635 char *type_name = NULL;
636 struct type *type = NULL;
637
638 if (! PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &type_name))
639 return NULL;
640
641 type = typy_lookup_typename (type_name);
642 if (! type)
643 return NULL;
644
645 return (PyObject *) type_to_type_object (type);
646 }
647
648 void
649 gdbpy_initialize_types (void)
650 {
651 int i;
652
653 typy_objfile_data_key
654 = register_objfile_data_with_cleanup (save_objfile_types, NULL);
655
656 if (PyType_Ready (&type_object_type) < 0)
657 return;
658 if (PyType_Ready (&field_object_type) < 0)
659 return;
660
661 for (i = 0; pyty_codes[i].name; ++i)
662 {
663 if (PyModule_AddIntConstant (gdb_module,
664 /* Cast needed for Python 2.4. */
665 (char *) pyty_codes[i].name,
666 pyty_codes[i].code) < 0)
667 return;
668 }
669
670 Py_INCREF (&type_object_type);
671 PyModule_AddObject (gdb_module, "Type", (PyObject *) &type_object_type);
672
673 Py_INCREF (&field_object_type);
674 PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type);
675 }
676
677 \f
678
679 static PyGetSetDef type_object_getset[] =
680 {
681 { "code", typy_get_code, NULL,
682 "The code for this type.", NULL },
683 { "sizeof", typy_get_sizeof, NULL,
684 "The size of this type, in bytes.", NULL },
685 { "tag", typy_get_tag, NULL,
686 "The tag name for this type, or None.", NULL },
687 { NULL }
688 };
689
690 static PyMethodDef type_object_methods[] =
691 {
692 { "const", typy_const, METH_NOARGS,
693 "const () -> Type\n\
694 Return a const variant of this type." },
695 { "fields", typy_fields, METH_NOARGS,
696 "field () -> list\n\
697 Return a sequence holding all the fields of this type.\n\
698 Each field is a dictionary." },
699 { "pointer", typy_pointer, METH_NOARGS,
700 "pointer () -> Type\n\
701 Return a type of pointer to this type." },
702 { "reference", typy_reference, METH_NOARGS,
703 "reference () -> Type\n\
704 Return a type of reference to this type." },
705 { "strip_typedefs", typy_strip_typedefs, METH_NOARGS,
706 "strip_typedefs () -> Type\n\
707 Return a type formed by stripping this type of all typedefs."},
708 { "target", typy_target, METH_NOARGS,
709 "target () -> Type\n\
710 Return the target type of this type." },
711 { "template_argument", typy_template_argument, METH_VARARGS,
712 "template_argument (arg) -> Type\n\
713 Return the type of a template argument." },
714 { "unqualified", typy_unqualified, METH_NOARGS,
715 "unqualified () -> Type\n\
716 Return a variant of this type without const or volatile attributes." },
717 { "volatile", typy_volatile, METH_NOARGS,
718 "volatile () -> Type\n\
719 Return a volatile variant of this type" },
720 { NULL }
721 };
722
723 static PyTypeObject type_object_type =
724 {
725 PyObject_HEAD_INIT (NULL)
726 0, /*ob_size*/
727 "gdb.Type", /*tp_name*/
728 sizeof (type_object), /*tp_basicsize*/
729 0, /*tp_itemsize*/
730 typy_dealloc, /*tp_dealloc*/
731 0, /*tp_print*/
732 0, /*tp_getattr*/
733 0, /*tp_setattr*/
734 0, /*tp_compare*/
735 0, /*tp_repr*/
736 0, /*tp_as_number*/
737 0, /*tp_as_sequence*/
738 0, /*tp_as_mapping*/
739 0, /*tp_hash */
740 0, /*tp_call*/
741 typy_str, /*tp_str*/
742 0, /*tp_getattro*/
743 0, /*tp_setattro*/
744 0, /*tp_as_buffer*/
745 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/
746 "GDB type object", /* tp_doc */
747 0, /* tp_traverse */
748 0, /* tp_clear */
749 0, /* tp_richcompare */
750 0, /* tp_weaklistoffset */
751 0, /* tp_iter */
752 0, /* tp_iternext */
753 type_object_methods, /* tp_methods */
754 0, /* tp_members */
755 type_object_getset, /* tp_getset */
756 0, /* tp_base */
757 0, /* tp_dict */
758 0, /* tp_descr_get */
759 0, /* tp_descr_set */
760 0, /* tp_dictoffset */
761 0, /* tp_init */
762 0, /* tp_alloc */
763 0, /* tp_new */
764 };
765
766 static PyTypeObject field_object_type =
767 {
768 PyObject_HEAD_INIT (NULL)
769 0, /*ob_size*/
770 "gdb.Field", /*tp_name*/
771 sizeof (field_object), /*tp_basicsize*/
772 0, /*tp_itemsize*/
773 field_dealloc, /*tp_dealloc*/
774 0, /*tp_print*/
775 0, /*tp_getattr*/
776 0, /*tp_setattr*/
777 0, /*tp_compare*/
778 0, /*tp_repr*/
779 0, /*tp_as_number*/
780 0, /*tp_as_sequence*/
781 0, /*tp_as_mapping*/
782 0, /*tp_hash */
783 0, /*tp_call*/
784 0, /*tp_str*/
785 0, /*tp_getattro*/
786 0, /*tp_setattro*/
787 0, /*tp_as_buffer*/
788 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/
789 "GDB field object", /* tp_doc */
790 0, /* tp_traverse */
791 0, /* tp_clear */
792 0, /* tp_richcompare */
793 0, /* tp_weaklistoffset */
794 0, /* tp_iter */
795 0, /* tp_iternext */
796 0, /* tp_methods */
797 0, /* tp_members */
798 0, /* tp_getset */
799 0, /* tp_base */
800 0, /* tp_dict */
801 0, /* tp_descr_get */
802 0, /* tp_descr_set */
803 offsetof (field_object, dict), /* tp_dictoffset */
804 0, /* tp_init */
805 0, /* tp_alloc */
806 0, /* tp_new */
807 };
This page took 0.046178 seconds and 4 git commands to generate.