GDB (xrefs)
Loading...
Searching...
No Matches
py-symbol.c
Go to the documentation of this file.
1/* Python interface to symbols.
2
3 Copyright (C) 2008-2023 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 "block.h"
22#include "frame.h"
23#include "symtab.h"
24#include "python-internal.h"
25#include "objfiles.h"
26#include "symfile.h"
27
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. */
38};
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
53/* A deleter that is used when an objfile is about to be freed. */
55{
57 {
58 while (obj)
59 {
60 symbol_object *next = obj->next;
61
62 obj->symbol = NULL;
63 obj->next = NULL;
64 obj->prev = NULL;
65
66 obj = next;
67 }
68 }
69};
70
73
74static PyObject *
75sympy_str (PyObject *self)
76{
77 PyObject *result;
78 struct symbol *symbol = NULL;
79
81
82 result = PyUnicode_FromString (symbol->print_name ());
83
84 return result;
85}
86
87static PyObject *
88sympy_get_type (PyObject *self, void *closure)
89{
90 struct symbol *symbol = NULL;
91
93
94 if (symbol->type () == NULL)
95 {
96 Py_INCREF (Py_None);
97 return Py_None;
98 }
99
100 return type_to_type_object (symbol->type ());
101}
102
103static PyObject *
104sympy_get_symtab (PyObject *self, void *closure)
105{
106 struct symbol *symbol = NULL;
107
109
110 if (!symbol->is_objfile_owned ())
111 Py_RETURN_NONE;
112
114}
115
116static PyObject *
117sympy_get_name (PyObject *self, void *closure)
118{
119 struct symbol *symbol = NULL;
120
122
123 return PyUnicode_FromString (symbol->natural_name ());
124}
125
126static PyObject *
127sympy_get_linkage_name (PyObject *self, void *closure)
128{
129 struct symbol *symbol = NULL;
130
132
133 return PyUnicode_FromString (symbol->linkage_name ());
134}
135
136static PyObject *
137sympy_get_print_name (PyObject *self, void *closure)
138{
139 struct symbol *symbol = NULL;
140
142
143 return sympy_str (self);
144}
145
146static PyObject *
147sympy_get_addr_class (PyObject *self, void *closure)
148{
149 struct symbol *symbol = NULL;
150
152
153 return gdb_py_object_from_longest (symbol->aclass ()).release ();
154}
155
156static PyObject *
157sympy_is_argument (PyObject *self, void *closure)
158{
159 struct symbol *symbol = NULL;
160
162
163 return PyBool_FromLong (symbol->is_argument ());
164}
165
166static PyObject *
167sympy_is_constant (PyObject *self, void *closure)
168{
169 struct symbol *symbol = NULL;
170 enum address_class theclass;
171
173
174 theclass = symbol->aclass ();
175
176 return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
177}
178
179static PyObject *
180sympy_is_function (PyObject *self, void *closure)
181{
182 struct symbol *symbol = NULL;
183 enum address_class theclass;
184
186
187 theclass = symbol->aclass ();
188
189 return PyBool_FromLong (theclass == LOC_BLOCK);
190}
191
192static PyObject *
193sympy_is_variable (PyObject *self, void *closure)
194{
195 struct symbol *symbol = NULL;
196 enum address_class theclass;
197
199
200 theclass = symbol->aclass ();
201
202 return PyBool_FromLong (!symbol->is_argument ()
203 && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
204 || theclass == LOC_STATIC || theclass == LOC_COMPUTED
205 || theclass == LOC_OPTIMIZED_OUT));
206}
207
208/* Implementation of gdb.Symbol.needs_frame -> Boolean.
209 Returns true iff the symbol needs a frame for evaluation. */
210
211static PyObject *
212sympy_needs_frame (PyObject *self, void *closure)
213{
214 struct symbol *symbol = NULL;
215 int result = 0;
216
218
219 try
220 {
222 }
223 catch (const gdb_exception &except)
224 {
226 }
227
228 if (result)
229 Py_RETURN_TRUE;
230 Py_RETURN_FALSE;
231}
232
233/* Implementation of gdb.Symbol.line -> int.
234 Returns the line number at which the symbol was defined. */
235
236static PyObject *
237sympy_line (PyObject *self, void *closure)
238{
239 struct symbol *symbol = NULL;
240
242
243 return gdb_py_object_from_longest (symbol->line ()).release ();
244}
245
246/* Implementation of gdb.Symbol.is_valid (self) -> Boolean.
247 Returns True if this Symbol still exists in GDB. */
248
249static PyObject *
250sympy_is_valid (PyObject *self, PyObject *args)
251{
252 struct symbol *symbol = NULL;
253
255 if (symbol == NULL)
256 Py_RETURN_FALSE;
257
258 Py_RETURN_TRUE;
259}
260
261/* Implementation of gdb.Symbol.value (self[, frame]) -> gdb.Value. Returns
262 the value of the symbol, or an error in various circumstances. */
263
264static PyObject *
265sympy_value (PyObject *self, PyObject *args)
266{
267 struct symbol *symbol = NULL;
269 PyObject *frame_obj = NULL;
270 struct value *value = NULL;
271
272 if (!PyArg_ParseTuple (args, "|O", &frame_obj))
273 return NULL;
274
275 if (frame_obj != NULL && !PyObject_TypeCheck (frame_obj, &frame_object_type))
276 {
277 PyErr_SetString (PyExc_TypeError, "argument is not a frame");
278 return NULL;
279 }
280
282 if (symbol->aclass () == LOC_TYPEDEF)
283 {
284 PyErr_SetString (PyExc_TypeError, "cannot get the value of a typedef");
285 return NULL;
286 }
287
288 try
289 {
290 if (frame_obj != NULL)
291 {
293 if (frame_info == NULL)
294 error (_("invalid frame"));
295 }
296
298 error (_("symbol requires a frame to compute its value"));
299
300 /* TODO: currently, we have no way to recover the block in which SYMBOL
301 was found, so we have no block to pass to read_var_value. This will
302 yield an incorrect value when symbol is not local to FRAME_INFO (this
303 can happen with nested functions). */
305 }
306 catch (const gdb_exception &except)
307 {
309 }
310
312}
313
314/* Given a symbol, and a symbol_object that has previously been
315 allocated and initialized, populate the symbol_object with the
316 struct symbol data. Also, register the symbol_object life-cycle
317 with the life-cycle of the object file associated with this
318 symbol, if needed. */
319static void
321{
322 obj->symbol = symbol;
323 obj->prev = NULL;
325 && symbol->symtab () != NULL)
326 {
327 struct objfile *objfile = symbol->objfile ();
328
330 if (obj->next)
331 obj->next->prev = obj;
333 }
334 else
335 obj->next = NULL;
336}
337
338/* Create a new symbol object (gdb.Symbol) that encapsulates the struct
339 symbol object from GDB. */
340PyObject *
342{
343 symbol_object *sym_obj;
344
345 sym_obj = PyObject_New (symbol_object, &symbol_object_type);
346 if (sym_obj)
347 set_symbol (sym_obj, sym);
348
349 return (PyObject *) sym_obj;
350}
351
352/* Return the symbol that is wrapped by this symbol object. */
353struct symbol *
355{
356 if (! PyObject_TypeCheck (obj, &symbol_object_type))
357 return NULL;
358 return ((symbol_object *) obj)->symbol;
359}
360
361static void
362sympy_dealloc (PyObject *obj)
363{
364 symbol_object *sym_obj = (symbol_object *) obj;
365
366 if (sym_obj->prev)
367 sym_obj->prev->next = sym_obj->next;
368 else if (sym_obj->symbol != NULL
369 && sym_obj->symbol->is_objfile_owned ()
370 && sym_obj->symbol->symtab () != NULL)
371 sympy_objfile_data_key.set (sym_obj->symbol->objfile (), sym_obj->next);
372 if (sym_obj->next)
373 sym_obj->next->prev = sym_obj->prev;
374 sym_obj->symbol = NULL;
375 Py_TYPE (obj)->tp_free (obj);
376}
377
378/* Implementation of
379 gdb.lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)
380 A tuple with 2 elements is always returned. The first is the symbol
381 object or None, the second is a boolean with the value of
382 is_a_field_of_this (see comment in lookup_symbol_in_language). */
383
384PyObject *
385gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
386{
387 int domain = VAR_DOMAIN;
388 struct field_of_this_result is_a_field_of_this;
389 const char *name;
390 static const char *keywords[] = { "name", "block", "domain", NULL };
391 struct symbol *symbol = NULL;
392 PyObject *block_obj = NULL, *sym_obj, *bool_obj;
393 const struct block *block = NULL;
394
395 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
396 &block_object_type, &block_obj,
397 &domain))
398 return NULL;
399
400 if (block_obj)
401 block = block_object_to_block (block_obj);
402 else
403 {
405
406 try
407 {
408 selected_frame = get_selected_frame (_("No frame selected."));
410 }
411 catch (const gdb_exception &except)
412 {
414 }
415 }
416
417 try
418 {
420 &is_a_field_of_this).symbol;
421 }
422 catch (const gdb_exception &except)
423 {
425 }
426
427 gdbpy_ref<> ret_tuple (PyTuple_New (2));
428 if (ret_tuple == NULL)
429 return NULL;
430
431 if (symbol)
432 {
434 if (!sym_obj)
435 return NULL;
436 }
437 else
438 {
439 sym_obj = Py_None;
440 Py_INCREF (Py_None);
441 }
442 PyTuple_SET_ITEM (ret_tuple.get (), 0, sym_obj);
443
444 bool_obj = PyBool_FromLong (is_a_field_of_this.type != NULL);
445 PyTuple_SET_ITEM (ret_tuple.get (), 1, bool_obj);
446
447 return ret_tuple.release ();
448}
449
450/* Implementation of
451 gdb.lookup_global_symbol (name [, domain]) -> symbol or None. */
452
453PyObject *
454gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
455{
456 int domain = VAR_DOMAIN;
457 const char *name;
458 static const char *keywords[] = { "name", "domain", NULL };
459 struct symbol *symbol = NULL;
460 PyObject *sym_obj;
461
462 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
463 &domain))
464 return NULL;
465
466 try
467 {
469 }
470 catch (const gdb_exception &except)
471 {
473 }
474
475 if (symbol)
476 {
478 if (!sym_obj)
479 return NULL;
480 }
481 else
482 {
483 sym_obj = Py_None;
484 Py_INCREF (Py_None);
485 }
486
487 return sym_obj;
488}
489
490/* Implementation of
491 gdb.lookup_static_symbol (name [, domain]) -> symbol or None. */
492
493PyObject *
494gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
495{
496 const char *name;
497 int domain = VAR_DOMAIN;
498 static const char *keywords[] = { "name", "domain", NULL };
499 struct symbol *symbol = NULL;
500 PyObject *sym_obj;
501
502 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
503 &domain))
504 return NULL;
505
506 /* In order to find static symbols associated with the "current" object
507 file ahead of those from other object files, we first need to see if
508 we can acquire a current block. If this fails however, then we still
509 want to search all static symbols, so don't throw an exception just
510 yet. */
511 const struct block *block = NULL;
512 try
513 {
515 = get_selected_frame (_("No frame selected."));
517 }
518 catch (const gdb_exception &except)
519 {
520 /* Nothing. */
521 }
522
523 try
524 {
525 if (block != nullptr)
526 symbol
528 (domain_enum) domain).symbol;
529
530 if (symbol == nullptr)
532 }
533 catch (const gdb_exception &except)
534 {
536 }
537
538 if (symbol)
539 {
541 if (!sym_obj)
542 return NULL;
543 }
544 else
545 {
546 sym_obj = Py_None;
547 Py_INCREF (Py_None);
548 }
549
550 return sym_obj;
551}
552
553/* Implementation of
554 gdb.lookup_static_symbols (name [, domain]) -> symbol list.
555
556 Returns a list of all static symbols matching NAME in DOMAIN. */
557
558PyObject *
559gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
560{
561 const char *name;
562 int domain = VAR_DOMAIN;
563 static const char *keywords[] = { "name", "domain", NULL };
564
565 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
566 &domain))
567 return NULL;
568
569 gdbpy_ref<> return_list (PyList_New (0));
570 if (return_list == NULL)
571 return NULL;
572
573 try
574 {
575 /* Expand any symtabs that contain potentially matching symbols. */
577 expand_symtabs_matching (NULL, lookup_name, NULL, NULL,
579 ALL_DOMAIN);
580
582 {
583 for (compunit_symtab *cust : objfile->compunits ())
584 {
585 const struct blockvector *bv;
586
587 bv = cust->blockvector ();
588 const struct block *block = bv->static_block ();
589
590 if (block != nullptr)
591 {
593 (name, block, (domain_enum) domain).symbol;
594
595 if (symbol != nullptr)
596 {
597 PyObject *sym_obj
599 if (PyList_Append (return_list.get (), sym_obj) == -1)
600 return NULL;
601 }
602 }
603 }
604 }
605 }
606 catch (const gdb_exception &except)
607 {
609 }
610
611 return return_list.release ();
612}
613
614int
616{
617 if (PyType_Ready (&symbol_object_type) < 0)
618 return -1;
619
620 if (PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF) < 0
621 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST",
622 LOC_CONST) < 0
623 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC",
624 LOC_STATIC) < 0
625 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER",
626 LOC_REGISTER) < 0
627 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG",
628 LOC_ARG) < 0
629 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG",
630 LOC_REF_ARG) < 0
631 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL",
632 LOC_LOCAL) < 0
633 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF",
634 LOC_TYPEDEF) < 0
635 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL",
636 LOC_LABEL) < 0
637 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK",
638 LOC_BLOCK) < 0
639 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
640 LOC_CONST_BYTES) < 0
641 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED",
642 LOC_UNRESOLVED) < 0
643 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
645 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED",
646 LOC_COMPUTED) < 0
647 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMMON_BLOCK",
649 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
651 || PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
652 UNDEF_DOMAIN) < 0
653 || PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN",
654 VAR_DOMAIN) < 0
655 || PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
656 STRUCT_DOMAIN) < 0
657 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
658 LABEL_DOMAIN) < 0
659 || PyModule_AddIntConstant (gdb_module, "SYMBOL_MODULE_DOMAIN",
660 MODULE_DOMAIN) < 0
661 || PyModule_AddIntConstant (gdb_module, "SYMBOL_COMMON_BLOCK_DOMAIN",
663 return -1;
664
665 /* These remain defined for compatibility, but as they were never
666 correct, they are no longer documented. Eventually we can remove
667 them. These exist because at one time, enum search_domain and
668 enum domain_enum_tag were combined -- but different values were
669 used differently. Here we try to give them values that will make
670 sense if they are passed to gdb.lookup_symbol. */
671 if (PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
672 VAR_DOMAIN) < 0
673 || PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
674 VAR_DOMAIN) < 0
675 || PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN",
676 VAR_DOMAIN) < 0)
677 return -1;
678
679 return gdb_pymodule_addobject (gdb_module, "Symbol",
680 (PyObject *) &symbol_object_type);
681}
682
683
684
686 { "type", sympy_get_type, NULL,
687 "Type of the symbol.", NULL },
688 { "symtab", sympy_get_symtab, NULL,
689 "Symbol table in which the symbol appears.", NULL },
690 { "name", sympy_get_name, NULL,
691 "Name of the symbol, as it appears in the source code.", NULL },
692 { "linkage_name", sympy_get_linkage_name, NULL,
693 "Name of the symbol, as used by the linker (i.e., may be mangled).",
694 NULL },
695 { "print_name", sympy_get_print_name, NULL,
696 "Name of the symbol in a form suitable for output.\n\
697This is either name or linkage_name, depending on whether the user asked GDB\n\
698to display demangled or mangled names.", NULL },
699 { "addr_class", sympy_get_addr_class, NULL, "Address class of the symbol." },
700 { "is_argument", sympy_is_argument, NULL,
701 "True if the symbol is an argument of a function." },
702 { "is_constant", sympy_is_constant, NULL,
703 "True if the symbol is a constant." },
704 { "is_function", sympy_is_function, NULL,
705 "True if the symbol is a function or method." },
706 { "is_variable", sympy_is_variable, NULL,
707 "True if the symbol is a variable." },
708 { "needs_frame", sympy_needs_frame, NULL,
709 "True if the symbol requires a frame for evaluation." },
710 { "line", sympy_line, NULL,
711 "The source line number at which the symbol was defined." },
712 { NULL } /* Sentinel */
713};
714
715static PyMethodDef symbol_object_methods[] = {
716 { "is_valid", sympy_is_valid, METH_NOARGS,
717 "is_valid () -> Boolean.\n\
718Return true if this symbol is valid, false if not." },
719 { "value", sympy_value, METH_VARARGS,
720 "value ([frame]) -> gdb.Value\n\
721Return the value of the symbol." },
722 {NULL} /* Sentinel */
723};
724
725PyTypeObject symbol_object_type = {
726 PyVarObject_HEAD_INIT (NULL, 0)
727 "gdb.Symbol", /*tp_name*/
728 sizeof (symbol_object), /*tp_basicsize*/
729 0, /*tp_itemsize*/
730 sympy_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 sympy_str, /*tp_str*/
742 0, /*tp_getattro*/
743 0, /*tp_setattro*/
744 0, /*tp_as_buffer*/
745 Py_TPFLAGS_DEFAULT, /*tp_flags*/
746 "GDB symbol 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 symbol_object_methods, /*tp_methods */
754 0, /*tp_members */
755 symbol_object_getset /*tp_getset */
756};
const char *const name
Definition: aarch64-tdep.c:67
const struct block * get_frame_block(frame_info_ptr frame, CORE_ADDR *addr_in_block)
Definition: blockframe.c:55
void set(unsigned key, void *datum)
Definition: registry.h:204
void * get(unsigned key)
Definition: registry.h:211
int symbol_read_needs_frame(struct symbol *sym)
Definition: findvar.c:389
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
Definition: findvar.c:787
static frame_info_ptr selected_frame
Definition: frame.c:1680
frame_info_ptr get_selected_frame(const char *message)
Definition: frame.c:1813
struct program_space * current_program_space
Definition: progspace.c:39
PyTypeObject block_object_type
Definition: py-block.c:479
const struct block * block_object_to_block(PyObject *obj)
Definition: py-block.c:342
PyTypeObject frame_object_type
Definition: py-frame.c:799
frame_info_ptr frame_object_to_frame_info(PyObject *obj)
Definition: py-frame.c:61
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
Definition: py-ref.h:43
struct symbol * symbol_object_to_symbol(PyObject *obj)
Definition: py-symbol.c:354
static PyObject * sympy_value(PyObject *self, PyObject *args)
Definition: py-symbol.c:265
static PyObject * sympy_get_print_name(PyObject *self, void *closure)
Definition: py-symbol.c:137
static void set_symbol(symbol_object *obj, struct symbol *symbol)
Definition: py-symbol.c:320
int gdbpy_initialize_symbols(void)
Definition: py-symbol.c:615
static PyObject * sympy_is_function(PyObject *self, void *closure)
Definition: py-symbol.c:180
PyObject * symbol_to_symbol_object(struct symbol *sym)
Definition: py-symbol.c:341
PyObject * gdbpy_lookup_static_symbol(PyObject *self, PyObject *args, PyObject *kw)
Definition: py-symbol.c:494
#define SYMPY_REQUIRE_VALID(symbol_obj, symbol)
Definition: py-symbol.c:42
PyObject * gdbpy_lookup_global_symbol(PyObject *self, PyObject *args, PyObject *kw)
Definition: py-symbol.c:454
static PyObject * sympy_get_type(PyObject *self, void *closure)
Definition: py-symbol.c:88
static PyObject * sympy_str(PyObject *self)
Definition: py-symbol.c:75
static PyObject * sympy_get_symtab(PyObject *self, void *closure)
Definition: py-symbol.c:104
static void sympy_dealloc(PyObject *obj)
Definition: py-symbol.c:362
PyTypeObject symbol_object_type
Definition: py-symbol.c:725
static PyObject * sympy_needs_frame(PyObject *self, void *closure)
Definition: py-symbol.c:212
static PyMethodDef symbol_object_methods[]
Definition: py-symbol.c:715
PyObject * gdbpy_lookup_symbol(PyObject *self, PyObject *args, PyObject *kw)
Definition: py-symbol.c:385
static PyObject * sympy_is_constant(PyObject *self, void *closure)
Definition: py-symbol.c:167
static const registry< objfile >::key< symbol_object, symbol_object_deleter > sympy_objfile_data_key
Definition: py-symbol.c:72
static PyObject * sympy_get_addr_class(PyObject *self, void *closure)
Definition: py-symbol.c:147
PyObject * gdbpy_lookup_static_symbols(PyObject *self, PyObject *args, PyObject *kw)
Definition: py-symbol.c:559
static PyObject * sympy_line(PyObject *self, void *closure)
Definition: py-symbol.c:237
static PyObject * sympy_is_argument(PyObject *self, void *closure)
Definition: py-symbol.c:157
static gdb_PyGetSetDef symbol_object_getset[]
Definition: py-symbol.c:685
static PyObject * sympy_get_linkage_name(PyObject *self, void *closure)
Definition: py-symbol.c:127
static PyObject * sympy_is_valid(PyObject *self, PyObject *args)
Definition: py-symbol.c:250
static PyObject * sympy_get_name(PyObject *self, void *closure)
Definition: py-symbol.c:117
static PyObject * sympy_is_variable(PyObject *self, void *closure)
Definition: py-symbol.c:193
PyObject * symtab_to_symtab_object(struct symtab *symtab)
Definition: py-symtab.c:467
PyObject * type_to_type_object(struct type *type)
Definition: py-type.c:1381
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
Definition: py-utils.c:279
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
Definition: py-utils.c:331
PyObject * value_to_value_object(struct value *val)
Definition: py-value.c:1778
PyObject * gdb_module
Definition: python.c:84
#define GDB_PY_HANDLE_EXCEPTION(Exception)
static int gdb_PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, const char **keywords,...)
@ SEARCH_GLOBAL_BLOCK
Definition: quick-symbol.h:27
@ SEARCH_STATIC_BLOCK
Definition: quick-symbol.h:28
struct symbol * symbol
Definition: symtab.h:1494
Definition: block.h:109
struct block * static_block()
Definition: block.h:302
struct type * type
Definition: symtab.h:1979
const char * natural_name() const
Definition: symtab.c:1027
const char * print_name() const
Definition: symtab.h:474
const char * linkage_name() const
Definition: symtab.h:459
compunit_symtab_range compunits()
Definition: objfiles.h:426
objfiles_range objfiles()
Definition: progspace.h:209
void operator()(symbol_object *obj)
Definition: py-symbol.c:56
symbol_object * prev
Definition: py-symbol.c:36
symbol_object * next
Definition: py-symbol.c:37
PyObject_HEAD struct symbol * symbol
Definition: py-symbol.c:31
address_class aclass() const
Definition: symtab.h:1235
struct type * type() const
Definition: symtab.h:1285
domain_enum domain() const
Definition: symtab.h:1240
bool is_objfile_owned() const
Definition: symtab.h:1250
bool is_argument() const
Definition: symtab.h:1260
struct objfile * objfile() const
Definition: symtab.c:6477
symbol()
Definition: symtab.h:1198
struct symtab * symtab
Definition: symtab.h:1414
unsigned short line() const
Definition: symtab.h:1295
Definition: value.c:181
bool expand_symtabs_matching(gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, const lookup_name_info &lookup_name, gdb::function_view< expand_symtabs_symbol_matcher_ftype > symbol_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify, block_search_flags search_flags, enum search_domain kind)
Definition: symfile.c:3727
struct block_symbol lookup_static_symbol(const char *name, const domain_enum domain)
Definition: symtab.c:2606
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
Definition: symtab.c:1967
struct block_symbol lookup_global_symbol(const char *name, const struct block *block, const domain_enum domain)
Definition: symtab.c:2614
struct block_symbol lookup_symbol_in_static_block(const char *name, const struct block *block, const domain_enum domain)
Definition: symtab.c:2483
@ ALL_DOMAIN
Definition: symtab.h:931
address_class
Definition: symtab.h:939
@ LOC_STATIC
Definition: symtab.h:950
@ LOC_BLOCK
Definition: symtab.h:999
@ LOC_LABEL
Definition: symtab.h:993
@ LOC_REGISTER
Definition: symtab.h:964
@ LOC_REF_ARG
Definition: symtab.h:972
@ LOC_UNRESOLVED
Definition: symtab.h:1028
@ LOC_LOCAL
Definition: symtab.h:984
@ LOC_CONST
Definition: symtab.h:946
@ LOC_CONST_BYTES
Definition: symtab.h:1004
@ LOC_UNDEF
Definition: symtab.h:942
@ LOC_OPTIMIZED_OUT
Definition: symtab.h:1033
@ LOC_TYPEDEF
Definition: symtab.h:989
@ LOC_REGPARM_ADDR
Definition: symtab.h:980
@ LOC_COMMON_BLOCK
Definition: symtab.h:1041
@ LOC_COMPUTED
Definition: symtab.h:1037
@ LOC_ARG
Definition: symtab.h:968
domain_enum
Definition: symtab.h:871
@ VAR_DOMAIN
Definition: symtab.h:881
@ STRUCT_DOMAIN
Definition: symtab.h:887
@ LABEL_DOMAIN
Definition: symtab.h:895
@ COMMON_BLOCK_DOMAIN
Definition: symtab.h:899
@ UNDEF_DOMAIN
Definition: symtab.h:876
@ MODULE_DOMAIN
Definition: symtab.h:891