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