]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/python/py-symbol.c
Turn gdbpy_ref into a template
[thirdparty/binutils-gdb.git] / gdb / python / py-symbol.c
CommitLineData
f3e9a817
PM
1/* Python interface to symbols.
2
61baf725 3 Copyright (C) 2008-2017 Free Software Foundation, Inc.
f3e9a817
PM
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 "block.h"
f3e9a817
PM
22#include "frame.h"
23#include "symtab.h"
24#include "python-internal.h"
25#include "objfiles.h"
37fce74f 26#include "py-ref.h"
f3e9a817
PM
27
28typedef struct sympy_symbol_object {
29 PyObject_HEAD
30 /* The GDB symbol structure this object is wrapping. */
31 struct symbol *symbol;
32 /* A symbol object is associated with an objfile, so keep track with
33 doubly-linked list, rooted in the objfile. This lets us
34 invalidate the underlying struct symbol when the objfile is
35 deleted. */
36 struct sympy_symbol_object *prev;
37 struct sympy_symbol_object *next;
38} symbol_object;
39
40/* Require a valid symbol. All access to symbol_object->symbol should be
41 gated by this call. */
42#define SYMPY_REQUIRE_VALID(symbol_obj, symbol) \
43 do { \
44 symbol = symbol_object_to_symbol (symbol_obj); \
45 if (symbol == NULL) \
46 { \
47 PyErr_SetString (PyExc_RuntimeError, \
48 _("Symbol is invalid.")); \
49 return NULL; \
50 } \
51 } while (0)
52
53static const struct objfile_data *sympy_objfile_data_key;
54
55static PyObject *
56sympy_str (PyObject *self)
57{
58 PyObject *result;
59 struct symbol *symbol = NULL;
60
61 SYMPY_REQUIRE_VALID (self, symbol);
62
63 result = PyString_FromString (SYMBOL_PRINT_NAME (symbol));
64
65 return result;
66}
67
457e09f0
DE
68static PyObject *
69sympy_get_type (PyObject *self, void *closure)
70{
71 struct symbol *symbol = NULL;
72
73 SYMPY_REQUIRE_VALID (self, symbol);
74
75 if (SYMBOL_TYPE (symbol) == NULL)
76 {
77 Py_INCREF (Py_None);
78 return Py_None;
79 }
80
81 return type_to_type_object (SYMBOL_TYPE (symbol));
82}
83
f3e9a817
PM
84static PyObject *
85sympy_get_symtab (PyObject *self, void *closure)
86{
87 struct symbol *symbol = NULL;
88
89 SYMPY_REQUIRE_VALID (self, symbol);
90
1994afbf
DE
91 if (!SYMBOL_OBJFILE_OWNED (symbol))
92 Py_RETURN_NONE;
93
08be3fe3 94 return symtab_to_symtab_object (symbol_symtab (symbol));
f3e9a817
PM
95}
96
97static PyObject *
98sympy_get_name (PyObject *self, void *closure)
99{
100 struct symbol *symbol = NULL;
101
102 SYMPY_REQUIRE_VALID (self, symbol);
103
104 return PyString_FromString (SYMBOL_NATURAL_NAME (symbol));
105}
106
107static PyObject *
108sympy_get_linkage_name (PyObject *self, void *closure)
109{
110 struct symbol *symbol = NULL;
111
112 SYMPY_REQUIRE_VALID (self, symbol);
113
114 return PyString_FromString (SYMBOL_LINKAGE_NAME (symbol));
115}
116
117static PyObject *
118sympy_get_print_name (PyObject *self, void *closure)
119{
120 struct symbol *symbol = NULL;
121
122 SYMPY_REQUIRE_VALID (self, symbol);
123
124 return sympy_str (self);
125}
126
127static PyObject *
128sympy_get_addr_class (PyObject *self, void *closure)
129{
130 struct symbol *symbol = NULL;
131
132 SYMPY_REQUIRE_VALID (self, symbol);
133
134 return PyInt_FromLong (SYMBOL_CLASS (symbol));
135}
136
137static PyObject *
138sympy_is_argument (PyObject *self, void *closure)
139{
140 struct symbol *symbol = NULL;
141
142 SYMPY_REQUIRE_VALID (self, symbol);
143
144 return PyBool_FromLong (SYMBOL_IS_ARGUMENT (symbol));
145}
146
147static PyObject *
148sympy_is_constant (PyObject *self, void *closure)
149{
150 struct symbol *symbol = NULL;
fe978cb0 151 enum address_class theclass;
f3e9a817
PM
152
153 SYMPY_REQUIRE_VALID (self, symbol);
154
fe978cb0 155 theclass = SYMBOL_CLASS (symbol);
f3e9a817 156
fe978cb0 157 return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
f3e9a817
PM
158}
159
160static PyObject *
161sympy_is_function (PyObject *self, void *closure)
162{
163 struct symbol *symbol = NULL;
fe978cb0 164 enum address_class theclass;
f3e9a817
PM
165
166 SYMPY_REQUIRE_VALID (self, symbol);
167
fe978cb0 168 theclass = SYMBOL_CLASS (symbol);
f3e9a817 169
fe978cb0 170 return PyBool_FromLong (theclass == LOC_BLOCK);
f3e9a817
PM
171}
172
173static PyObject *
174sympy_is_variable (PyObject *self, void *closure)
175{
176 struct symbol *symbol = NULL;
fe978cb0 177 enum address_class theclass;
f3e9a817
PM
178
179 SYMPY_REQUIRE_VALID (self, symbol);
180
fe978cb0 181 theclass = SYMBOL_CLASS (symbol);
f3e9a817
PM
182
183 return PyBool_FromLong (!SYMBOL_IS_ARGUMENT (symbol)
fe978cb0
PA
184 && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
185 || theclass == LOC_STATIC || theclass == LOC_COMPUTED
186 || theclass == LOC_OPTIMIZED_OUT));
f3e9a817
PM
187}
188
f0823d2c
TT
189/* Implementation of gdb.Symbol.needs_frame -> Boolean.
190 Returns true iff the symbol needs a frame for evaluation. */
191
192static PyObject *
193sympy_needs_frame (PyObject *self, void *closure)
194{
195 struct symbol *symbol = NULL;
f0823d2c
TT
196 int result = 0;
197
198 SYMPY_REQUIRE_VALID (self, symbol);
199
492d29ea 200 TRY
f0823d2c
TT
201 {
202 result = symbol_read_needs_frame (symbol);
203 }
492d29ea
PA
204 CATCH (except, RETURN_MASK_ALL)
205 {
206 GDB_PY_HANDLE_EXCEPTION (except);
207 }
208 END_CATCH
f0823d2c
TT
209
210 if (result)
211 Py_RETURN_TRUE;
212 Py_RETURN_FALSE;
213}
214
64e7d9dd
TT
215/* Implementation of gdb.Symbol.line -> int.
216 Returns the line number at which the symbol was defined. */
217
218static PyObject *
219sympy_line (PyObject *self, void *closure)
220{
221 struct symbol *symbol = NULL;
222
223 SYMPY_REQUIRE_VALID (self, symbol);
224
225 return PyInt_FromLong (SYMBOL_LINE (symbol));
226}
227
29703da4
PM
228/* Implementation of gdb.Symbol.is_valid (self) -> Boolean.
229 Returns True if this Symbol still exists in GDB. */
230
231static PyObject *
232sympy_is_valid (PyObject *self, PyObject *args)
233{
234 struct symbol *symbol = NULL;
235
236 symbol = symbol_object_to_symbol (self);
237 if (symbol == NULL)
238 Py_RETURN_FALSE;
239
240 Py_RETURN_TRUE;
241}
242
f0823d2c
TT
243/* Implementation of gdb.Symbol.value (self[, frame]) -> gdb.Value. Returns
244 the value of the symbol, or an error in various circumstances. */
245
246static PyObject *
247sympy_value (PyObject *self, PyObject *args)
248{
249 struct symbol *symbol = NULL;
250 struct frame_info *frame_info = NULL;
251 PyObject *frame_obj = NULL;
252 struct value *value = NULL;
f0823d2c
TT
253
254 if (!PyArg_ParseTuple (args, "|O", &frame_obj))
255 return NULL;
256
257 if (frame_obj != NULL && !PyObject_TypeCheck (frame_obj, &frame_object_type))
258 {
259 PyErr_SetString (PyExc_TypeError, "argument is not a frame");
260 return NULL;
261 }
262
263 SYMPY_REQUIRE_VALID (self, symbol);
264 if (SYMBOL_CLASS (symbol) == LOC_TYPEDEF)
265 {
266 PyErr_SetString (PyExc_TypeError, "cannot get the value of a typedef");
267 return NULL;
268 }
269
492d29ea 270 TRY
f0823d2c
TT
271 {
272 if (frame_obj != NULL)
273 {
274 frame_info = frame_object_to_frame_info (frame_obj);
275 if (frame_info == NULL)
c6910659 276 error (_("invalid frame"));
f0823d2c 277 }
256458bc 278
f0823d2c 279 if (symbol_read_needs_frame (symbol) && frame_info == NULL)
c6910659 280 error (_("symbol requires a frame to compute its value"));
f0823d2c 281
63e43d3a
PMR
282 /* TODO: currently, we have no way to recover the block in which SYMBOL
283 was found, so we have no block to pass to read_var_value. This will
284 yield an incorrect value when symbol is not local to FRAME_INFO (this
285 can happen with nested functions). */
286 value = read_var_value (symbol, NULL, frame_info);
f0823d2c 287 }
492d29ea
PA
288 CATCH (except, RETURN_MASK_ALL)
289 {
290 GDB_PY_HANDLE_EXCEPTION (except);
291 }
292 END_CATCH
f0823d2c
TT
293
294 return value_to_value_object (value);
295}
296
f3e9a817
PM
297/* Given a symbol, and a symbol_object that has previously been
298 allocated and initialized, populate the symbol_object with the
299 struct symbol data. Also, register the symbol_object life-cycle
b021a221 300 with the life-cycle of the object file associated with this
f3e9a817
PM
301 symbol, if needed. */
302static void
303set_symbol (symbol_object *obj, struct symbol *symbol)
304{
305 obj->symbol = symbol;
306 obj->prev = NULL;
1994afbf
DE
307 if (SYMBOL_OBJFILE_OWNED (symbol)
308 && symbol_symtab (symbol) != NULL)
f3e9a817 309 {
08be3fe3 310 struct objfile *objfile = symbol_objfile (symbol);
f3e9a817 311
19ba03f4
SM
312 obj->next = ((struct sympy_symbol_object *)
313 objfile_data (objfile, sympy_objfile_data_key));
f3e9a817
PM
314 if (obj->next)
315 obj->next->prev = obj;
08be3fe3 316 set_objfile_data (objfile, sympy_objfile_data_key, obj);
f3e9a817
PM
317 }
318 else
319 obj->next = NULL;
320}
321
322/* Create a new symbol object (gdb.Symbol) that encapsulates the struct
323 symbol object from GDB. */
324PyObject *
325symbol_to_symbol_object (struct symbol *sym)
326{
327 symbol_object *sym_obj;
328
329 sym_obj = PyObject_New (symbol_object, &symbol_object_type);
330 if (sym_obj)
331 set_symbol (sym_obj, sym);
332
333 return (PyObject *) sym_obj;
334}
335
336/* Return the symbol that is wrapped by this symbol object. */
337struct symbol *
338symbol_object_to_symbol (PyObject *obj)
339{
340 if (! PyObject_TypeCheck (obj, &symbol_object_type))
341 return NULL;
342 return ((symbol_object *) obj)->symbol;
343}
344
345static void
346sympy_dealloc (PyObject *obj)
347{
348 symbol_object *sym_obj = (symbol_object *) obj;
349
350 if (sym_obj->prev)
351 sym_obj->prev->next = sym_obj->next;
08be3fe3 352 else if (sym_obj->symbol != NULL
1994afbf 353 && SYMBOL_OBJFILE_OWNED (sym_obj->symbol)
08be3fe3 354 && symbol_symtab (sym_obj->symbol) != NULL)
f3e9a817 355 {
08be3fe3 356 set_objfile_data (symbol_objfile (sym_obj->symbol),
f3e9a817
PM
357 sympy_objfile_data_key, sym_obj->next);
358 }
359 if (sym_obj->next)
360 sym_obj->next->prev = sym_obj->prev;
361 sym_obj->symbol = NULL;
362}
363
364/* Implementation of
365 gdb.lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)
366 A tuple with 2 elements is always returned. The first is the symbol
367 object or None, the second is a boolean with the value of
368 is_a_field_of_this (see comment in lookup_symbol_in_language). */
6e6fbe60 369
f3e9a817
PM
370PyObject *
371gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
372{
1993b719
TT
373 int domain = VAR_DOMAIN;
374 struct field_of_this_result is_a_field_of_this;
f3e9a817
PM
375 const char *name;
376 static char *keywords[] = { "name", "block", "domain", NULL };
76dce0be 377 struct symbol *symbol = NULL;
37fce74f 378 PyObject *block_obj = NULL, *sym_obj, *bool_obj;
9df2fbc4 379 const struct block *block = NULL;
f3e9a817
PM
380
381 if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
382 &block_object_type, &block_obj, &domain))
383 return NULL;
384
385 if (block_obj)
386 block = block_object_to_block (block_obj);
387 else
388 {
389 struct frame_info *selected_frame;
f3e9a817 390
492d29ea 391 TRY
f3e9a817 392 {
626e7282
JK
393 selected_frame = get_selected_frame (_("No frame selected."));
394 block = get_frame_block (selected_frame, NULL);
f3e9a817 395 }
492d29ea
PA
396 CATCH (except, RETURN_MASK_ALL)
397 {
398 GDB_PY_HANDLE_EXCEPTION (except);
399 }
400 END_CATCH
f3e9a817
PM
401 }
402
492d29ea 403 TRY
76dce0be 404 {
aead7601
SM
405 symbol = lookup_symbol (name, block, (domain_enum) domain,
406 &is_a_field_of_this).symbol;
76dce0be 407 }
492d29ea
PA
408 CATCH (except, RETURN_MASK_ALL)
409 {
410 GDB_PY_HANDLE_EXCEPTION (except);
411 }
412 END_CATCH
f3e9a817 413
7780f186 414 gdbpy_ref<> ret_tuple (PyTuple_New (2));
37fce74f 415 if (ret_tuple == NULL)
f3e9a817
PM
416 return NULL;
417
418 if (symbol)
419 {
420 sym_obj = symbol_to_symbol_object (symbol);
421 if (!sym_obj)
37fce74f 422 return NULL;
f3e9a817
PM
423 }
424 else
425 {
426 sym_obj = Py_None;
427 Py_INCREF (Py_None);
428 }
37fce74f 429 PyTuple_SET_ITEM (ret_tuple.get (), 0, sym_obj);
f3e9a817 430
1993b719 431 bool_obj = (is_a_field_of_this.type != NULL) ? Py_True : Py_False;
f3e9a817 432 Py_INCREF (bool_obj);
37fce74f 433 PyTuple_SET_ITEM (ret_tuple.get (), 1, bool_obj);
f3e9a817 434
37fce74f 435 return ret_tuple.release ();
f3e9a817
PM
436}
437
6e6fbe60
DE
438/* Implementation of
439 gdb.lookup_global_symbol (name [, domain]) -> symbol or None. */
440
441PyObject *
442gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
443{
444 int domain = VAR_DOMAIN;
445 const char *name;
446 static char *keywords[] = { "name", "domain", NULL };
76dce0be 447 struct symbol *symbol = NULL;
6e6fbe60
DE
448 PyObject *sym_obj;
449
450 if (! PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
451 &domain))
452 return NULL;
453
492d29ea 454 TRY
76dce0be 455 {
aead7601 456 symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol;
76dce0be 457 }
492d29ea
PA
458 CATCH (except, RETURN_MASK_ALL)
459 {
460 GDB_PY_HANDLE_EXCEPTION (except);
461 }
462 END_CATCH
6e6fbe60
DE
463
464 if (symbol)
465 {
466 sym_obj = symbol_to_symbol_object (symbol);
467 if (!sym_obj)
468 return NULL;
469 }
470 else
471 {
472 sym_obj = Py_None;
473 Py_INCREF (Py_None);
474 }
475
476 return sym_obj;
477}
478
f3e9a817
PM
479/* This function is called when an objfile is about to be freed.
480 Invalidate the symbol as further actions on the symbol would result
481 in bad data. All access to obj->symbol should be gated by
482 SYMPY_REQUIRE_VALID which will raise an exception on invalid
483 symbols. */
484static void
485del_objfile_symbols (struct objfile *objfile, void *datum)
486{
19ba03f4 487 symbol_object *obj = (symbol_object *) datum;
f3e9a817
PM
488 while (obj)
489 {
490 symbol_object *next = obj->next;
491
492 obj->symbol = NULL;
493 obj->next = NULL;
494 obj->prev = NULL;
495
496 obj = next;
497 }
498}
499
999633ed 500int
f3e9a817
PM
501gdbpy_initialize_symbols (void)
502{
503 if (PyType_Ready (&symbol_object_type) < 0)
999633ed 504 return -1;
f3e9a817
PM
505
506 /* Register an objfile "free" callback so we can properly
507 invalidate symbol when an object file that is about to be
508 deleted. */
509 sympy_objfile_data_key
510 = register_objfile_data_with_cleanup (NULL, del_objfile_symbols);
511
999633ed
TT
512 if (PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF) < 0
513 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST",
514 LOC_CONST) < 0
515 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC",
516 LOC_STATIC) < 0
517 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER",
518 LOC_REGISTER) < 0
519 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG",
520 LOC_ARG) < 0
521 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG",
522 LOC_REF_ARG) < 0
523 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL",
524 LOC_LOCAL) < 0
525 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF",
526 LOC_TYPEDEF) < 0
527 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL",
528 LOC_LABEL) < 0
529 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK",
530 LOC_BLOCK) < 0
531 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
532 LOC_CONST_BYTES) < 0
533 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED",
534 LOC_UNRESOLVED) < 0
535 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
536 LOC_OPTIMIZED_OUT) < 0
537 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED",
538 LOC_COMPUTED) < 0
539 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
540 LOC_REGPARM_ADDR) < 0
541 || PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
542 UNDEF_DOMAIN) < 0
543 || PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN",
544 VAR_DOMAIN) < 0
545 || PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
546 STRUCT_DOMAIN) < 0
547 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
548 LABEL_DOMAIN) < 0
549 || PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
550 VARIABLES_DOMAIN) < 0
551 || PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
552 FUNCTIONS_DOMAIN) < 0
553 || PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN",
554 TYPES_DOMAIN) < 0)
555 return -1;
f3e9a817 556
aa36459a
TT
557 return gdb_pymodule_addobject (gdb_module, "Symbol",
558 (PyObject *) &symbol_object_type);
f3e9a817
PM
559}
560
561\f
562
563static PyGetSetDef symbol_object_getset[] = {
457e09f0
DE
564 { "type", sympy_get_type, NULL,
565 "Type of the symbol.", NULL },
f3e9a817
PM
566 { "symtab", sympy_get_symtab, NULL,
567 "Symbol table in which the symbol appears.", NULL },
568 { "name", sympy_get_name, NULL,
569 "Name of the symbol, as it appears in the source code.", NULL },
570 { "linkage_name", sympy_get_linkage_name, NULL,
9a2b4c1b
MS
571 "Name of the symbol, as used by the linker (i.e., may be mangled).",
572 NULL },
f3e9a817
PM
573 { "print_name", sympy_get_print_name, NULL,
574 "Name of the symbol in a form suitable for output.\n\
575This is either name or linkage_name, depending on whether the user asked GDB\n\
576to display demangled or mangled names.", NULL },
577 { "addr_class", sympy_get_addr_class, NULL, "Address class of the symbol." },
578 { "is_argument", sympy_is_argument, NULL,
579 "True if the symbol is an argument of a function." },
580 { "is_constant", sympy_is_constant, NULL,
581 "True if the symbol is a constant." },
582 { "is_function", sympy_is_function, NULL,
583 "True if the symbol is a function or method." },
584 { "is_variable", sympy_is_variable, NULL,
585 "True if the symbol is a variable." },
f0823d2c
TT
586 { "needs_frame", sympy_needs_frame, NULL,
587 "True if the symbol requires a frame for evaluation." },
64e7d9dd
TT
588 { "line", sympy_line, NULL,
589 "The source line number at which the symbol was defined." },
f3e9a817
PM
590 { NULL } /* Sentinel */
591};
592
29703da4
PM
593static PyMethodDef symbol_object_methods[] = {
594 { "is_valid", sympy_is_valid, METH_NOARGS,
595 "is_valid () -> Boolean.\n\
596Return true if this symbol is valid, false if not." },
f0823d2c
TT
597 { "value", sympy_value, METH_VARARGS,
598 "value ([frame]) -> gdb.Value\n\
599Return the value of the symbol." },
29703da4
PM
600 {NULL} /* Sentinel */
601};
602
f3e9a817 603PyTypeObject symbol_object_type = {
9a27f2c6 604 PyVarObject_HEAD_INIT (NULL, 0)
f3e9a817
PM
605 "gdb.Symbol", /*tp_name*/
606 sizeof (symbol_object), /*tp_basicsize*/
607 0, /*tp_itemsize*/
608 sympy_dealloc, /*tp_dealloc*/
609 0, /*tp_print*/
610 0, /*tp_getattr*/
611 0, /*tp_setattr*/
612 0, /*tp_compare*/
613 0, /*tp_repr*/
614 0, /*tp_as_number*/
615 0, /*tp_as_sequence*/
616 0, /*tp_as_mapping*/
617 0, /*tp_hash */
618 0, /*tp_call*/
619 sympy_str, /*tp_str*/
620 0, /*tp_getattro*/
621 0, /*tp_setattro*/
622 0, /*tp_as_buffer*/
623 Py_TPFLAGS_DEFAULT, /*tp_flags*/
624 "GDB symbol object", /*tp_doc */
625 0, /*tp_traverse */
626 0, /*tp_clear */
627 0, /*tp_richcompare */
628 0, /*tp_weaklistoffset */
629 0, /*tp_iter */
630 0, /*tp_iternext */
29703da4 631 symbol_object_methods, /*tp_methods */
f3e9a817
PM
632 0, /*tp_members */
633 symbol_object_getset /*tp_getset */
634};