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 "top.h"
22#include "block.h"
23#include "frame.h"
24#include "symtab.h"
25#include "python-internal.h"
26#include "objfiles.h"
27#include "symfile.h"
28
30 PyObject_HEAD
31 /* The GDB symbol structure this object is wrapping. */
32 struct symbol *symbol;
33 /* A symbol object is associated with an objfile, so keep track with
34 doubly-linked list, rooted in the objfile. This lets us
35 invalidate the underlying struct symbol when the objfile is
36 deleted. */
39};
40
41/* Require a valid symbol. All access to symbol_object->symbol should be
42 gated by this call. */
43#define SYMPY_REQUIRE_VALID(symbol_obj, symbol) \
44 do { \
45 symbol = symbol_object_to_symbol (symbol_obj); \
46 if (symbol == NULL) \
47 { \
48 PyErr_SetString (PyExc_RuntimeError, \
49 _("Symbol is invalid.")); \
50 return NULL; \
51 } \
52 } while (0)
53
54/* A deleter that is used when an objfile is about to be freed. */
56{
58 {
59 while (obj)
60 {
61 symbol_object *next = obj->next;
62
63 obj->symbol = NULL;
64 obj->next = NULL;
65 obj->prev = NULL;
66
67 obj = next;
68 }
69 }
70};
71
74
75static PyObject *
77{
78 PyObject *result;
79 struct symbol *symbol = NULL;
80
82
83 result = PyUnicode_FromString (symbol->print_name ());
84
85 return result;
86}
87
88static PyObject *
89sympy_get_type (PyObject *self, void *closure)
90{
91 struct symbol *symbol = NULL;
92
94
95 if (symbol->type () == NULL)
96 {
97 Py_INCREF (Py_None);
98 return Py_None;
99 }
100
101 return type_to_type_object (symbol->type ());
102}
103
104static PyObject *
105sympy_get_symtab (PyObject *self, void *closure)
106{
107 struct symbol *symbol = NULL;
108
110
111 if (!symbol->is_objfile_owned ())
112 Py_RETURN_NONE;
113
115}
116
117static PyObject *
118sympy_get_name (PyObject *self, void *closure)
119{
120 struct symbol *symbol = NULL;
121
123
124 return PyUnicode_FromString (symbol->natural_name ());
125}
126
127static PyObject *
128sympy_get_linkage_name (PyObject *self, void *closure)
129{
130 struct symbol *symbol = NULL;
131
133
134 return PyUnicode_FromString (symbol->linkage_name ());
135}
136
137static PyObject *
138sympy_get_print_name (PyObject *self, void *closure)
139{
140 struct symbol *symbol = NULL;
141
143
144 return sympy_str (self);
145}
146
147static PyObject *
148sympy_get_addr_class (PyObject *self, void *closure)
149{
150 struct symbol *symbol = NULL;
151
153
154 return gdb_py_object_from_longest (symbol->aclass ()).release ();
155}
156
157static PyObject *
158sympy_is_argument (PyObject *self, void *closure)
159{
160 struct symbol *symbol = NULL;
161
163
164 return PyBool_FromLong (symbol->is_argument ());
165}
166
167static PyObject *
168sympy_is_constant (PyObject *self, void *closure)
169{
170 struct symbol *symbol = NULL;
171 enum address_class theclass;
172
174
175 theclass = symbol->aclass ();
176
177 return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
178}
179
180static PyObject *
181sympy_is_function (PyObject *self, void *closure)
182{
183 struct symbol *symbol = NULL;
184 enum address_class theclass;
185
187
188 theclass = symbol->aclass ();
189
190 return PyBool_FromLong (theclass == LOC_BLOCK);
191}
192
193static PyObject *
194sympy_is_variable (PyObject *self, void *closure)
195{
196 struct symbol *symbol = NULL;
197 enum address_class theclass;
198
200
201 theclass = symbol->aclass ();
202
203 return PyBool_FromLong (!symbol->is_argument ()
204 && (theclass == LOC_LOCAL || theclass == LOC_REGISTER
205 || theclass == LOC_STATIC || theclass == LOC_COMPUTED
206 || theclass == LOC_OPTIMIZED_OUT));
207}
208
209/* Implementation of gdb.Symbol.needs_frame -> Boolean.
210 Returns true iff the symbol needs a frame for evaluation. */
211
212static PyObject *
213sympy_needs_frame (PyObject *self, void *closure)
214{
215 struct symbol *symbol = NULL;
216 int result = 0;
217
219
220 try
221 {
223 }
224 catch (const gdb_exception &except)
225 {
227 }
228
229 if (result)
230 Py_RETURN_TRUE;
231 Py_RETURN_FALSE;
232}
233
234/* Implementation of gdb.Symbol.line -> int.
235 Returns the line number at which the symbol was defined. */
236
237static PyObject *
238sympy_line (PyObject *self, void *closure)
239{
240 struct symbol *symbol = NULL;
241
243
244 return gdb_py_object_from_longest (symbol->line ()).release ();
245}
246
247/* Implementation of gdb.Symbol.is_valid (self) -> Boolean.
248 Returns True if this Symbol still exists in GDB. */
249
250static PyObject *
252{
253 struct symbol *symbol = NULL;
254
256 if (symbol == NULL)
257 Py_RETURN_FALSE;
258
259 Py_RETURN_TRUE;
260}
261
262/* Implementation of gdb.Symbol.value (self[, frame]) -> gdb.Value. Returns
263 the value of the symbol, or an error in various circumstances. */
264
265static PyObject *
267{
268 struct symbol *symbol = NULL;
270 PyObject *frame_obj = 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 PyObject *result = nullptr;
289 try
290 {
291 if (frame_obj != NULL)
292 {
294 if (frame_info == NULL)
295 error (_("invalid frame"));
296 }
297
299 error (_("symbol requires a frame to compute its value"));
300
301 /* TODO: currently, we have no way to recover the block in which SYMBOL
302 was found, so we have no block to pass to read_var_value. This will
303 yield an incorrect value when symbol is not local to FRAME_INFO (this
304 can happen with nested functions). */
305 scoped_value_mark free_values;
306 struct value *value = read_var_value (symbol, NULL, frame_info);
307 result = value_to_value_object (value);
308 }
309 catch (const gdb_exception &except)
310 {
312 }
313
314 return result;
315}
316
317/* Given a symbol, and a symbol_object that has previously been
318 allocated and initialized, populate the symbol_object with the
319 struct symbol data. Also, register the symbol_object life-cycle
320 with the life-cycle of the object file associated with this
321 symbol, if needed. */
322static void
324{
325 obj->symbol = symbol;
326 obj->prev = NULL;
328 && symbol->symtab () != NULL)
329 {
330 struct objfile *objfile = symbol->objfile ();
331
333 if (obj->next)
334 obj->next->prev = obj;
336 }
337 else
338 obj->next = NULL;
339}
340
341/* Create a new symbol object (gdb.Symbol) that encapsulates the struct
342 symbol object from GDB. */
343PyObject *
345{
346 symbol_object *sym_obj;
347
348 sym_obj = PyObject_New (symbol_object, &symbol_object_type);
349 if (sym_obj)
350 set_symbol (sym_obj, sym);
351
352 return (PyObject *) sym_obj;
353}
354
355/* Return the symbol that is wrapped by this symbol object. */
356struct symbol *
358{
359 if (! PyObject_TypeCheck (obj, &symbol_object_type))
360 return NULL;
361 return ((symbol_object *) obj)->symbol;
362}
363
364static void
366{
367 symbol_object *sym_obj = (symbol_object *) obj;
368
369 if (sym_obj->prev)
370 sym_obj->prev->next = sym_obj->next;
371 else if (sym_obj->symbol != NULL
372 && sym_obj->symbol->is_objfile_owned ()
373 && sym_obj->symbol->symtab () != NULL)
374 sympy_objfile_data_key.set (sym_obj->symbol->objfile (), sym_obj->next);
375 if (sym_obj->next)
376 sym_obj->next->prev = sym_obj->prev;
377 sym_obj->symbol = NULL;
378 Py_TYPE (obj)->tp_free (obj);
379}
380
381/* __repr__ implementation for gdb.Symbol. */
382
383static PyObject *
385{
386 const auto symbol = symbol_object_to_symbol (self);
387 if (symbol == nullptr)
388 return PyUnicode_FromFormat ("<%s (invalid)>", Py_TYPE (self)->tp_name);
389
390 return PyUnicode_FromFormat ("<%s print_name=%s>", Py_TYPE (self)->tp_name,
391 symbol->print_name ());
392}
393
394/* Implementation of
395 gdb.lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)
396 A tuple with 2 elements is always returned. The first is the symbol
397 object or None, the second is a boolean with the value of
398 is_a_field_of_this (see comment in lookup_symbol_in_language). */
399
400PyObject *
402{
403 int domain = VAR_DOMAIN;
404 struct field_of_this_result is_a_field_of_this;
405 const char *name;
406 static const char *keywords[] = { "name", "block", "domain", NULL };
407 struct symbol *symbol = NULL;
408 PyObject *block_obj = NULL, *sym_obj, *bool_obj;
409 const struct block *block = NULL;
410
411 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name,
412 &block_object_type, &block_obj,
413 &domain))
414 return NULL;
415
416 if (block_obj)
417 block = block_object_to_block (block_obj);
418 else
419 {
421
422 try
423 {
424 selected_frame = get_selected_frame (_("No frame selected."));
426 }
427 catch (const gdb_exception &except)
428 {
430 }
431 }
432
433 try
434 {
436 &is_a_field_of_this).symbol;
437 }
438 catch (const gdb_exception &except)
439 {
441 }
442
443 gdbpy_ref<> ret_tuple (PyTuple_New (2));
444 if (ret_tuple == NULL)
445 return NULL;
446
447 if (symbol)
448 {
450 if (!sym_obj)
451 return NULL;
452 }
453 else
454 {
455 sym_obj = Py_None;
456 Py_INCREF (Py_None);
457 }
458 PyTuple_SET_ITEM (ret_tuple.get (), 0, sym_obj);
459
460 bool_obj = PyBool_FromLong (is_a_field_of_this.type != NULL);
461 PyTuple_SET_ITEM (ret_tuple.get (), 1, bool_obj);
462
463 return ret_tuple.release ();
464}
465
466/* Implementation of
467 gdb.lookup_global_symbol (name [, domain]) -> symbol or None. */
468
469PyObject *
471{
472 int domain = VAR_DOMAIN;
473 const char *name;
474 static const char *keywords[] = { "name", "domain", NULL };
475 struct symbol *symbol = NULL;
476 PyObject *sym_obj;
477
478 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
479 &domain))
480 return NULL;
481
482 try
483 {
485 }
486 catch (const gdb_exception &except)
487 {
489 }
490
491 if (symbol)
492 {
494 if (!sym_obj)
495 return NULL;
496 }
497 else
498 {
499 sym_obj = Py_None;
500 Py_INCREF (Py_None);
501 }
502
503 return sym_obj;
504}
505
506/* Implementation of
507 gdb.lookup_static_symbol (name [, domain]) -> symbol or None. */
508
509PyObject *
511{
512 const char *name;
513 int domain = VAR_DOMAIN;
514 static const char *keywords[] = { "name", "domain", NULL };
515 struct symbol *symbol = NULL;
516 PyObject *sym_obj;
517
518 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
519 &domain))
520 return NULL;
521
522 /* In order to find static symbols associated with the "current" object
523 file ahead of those from other object files, we first need to see if
524 we can acquire a current block. If this fails however, then we still
525 want to search all static symbols, so don't throw an exception just
526 yet. */
527 const struct block *block = NULL;
528 try
529 {
531 = get_selected_frame (_("No frame selected."));
533 }
534 catch (const gdb_exception_forced_quit &e)
535 {
536 quit_force (NULL, 0);
537 }
538 catch (const gdb_exception &except)
539 {
540 /* Nothing. */
541 }
542
543 try
544 {
545 if (block != nullptr)
546 symbol
548 (domain_enum) domain).symbol;
549
550 if (symbol == nullptr)
552 }
553 catch (const gdb_exception &except)
554 {
556 }
557
558 if (symbol)
559 {
561 if (!sym_obj)
562 return NULL;
563 }
564 else
565 {
566 sym_obj = Py_None;
567 Py_INCREF (Py_None);
568 }
569
570 return sym_obj;
571}
572
573/* Implementation of
574 gdb.lookup_static_symbols (name [, domain]) -> symbol list.
575
576 Returns a list of all static symbols matching NAME in DOMAIN. */
577
578PyObject *
580{
581 const char *name;
582 int domain = VAR_DOMAIN;
583 static const char *keywords[] = { "name", "domain", NULL };
584
585 if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name,
586 &domain))
587 return NULL;
588
589 gdbpy_ref<> return_list (PyList_New (0));
590 if (return_list == NULL)
591 return NULL;
592
593 try
594 {
595 /* Expand any symtabs that contain potentially matching symbols. */
597 expand_symtabs_matching (NULL, lookup_name, NULL, NULL,
599 ALL_DOMAIN);
600
602 {
603 for (compunit_symtab *cust : objfile->compunits ())
604 {
605 /* Skip included compunits to prevent including compunits from
606 being searched twice. */
607 if (cust->user != nullptr)
608 continue;
609
610 const struct blockvector *bv = cust->blockvector ();
611 const struct block *block = bv->static_block ();
612
613 if (block != nullptr)
614 {
616 (name, block, (domain_enum) domain).symbol;
617
618 if (symbol != nullptr)
619 {
620 PyObject *sym_obj
622 if (PyList_Append (return_list.get (), sym_obj) == -1)
623 return NULL;
624 }
625 }
626 }
627 }
628 }
629 catch (const gdb_exception &except)
630 {
632 }
633
634 return return_list.release ();
635}
636
639{
640 if (PyType_Ready (&symbol_object_type) < 0)
641 return -1;
642
643 if (PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF) < 0
644 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST",
645 LOC_CONST) < 0
646 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC",
647 LOC_STATIC) < 0
648 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER",
649 LOC_REGISTER) < 0
650 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG",
651 LOC_ARG) < 0
652 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG",
653 LOC_REF_ARG) < 0
654 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL",
655 LOC_LOCAL) < 0
656 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF",
657 LOC_TYPEDEF) < 0
658 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL",
659 LOC_LABEL) < 0
660 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK",
661 LOC_BLOCK) < 0
662 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
663 LOC_CONST_BYTES) < 0
664 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED",
665 LOC_UNRESOLVED) < 0
666 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
668 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED",
669 LOC_COMPUTED) < 0
670 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMMON_BLOCK",
672 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
674 || PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
675 UNDEF_DOMAIN) < 0
676 || PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN",
677 VAR_DOMAIN) < 0
678 || PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
679 STRUCT_DOMAIN) < 0
680 || PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
681 LABEL_DOMAIN) < 0
682 || PyModule_AddIntConstant (gdb_module, "SYMBOL_MODULE_DOMAIN",
683 MODULE_DOMAIN) < 0
684 || PyModule_AddIntConstant (gdb_module, "SYMBOL_COMMON_BLOCK_DOMAIN",
686 return -1;
687
688 /* These remain defined for compatibility, but as they were never
689 correct, they are no longer documented. Eventually we can remove
690 them. These exist because at one time, enum search_domain and
691 enum domain_enum_tag were combined -- but different values were
692 used differently. Here we try to give them values that will make
693 sense if they are passed to gdb.lookup_symbol. */
694 if (PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
695 VAR_DOMAIN) < 0
696 || PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
697 VAR_DOMAIN) < 0
698 || PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN",
699 VAR_DOMAIN) < 0)
700 return -1;
701
702 return gdb_pymodule_addobject (gdb_module, "Symbol",
704}
705
707
708
709
711 { "type", sympy_get_type, NULL,
712 "Type of the symbol.", NULL },
713 { "symtab", sympy_get_symtab, NULL,
714 "Symbol table in which the symbol appears.", NULL },
715 { "name", sympy_get_name, NULL,
716 "Name of the symbol, as it appears in the source code.", NULL },
717 { "linkage_name", sympy_get_linkage_name, NULL,
718 "Name of the symbol, as used by the linker (i.e., may be mangled).",
719 NULL },
720 { "print_name", sympy_get_print_name, NULL,
721 "Name of the symbol in a form suitable for output.\n\
722This is either name or linkage_name, depending on whether the user asked GDB\n\
723to display demangled or mangled names.", NULL },
724 { "addr_class", sympy_get_addr_class, NULL, "Address class of the symbol." },
725 { "is_argument", sympy_is_argument, NULL,
726 "True if the symbol is an argument of a function." },
727 { "is_constant", sympy_is_constant, NULL,
728 "True if the symbol is a constant." },
729 { "is_function", sympy_is_function, NULL,
730 "True if the symbol is a function or method." },
731 { "is_variable", sympy_is_variable, NULL,
732 "True if the symbol is a variable." },
733 { "needs_frame", sympy_needs_frame, NULL,
734 "True if the symbol requires a frame for evaluation." },
735 { "line", sympy_line, NULL,
736 "The source line number at which the symbol was defined." },
737 { NULL } /* Sentinel */
738};
739
740static PyMethodDef symbol_object_methods[] = {
741 { "is_valid", sympy_is_valid, METH_NOARGS,
742 "is_valid () -> Boolean.\n\
743Return true if this symbol is valid, false if not." },
744 { "value", sympy_value, METH_VARARGS,
745 "value ([frame]) -> gdb.Value\n\
746Return the value of the symbol." },
747 {NULL} /* Sentinel */
748};
749
750PyTypeObject symbol_object_type = {
751 PyVarObject_HEAD_INIT (NULL, 0)
752 "gdb.Symbol", /*tp_name*/
753 sizeof (symbol_object), /*tp_basicsize*/
754 0, /*tp_itemsize*/
755 sympy_dealloc, /*tp_dealloc*/
756 0, /*tp_print*/
757 0, /*tp_getattr*/
758 0, /*tp_setattr*/
759 0, /*tp_compare*/
760 sympy_repr, /*tp_repr*/
761 0, /*tp_as_number*/
762 0, /*tp_as_sequence*/
763 0, /*tp_as_mapping*/
764 0, /*tp_hash */
765 0, /*tp_call*/
766 sympy_str, /*tp_str*/
767 0, /*tp_getattro*/
768 0, /*tp_setattro*/
769 0, /*tp_as_buffer*/
770 Py_TPFLAGS_DEFAULT, /*tp_flags*/
771 "GDB symbol object", /*tp_doc */
772 0, /*tp_traverse */
773 0, /*tp_clear */
774 0, /*tp_richcompare */
775 0, /*tp_weaklistoffset */
776 0, /*tp_iter */
777 0, /*tp_iternext */
778 symbol_object_methods, /*tp_methods */
779 0, /*tp_members */
780 symbol_object_getset /*tp_getset */
781};
const char *const name
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:388
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
Definition findvar.c:739
static frame_info_ptr selected_frame
Definition frame.c:1746
frame_info_ptr get_selected_frame(const char *message)
Definition frame.c:1888
struct program_space * current_program_space
Definition progspace.c:40
PyTypeObject block_object_type
Definition py-block.c:510
const struct block * block_object_to_block(PyObject *obj)
Definition py-block.c:336
PyTypeObject frame_object_type
Definition py-frame.c:832
frame_info_ptr frame_object_to_frame_info(PyObject *obj)
Definition py-frame.c:62
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
Definition py-ref.h:42
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_symbols(void)
Definition py-symbol.c:638
struct symbol * symbol_object_to_symbol(PyObject *obj)
Definition py-symbol.c:357
static PyObject * sympy_value(PyObject *self, PyObject *args)
Definition py-symbol.c:266
static PyObject * sympy_get_print_name(PyObject *self, void *closure)
Definition py-symbol.c:138
static void set_symbol(symbol_object *obj, struct symbol *symbol)
Definition py-symbol.c:323
static PyObject * sympy_repr(PyObject *self)
Definition py-symbol.c:384
static PyObject * sympy_is_function(PyObject *self, void *closure)
Definition py-symbol.c:181
PyObject * symbol_to_symbol_object(struct symbol *sym)
Definition py-symbol.c:344
PyObject * gdbpy_lookup_static_symbol(PyObject *self, PyObject *args, PyObject *kw)
Definition py-symbol.c:510
#define SYMPY_REQUIRE_VALID(symbol_obj, symbol)
Definition py-symbol.c:43
PyObject * gdbpy_lookup_global_symbol(PyObject *self, PyObject *args, PyObject *kw)
Definition py-symbol.c:470
static PyObject * sympy_get_type(PyObject *self, void *closure)
Definition py-symbol.c:89
static PyObject * sympy_str(PyObject *self)
Definition py-symbol.c:76
static PyObject * sympy_get_symtab(PyObject *self, void *closure)
Definition py-symbol.c:105
static void sympy_dealloc(PyObject *obj)
Definition py-symbol.c:365
PyTypeObject symbol_object_type
Definition py-symbol.c:750
static PyObject * sympy_needs_frame(PyObject *self, void *closure)
Definition py-symbol.c:213
static PyMethodDef symbol_object_methods[]
Definition py-symbol.c:740
PyObject * gdbpy_lookup_symbol(PyObject *self, PyObject *args, PyObject *kw)
Definition py-symbol.c:401
static PyObject * sympy_is_constant(PyObject *self, void *closure)
Definition py-symbol.c:168
static const registry< objfile >::key< symbol_object, symbol_object_deleter > sympy_objfile_data_key
Definition py-symbol.c:73
static PyObject * sympy_get_addr_class(PyObject *self, void *closure)
Definition py-symbol.c:148
PyObject * gdbpy_lookup_static_symbols(PyObject *self, PyObject *args, PyObject *kw)
Definition py-symbol.c:579
static PyObject * sympy_line(PyObject *self, void *closure)
Definition py-symbol.c:238
static PyObject * sympy_is_argument(PyObject *self, void *closure)
Definition py-symbol.c:158
static gdb_PyGetSetDef symbol_object_getset[]
Definition py-symbol.c:710
static PyObject * sympy_get_linkage_name(PyObject *self, void *closure)
Definition py-symbol.c:128
static PyObject * sympy_is_valid(PyObject *self, PyObject *args)
Definition py-symbol.c:251
static PyObject * sympy_get_name(PyObject *self, void *closure)
Definition py-symbol.c:118
static PyObject * sympy_is_variable(PyObject *self, void *closure)
Definition py-symbol.c:194
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:1460
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
Definition py-utils.c:282
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
Definition py-utils.c:334
PyObject * value_to_value_object(struct value *val)
Definition py-value.c:1854
PyObject * gdb_module
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
#define GDBPY_INITIALIZE_FILE(INIT,...)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
static int gdb_PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, const char **keywords,...)
@ SEARCH_GLOBAL_BLOCK
@ SEARCH_STATIC_BLOCK
struct symbol * symbol
Definition symtab.h:1533
Definition block.h:109
struct block * static_block()
Definition block.h:405
struct type * type
Definition symtab.h:2048
const char * natural_name() const
Definition symtab.c:1056
const char * print_name() const
Definition symtab.h:475
const char * linkage_name() const
Definition symtab.h:460
compunit_symtab_range compunits()
Definition objfiles.h:451
objfiles_range objfiles()
Definition progspace.h:209
void operator()(symbol_object *obj)
Definition py-symbol.c:57
symbol_object * prev
Definition py-symbol.c:37
symbol_object * next
Definition py-symbol.c:38
PyObject_HEAD struct symbol * symbol
Definition py-symbol.c:32
address_class aclass() const
Definition symtab.h:1274
struct type * type() const
Definition symtab.h:1331
domain_enum domain() const
Definition symtab.h:1286
bool is_objfile_owned() const
Definition symtab.h:1296
bool is_argument() const
Definition symtab.h:1306
unsigned int line() const
Definition symtab.h:1341
struct objfile * objfile() const
Definition symtab.c:6482
symbol()
Definition symtab.h:1237
struct symtab * symtab
Definition symtab.h:1457
Definition value.h:130
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:3760
struct block_symbol lookup_static_symbol(const char *name, const domain_enum domain)
Definition symtab.c:2605
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:1964
struct block_symbol lookup_global_symbol(const char *name, const struct block *block, const domain_enum domain)
Definition symtab.c:2613
struct block_symbol lookup_symbol_in_static_block(const char *name, const struct block *block, const domain_enum domain)
Definition symtab.c:2479
@ ALL_DOMAIN
Definition symtab.h:960
address_class
Definition symtab.h:968
@ LOC_STATIC
Definition symtab.h:979
@ LOC_BLOCK
Definition symtab.h:1028
@ LOC_LABEL
Definition symtab.h:1022
@ LOC_REGISTER
Definition symtab.h:993
@ LOC_REF_ARG
Definition symtab.h:1001
@ LOC_UNRESOLVED
Definition symtab.h:1057
@ LOC_LOCAL
Definition symtab.h:1013
@ LOC_CONST
Definition symtab.h:975
@ LOC_CONST_BYTES
Definition symtab.h:1033
@ LOC_UNDEF
Definition symtab.h:971
@ LOC_OPTIMIZED_OUT
Definition symtab.h:1062
@ LOC_TYPEDEF
Definition symtab.h:1018
@ LOC_REGPARM_ADDR
Definition symtab.h:1009
@ LOC_COMMON_BLOCK
Definition symtab.h:1070
@ LOC_COMPUTED
Definition symtab.h:1066
@ LOC_ARG
Definition symtab.h:997
domain_enum
Definition symtab.h:900
@ VAR_DOMAIN
Definition symtab.h:910
@ STRUCT_DOMAIN
Definition symtab.h:916
@ LABEL_DOMAIN
Definition symtab.h:924
@ COMMON_BLOCK_DOMAIN
Definition symtab.h:928
@ UNDEF_DOMAIN
Definition symtab.h:905
@ MODULE_DOMAIN
Definition symtab.h:920
void quit_force(int *exit_arg, int from_tty)
Definition top.c:1732
int PyObject
Definition varobj.c:41