]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/python/py-objfile.c
Add Objfile.lookup_{global,static}_symbol functions
[thirdparty/binutils-gdb.git] / gdb / python / py-objfile.c
1 /* Python interface to objfiles.
2
3 Copyright (C) 2008-2019 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 "python-internal.h"
22 #include "charset.h"
23 #include "objfiles.h"
24 #include "language.h"
25 #include "build-id.h"
26 #include "symtab.h"
27
28 typedef struct
29 {
30 PyObject_HEAD
31
32 /* The corresponding objfile. */
33 struct objfile *objfile;
34
35 /* Dictionary holding user-added attributes.
36 This is the __dict__ attribute of the object. */
37 PyObject *dict;
38
39 /* The pretty-printer list of functions. */
40 PyObject *printers;
41
42 /* The frame filter list of functions. */
43 PyObject *frame_filters;
44
45 /* The list of frame unwinders. */
46 PyObject *frame_unwinders;
47
48 /* The type-printer list. */
49 PyObject *type_printers;
50
51 /* The debug method matcher list. */
52 PyObject *xmethods;
53 } objfile_object;
54
55 extern PyTypeObject objfile_object_type
56 CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
57
58 static const struct objfile_data *objfpy_objfile_data_key;
59
60 /* Require that OBJF be a valid objfile. */
61 #define OBJFPY_REQUIRE_VALID(obj) \
62 do { \
63 if (!(obj)->objfile) \
64 { \
65 PyErr_SetString (PyExc_RuntimeError, \
66 _("Objfile no longer exists.")); \
67 return NULL; \
68 } \
69 } while (0)
70
71 \f
72
73 /* An Objfile method which returns the objfile's file name, or None. */
74
75 static PyObject *
76 objfpy_get_filename (PyObject *self, void *closure)
77 {
78 objfile_object *obj = (objfile_object *) self;
79
80 if (obj->objfile)
81 return (host_string_to_python_string (objfile_name (obj->objfile))
82 .release ());
83 Py_RETURN_NONE;
84 }
85
86 /* An Objfile method which returns the objfile's file name, as specified
87 by the user, or None. */
88
89 static PyObject *
90 objfpy_get_username (PyObject *self, void *closure)
91 {
92 objfile_object *obj = (objfile_object *) self;
93
94 if (obj->objfile)
95 {
96 const char *username = obj->objfile->original_name;
97
98 return host_string_to_python_string (username).release ();
99 }
100
101 Py_RETURN_NONE;
102 }
103
104 /* If SELF is a separate debug-info file, return the "backlink" field.
105 Otherwise return None. */
106
107 static PyObject *
108 objfpy_get_owner (PyObject *self, void *closure)
109 {
110 objfile_object *obj = (objfile_object *) self;
111 struct objfile *objfile = obj->objfile;
112 struct objfile *owner;
113
114 OBJFPY_REQUIRE_VALID (obj);
115
116 owner = objfile->separate_debug_objfile_backlink;
117 if (owner != NULL)
118 return objfile_to_objfile_object (owner).release ();
119 Py_RETURN_NONE;
120 }
121
122 /* An Objfile method which returns the objfile's build id, or None. */
123
124 static PyObject *
125 objfpy_get_build_id (PyObject *self, void *closure)
126 {
127 objfile_object *obj = (objfile_object *) self;
128 struct objfile *objfile = obj->objfile;
129 const struct bfd_build_id *build_id = NULL;
130
131 OBJFPY_REQUIRE_VALID (obj);
132
133 try
134 {
135 build_id = build_id_bfd_get (objfile->obfd);
136 }
137 catch (const gdb_exception &except)
138 {
139 GDB_PY_HANDLE_EXCEPTION (except);
140 }
141
142 if (build_id != NULL)
143 {
144 gdb::unique_xmalloc_ptr<char> hex_form
145 (make_hex_string (build_id->data, build_id->size));
146
147 return host_string_to_python_string (hex_form.get ()).release ();
148 }
149
150 Py_RETURN_NONE;
151 }
152
153 /* An Objfile method which returns the objfile's progspace, or None. */
154
155 static PyObject *
156 objfpy_get_progspace (PyObject *self, void *closure)
157 {
158 objfile_object *obj = (objfile_object *) self;
159
160 if (obj->objfile)
161 return pspace_to_pspace_object (obj->objfile->pspace).release ();
162
163 Py_RETURN_NONE;
164 }
165
166 static void
167 objfpy_dealloc (PyObject *o)
168 {
169 objfile_object *self = (objfile_object *) o;
170
171 Py_XDECREF (self->dict);
172 Py_XDECREF (self->printers);
173 Py_XDECREF (self->frame_filters);
174 Py_XDECREF (self->frame_unwinders);
175 Py_XDECREF (self->type_printers);
176 Py_XDECREF (self->xmethods);
177 Py_TYPE (self)->tp_free (self);
178 }
179
180 /* Initialize an objfile_object.
181 The result is a boolean indicating success. */
182
183 static int
184 objfpy_initialize (objfile_object *self)
185 {
186 self->objfile = NULL;
187
188 self->dict = PyDict_New ();
189 if (self->dict == NULL)
190 return 0;
191
192 self->printers = PyList_New (0);
193 if (self->printers == NULL)
194 return 0;
195
196 self->frame_filters = PyDict_New ();
197 if (self->frame_filters == NULL)
198 return 0;
199
200 self->frame_unwinders = PyList_New (0);
201 if (self->frame_unwinders == NULL)
202 return 0;
203
204 self->type_printers = PyList_New (0);
205 if (self->type_printers == NULL)
206 return 0;
207
208 self->xmethods = PyList_New (0);
209 if (self->xmethods == NULL)
210 return 0;
211
212 return 1;
213 }
214
215 static PyObject *
216 objfpy_new (PyTypeObject *type, PyObject *args, PyObject *keywords)
217 {
218 gdbpy_ref<objfile_object> self ((objfile_object *) type->tp_alloc (type, 0));
219
220 if (self != NULL)
221 {
222 if (!objfpy_initialize (self.get ()))
223 return NULL;
224 }
225
226 return (PyObject *) self.release ();
227 }
228
229 PyObject *
230 objfpy_get_printers (PyObject *o, void *ignore)
231 {
232 objfile_object *self = (objfile_object *) o;
233
234 Py_INCREF (self->printers);
235 return self->printers;
236 }
237
238 static int
239 objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
240 {
241 objfile_object *self = (objfile_object *) o;
242
243 if (! value)
244 {
245 PyErr_SetString (PyExc_TypeError,
246 _("Cannot delete the pretty_printers attribute."));
247 return -1;
248 }
249
250 if (! PyList_Check (value))
251 {
252 PyErr_SetString (PyExc_TypeError,
253 _("The pretty_printers attribute must be a list."));
254 return -1;
255 }
256
257 /* Take care in case the LHS and RHS are related somehow. */
258 gdbpy_ref<> tmp (self->printers);
259 Py_INCREF (value);
260 self->printers = value;
261
262 return 0;
263 }
264
265 /* Return the Python dictionary attribute containing frame filters for
266 this object file. */
267 PyObject *
268 objfpy_get_frame_filters (PyObject *o, void *ignore)
269 {
270 objfile_object *self = (objfile_object *) o;
271
272 Py_INCREF (self->frame_filters);
273 return self->frame_filters;
274 }
275
276 /* Set this object file's frame filters dictionary to FILTERS. */
277 static int
278 objfpy_set_frame_filters (PyObject *o, PyObject *filters, void *ignore)
279 {
280 objfile_object *self = (objfile_object *) o;
281
282 if (! filters)
283 {
284 PyErr_SetString (PyExc_TypeError,
285 _("Cannot delete the frame filters attribute."));
286 return -1;
287 }
288
289 if (! PyDict_Check (filters))
290 {
291 PyErr_SetString (PyExc_TypeError,
292 _("The frame_filters attribute must be a dictionary."));
293 return -1;
294 }
295
296 /* Take care in case the LHS and RHS are related somehow. */
297 gdbpy_ref<> tmp (self->frame_filters);
298 Py_INCREF (filters);
299 self->frame_filters = filters;
300
301 return 0;
302 }
303
304 /* Return the frame unwinders attribute for this object file. */
305
306 PyObject *
307 objfpy_get_frame_unwinders (PyObject *o, void *ignore)
308 {
309 objfile_object *self = (objfile_object *) o;
310
311 Py_INCREF (self->frame_unwinders);
312 return self->frame_unwinders;
313 }
314
315 /* Set this object file's frame unwinders list to UNWINDERS. */
316
317 static int
318 objfpy_set_frame_unwinders (PyObject *o, PyObject *unwinders, void *ignore)
319 {
320 objfile_object *self = (objfile_object *) o;
321
322 if (!unwinders)
323 {
324 PyErr_SetString (PyExc_TypeError,
325 _("Cannot delete the frame unwinders attribute."));
326 return -1;
327 }
328
329 if (!PyList_Check (unwinders))
330 {
331 PyErr_SetString (PyExc_TypeError,
332 _("The frame_unwinders attribute must be a list."));
333 return -1;
334 }
335
336 /* Take care in case the LHS and RHS are related somehow. */
337 gdbpy_ref<> tmp (self->frame_unwinders);
338 Py_INCREF (unwinders);
339 self->frame_unwinders = unwinders;
340
341 return 0;
342 }
343
344 /* Get the 'type_printers' attribute. */
345
346 static PyObject *
347 objfpy_get_type_printers (PyObject *o, void *ignore)
348 {
349 objfile_object *self = (objfile_object *) o;
350
351 Py_INCREF (self->type_printers);
352 return self->type_printers;
353 }
354
355 /* Get the 'xmethods' attribute. */
356
357 PyObject *
358 objfpy_get_xmethods (PyObject *o, void *ignore)
359 {
360 objfile_object *self = (objfile_object *) o;
361
362 Py_INCREF (self->xmethods);
363 return self->xmethods;
364 }
365
366 /* Set the 'type_printers' attribute. */
367
368 static int
369 objfpy_set_type_printers (PyObject *o, PyObject *value, void *ignore)
370 {
371 objfile_object *self = (objfile_object *) o;
372
373 if (! value)
374 {
375 PyErr_SetString (PyExc_TypeError,
376 _("Cannot delete the type_printers attribute."));
377 return -1;
378 }
379
380 if (! PyList_Check (value))
381 {
382 PyErr_SetString (PyExc_TypeError,
383 _("The type_printers attribute must be a list."));
384 return -1;
385 }
386
387 /* Take care in case the LHS and RHS are related somehow. */
388 gdbpy_ref<> tmp (self->type_printers);
389 Py_INCREF (value);
390 self->type_printers = value;
391
392 return 0;
393 }
394
395 /* Implementation of gdb.Objfile.is_valid (self) -> Boolean.
396 Returns True if this object file still exists in GDB. */
397
398 static PyObject *
399 objfpy_is_valid (PyObject *self, PyObject *args)
400 {
401 objfile_object *obj = (objfile_object *) self;
402
403 if (! obj->objfile)
404 Py_RETURN_FALSE;
405
406 Py_RETURN_TRUE;
407 }
408
409 /* Implementation of gdb.Objfile.add_separate_debug_file (self, string). */
410
411 static PyObject *
412 objfpy_add_separate_debug_file (PyObject *self, PyObject *args, PyObject *kw)
413 {
414 static const char *keywords[] = { "file_name", NULL };
415 objfile_object *obj = (objfile_object *) self;
416 const char *file_name;
417
418 OBJFPY_REQUIRE_VALID (obj);
419
420 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &file_name))
421 return NULL;
422
423 try
424 {
425 gdb_bfd_ref_ptr abfd (symfile_bfd_open (file_name));
426
427 symbol_file_add_separate (abfd.get (), file_name, 0, obj->objfile);
428 }
429 catch (const gdb_exception &except)
430 {
431 GDB_PY_HANDLE_EXCEPTION (except);
432 }
433
434 Py_RETURN_NONE;
435 }
436
437 /* Implementation of
438 gdb.Objfile.lookup_global_symbol (self, string [, domain]) -> gdb.Symbol. */
439
440 static PyObject *
441 objfpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
442 {
443 static const char *keywords[] = { "name", "domain", NULL };
444 objfile_object *obj = (objfile_object *) self;
445 const char *symbol_name;
446 int domain = VAR_DOMAIN;
447
448 OBJFPY_REQUIRE_VALID (obj);
449
450 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &symbol_name,
451 &domain))
452 return nullptr;
453
454 try
455 {
456 struct symbol *sym = lookup_global_symbol_from_objfile
457 (obj->objfile, GLOBAL_BLOCK, symbol_name, (domain_enum) domain).symbol;
458 if (sym == nullptr)
459 Py_RETURN_NONE;
460
461 return symbol_to_symbol_object (sym);
462 }
463 catch (const gdb_exception &except)
464 {
465 GDB_PY_HANDLE_EXCEPTION (except);
466 }
467
468 Py_RETURN_NONE;
469 }
470
471 /* Implementation of
472 gdb.Objfile.lookup_static_symbol (self, string [, domain]) -> gdb.Symbol. */
473
474 static PyObject *
475 objfpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
476 {
477 static const char *keywords[] = { "name", "domain", NULL };
478 objfile_object *obj = (objfile_object *) self;
479 const char *symbol_name;
480 int domain = VAR_DOMAIN;
481
482 OBJFPY_REQUIRE_VALID (obj);
483
484 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &symbol_name,
485 &domain))
486 return nullptr;
487
488 try
489 {
490 struct symbol *sym = lookup_global_symbol_from_objfile
491 (obj->objfile, STATIC_BLOCK, symbol_name, (domain_enum) domain).symbol;
492 if (sym == nullptr)
493 Py_RETURN_NONE;
494
495 return symbol_to_symbol_object (sym);
496 }
497 catch (const gdb_exception &except)
498 {
499 GDB_PY_HANDLE_EXCEPTION (except);
500 }
501
502 Py_RETURN_NONE;
503 }
504
505 /* Implement repr() for gdb.Objfile. */
506
507 static PyObject *
508 objfpy_repr (PyObject *self_)
509 {
510 objfile_object *self = (objfile_object *) self_;
511 objfile *obj = self->objfile;
512
513 if (obj == nullptr)
514 return PyString_FromString ("<gdb.Objfile (invalid)>");
515
516 return PyString_FromFormat ("<gdb.Objfile filename=%s>",
517 objfile_filename (obj));
518 }
519
520 /* Subroutine of gdbpy_lookup_objfile_by_build_id to simplify it.
521 Return non-zero if STRING is a potentially valid build id. */
522
523 static int
524 objfpy_build_id_ok (const char *string)
525 {
526 size_t i, n = strlen (string);
527
528 if (n % 2 != 0)
529 return 0;
530 for (i = 0; i < n; ++i)
531 {
532 if (!isxdigit (string[i]))
533 return 0;
534 }
535 return 1;
536 }
537
538 /* Subroutine of gdbpy_lookup_objfile_by_build_id to simplify it.
539 Returns non-zero if BUILD_ID matches STRING.
540 It is assumed that objfpy_build_id_ok (string) returns TRUE. */
541
542 static int
543 objfpy_build_id_matches (const struct bfd_build_id *build_id,
544 const char *string)
545 {
546 size_t i;
547
548 if (strlen (string) != 2 * build_id->size)
549 return 0;
550
551 for (i = 0; i < build_id->size; ++i)
552 {
553 char c1 = string[i * 2], c2 = string[i * 2 + 1];
554 int byte = (host_hex_value (c1) << 4) | host_hex_value (c2);
555
556 if (byte != build_id->data[i])
557 return 0;
558 }
559
560 return 1;
561 }
562
563 /* Subroutine of gdbpy_lookup_objfile to simplify it.
564 Look up an objfile by its file name. */
565
566 static struct objfile *
567 objfpy_lookup_objfile_by_name (const char *name)
568 {
569 for (objfile *objfile : current_program_space->objfiles ())
570 {
571 const char *filename;
572
573 if ((objfile->flags & OBJF_NOT_FILENAME) != 0)
574 continue;
575 /* Don't return separate debug files. */
576 if (objfile->separate_debug_objfile_backlink != NULL)
577 continue;
578
579 filename = objfile_filename (objfile);
580 if (filename != NULL && compare_filenames_for_search (filename, name))
581 return objfile;
582 if (compare_filenames_for_search (objfile->original_name, name))
583 return objfile;
584 }
585
586 return NULL;
587 }
588
589 /* Subroutine of gdbpy_lookup_objfile to simplify it.
590 Look up an objfile by its build id. */
591
592 static struct objfile *
593 objfpy_lookup_objfile_by_build_id (const char *build_id)
594 {
595 for (objfile *objfile : current_program_space->objfiles ())
596 {
597 const struct bfd_build_id *obfd_build_id;
598
599 if (objfile->obfd == NULL)
600 continue;
601 /* Don't return separate debug files. */
602 if (objfile->separate_debug_objfile_backlink != NULL)
603 continue;
604 obfd_build_id = build_id_bfd_get (objfile->obfd);
605 if (obfd_build_id == NULL)
606 continue;
607 if (objfpy_build_id_matches (obfd_build_id, build_id))
608 return objfile;
609 }
610
611 return NULL;
612 }
613
614 /* Implementation of gdb.lookup_objfile. */
615
616 PyObject *
617 gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
618 {
619 static const char *keywords[] = { "name", "by_build_id", NULL };
620 const char *name;
621 PyObject *by_build_id_obj = NULL;
622 int by_build_id;
623 struct objfile *objfile;
624
625 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!", keywords,
626 &name, &PyBool_Type, &by_build_id_obj))
627 return NULL;
628
629 by_build_id = 0;
630 if (by_build_id_obj != NULL)
631 {
632 int cmp = PyObject_IsTrue (by_build_id_obj);
633
634 if (cmp < 0)
635 return NULL;
636 by_build_id = cmp;
637 }
638
639 if (by_build_id)
640 {
641 if (!objfpy_build_id_ok (name))
642 {
643 PyErr_SetString (PyExc_TypeError, _("Not a valid build id."));
644 return NULL;
645 }
646 objfile = objfpy_lookup_objfile_by_build_id (name);
647 }
648 else
649 objfile = objfpy_lookup_objfile_by_name (name);
650
651 if (objfile != NULL)
652 return objfile_to_objfile_object (objfile).release ();
653
654 PyErr_SetString (PyExc_ValueError, _("Objfile not found."));
655 return NULL;
656 }
657
658 \f
659
660 /* Clear the OBJFILE pointer in an Objfile object and remove the
661 reference. */
662 static void
663 py_free_objfile (struct objfile *objfile, void *datum)
664 {
665 gdbpy_enter enter_py (get_objfile_arch (objfile), current_language);
666 gdbpy_ref<objfile_object> object ((objfile_object *) datum);
667 object->objfile = NULL;
668 }
669
670 /* Return a new reference to the Python object of type Objfile
671 representing OBJFILE. If the object has already been created,
672 return it. Otherwise, create it. Return NULL and set the Python
673 error on failure. */
674
675 gdbpy_ref<>
676 objfile_to_objfile_object (struct objfile *objfile)
677 {
678 PyObject *result
679 = ((PyObject *) objfile_data (objfile, objfpy_objfile_data_key));
680 if (result == NULL)
681 {
682 gdbpy_ref<objfile_object> object
683 ((objfile_object *) PyObject_New (objfile_object, &objfile_object_type));
684 if (object == NULL)
685 return NULL;
686 if (!objfpy_initialize (object.get ()))
687 return NULL;
688
689 object->objfile = objfile;
690 set_objfile_data (objfile, objfpy_objfile_data_key, object.get ());
691 result = (PyObject *) object.release ();
692 }
693
694 return gdbpy_ref<>::new_reference (result);
695 }
696
697 int
698 gdbpy_initialize_objfile (void)
699 {
700 objfpy_objfile_data_key
701 = register_objfile_data_with_cleanup (NULL, py_free_objfile);
702
703 if (PyType_Ready (&objfile_object_type) < 0)
704 return -1;
705
706 return gdb_pymodule_addobject (gdb_module, "Objfile",
707 (PyObject *) &objfile_object_type);
708 }
709
710 \f
711
712 static PyMethodDef objfile_object_methods[] =
713 {
714 { "is_valid", objfpy_is_valid, METH_NOARGS,
715 "is_valid () -> Boolean.\n\
716 Return true if this object file is valid, false if not." },
717
718 { "add_separate_debug_file", (PyCFunction) objfpy_add_separate_debug_file,
719 METH_VARARGS | METH_KEYWORDS,
720 "add_separate_debug_file (file_name).\n\
721 Add FILE_NAME to the list of files containing debug info for the objfile." },
722
723 { "lookup_global_symbol", (PyCFunction) objfpy_lookup_global_symbol,
724 METH_VARARGS | METH_KEYWORDS,
725 "lookup_global_symbol (name [, domain]).\n\
726 Look up a global symbol in this objfile and return it." },
727
728 { "lookup_static_symbol", (PyCFunction) objfpy_lookup_static_symbol,
729 METH_VARARGS | METH_KEYWORDS,
730 "lookup_static_symbol (name [, domain]).\n\
731 Look up a static-linkage global symbol in this objfile and return it." },
732
733 { NULL }
734 };
735
736 static gdb_PyGetSetDef objfile_getset[] =
737 {
738 { "__dict__", gdb_py_generic_dict, NULL,
739 "The __dict__ for this objfile.", &objfile_object_type },
740 { "filename", objfpy_get_filename, NULL,
741 "The objfile's filename, or None.", NULL },
742 { "username", objfpy_get_username, NULL,
743 "The name of the objfile as provided by the user, or None.", NULL },
744 { "owner", objfpy_get_owner, NULL,
745 "The objfile owner of separate debug info objfiles, or None.",
746 NULL },
747 { "build_id", objfpy_get_build_id, NULL,
748 "The objfile's build id, or None.", NULL },
749 { "progspace", objfpy_get_progspace, NULL,
750 "The objfile's progspace, or None.", NULL },
751 { "pretty_printers", objfpy_get_printers, objfpy_set_printers,
752 "Pretty printers.", NULL },
753 { "frame_filters", objfpy_get_frame_filters,
754 objfpy_set_frame_filters, "Frame Filters.", NULL },
755 { "frame_unwinders", objfpy_get_frame_unwinders,
756 objfpy_set_frame_unwinders, "Frame Unwinders", NULL },
757 { "type_printers", objfpy_get_type_printers, objfpy_set_type_printers,
758 "Type printers.", NULL },
759 { "xmethods", objfpy_get_xmethods, NULL,
760 "Debug methods.", NULL },
761 { NULL }
762 };
763
764 PyTypeObject objfile_object_type =
765 {
766 PyVarObject_HEAD_INIT (NULL, 0)
767 "gdb.Objfile", /*tp_name*/
768 sizeof (objfile_object), /*tp_basicsize*/
769 0, /*tp_itemsize*/
770 objfpy_dealloc, /*tp_dealloc*/
771 0, /*tp_print*/
772 0, /*tp_getattr*/
773 0, /*tp_setattr*/
774 0, /*tp_compare*/
775 objfpy_repr, /*tp_repr*/
776 0, /*tp_as_number*/
777 0, /*tp_as_sequence*/
778 0, /*tp_as_mapping*/
779 0, /*tp_hash */
780 0, /*tp_call*/
781 0, /*tp_str*/
782 0, /*tp_getattro*/
783 0, /*tp_setattro*/
784 0, /*tp_as_buffer*/
785 Py_TPFLAGS_DEFAULT, /*tp_flags*/
786 "GDB objfile object", /* tp_doc */
787 0, /* tp_traverse */
788 0, /* tp_clear */
789 0, /* tp_richcompare */
790 0, /* tp_weaklistoffset */
791 0, /* tp_iter */
792 0, /* tp_iternext */
793 objfile_object_methods, /* tp_methods */
794 0, /* tp_members */
795 objfile_getset, /* tp_getset */
796 0, /* tp_base */
797 0, /* tp_dict */
798 0, /* tp_descr_get */
799 0, /* tp_descr_set */
800 offsetof (objfile_object, dict), /* tp_dictoffset */
801 0, /* tp_init */
802 0, /* tp_alloc */
803 objfpy_new, /* tp_new */
804 };