GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
py-symbol.c File Reference
#include "defs.h"
#include "top.h"
#include "block.h"
#include "frame.h"
#include "symtab.h"
#include "python-internal.h"
#include "objfiles.h"
#include "symfile.h"

Go to the source code of this file.

Classes

struct  symbol_object
 
struct  symbol_object_deleter
 

Macros

#define SYMPY_REQUIRE_VALID(symbol_obj, symbol)
 

Functions

static PyObjectsympy_str (PyObject *self)
 
static PyObjectsympy_get_type (PyObject *self, void *closure)
 
static PyObjectsympy_get_symtab (PyObject *self, void *closure)
 
static PyObjectsympy_get_name (PyObject *self, void *closure)
 
static PyObjectsympy_get_linkage_name (PyObject *self, void *closure)
 
static PyObjectsympy_get_print_name (PyObject *self, void *closure)
 
static PyObjectsympy_get_addr_class (PyObject *self, void *closure)
 
static PyObjectsympy_is_argument (PyObject *self, void *closure)
 
static PyObjectsympy_is_constant (PyObject *self, void *closure)
 
static PyObjectsympy_is_function (PyObject *self, void *closure)
 
static PyObjectsympy_is_variable (PyObject *self, void *closure)
 
static PyObjectsympy_needs_frame (PyObject *self, void *closure)
 
static PyObjectsympy_line (PyObject *self, void *closure)
 
static PyObjectsympy_is_valid (PyObject *self, PyObject *args)
 
static PyObjectsympy_value (PyObject *self, PyObject *args)
 
static void set_symbol (symbol_object *obj, struct symbol *symbol)
 
PyObjectsymbol_to_symbol_object (struct symbol *sym)
 
struct symbolsymbol_object_to_symbol (PyObject *obj)
 
static void sympy_dealloc (PyObject *obj)
 
static PyObjectsympy_repr (PyObject *self)
 
PyObjectgdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
PyObjectgdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
PyObjectgdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
PyObjectgdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
 
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_symbols (void)
 
 GDBPY_INITIALIZE_FILE (gdbpy_initialize_symbols)
 

Variables

static const registry< objfile >::key< symbol_object, symbol_object_deletersympy_objfile_data_key
 
static gdb_PyGetSetDef symbol_object_getset []
 
static PyMethodDef symbol_object_methods []
 
PyTypeObject symbol_object_type
 

Macro Definition Documentation

◆ SYMPY_REQUIRE_VALID

#define SYMPY_REQUIRE_VALID ( symbol_obj,
symbol )
Value:
do { \
symbol = symbol_object_to_symbol (symbol_obj); \
if (symbol == NULL) \
{ \
PyErr_SetString (PyExc_RuntimeError, \
_("Symbol is invalid.")); \
return NULL; \
} \
} while (0)
struct symbol * symbol_object_to_symbol(PyObject *obj)
Definition py-symbol.c:357

Definition at line 43 of file py-symbol.c.

Referenced by sympy_get_addr_class(), sympy_get_linkage_name(), sympy_get_name(), sympy_get_print_name(), sympy_get_symtab(), sympy_get_type(), sympy_is_argument(), sympy_is_constant(), sympy_is_function(), sympy_is_variable(), sympy_line(), sympy_needs_frame(), sympy_str(), and sympy_value().

Function Documentation

◆ GDBPY_INITIALIZE_FILE()

GDBPY_INITIALIZE_FILE ( gdbpy_initialize_symbols )

◆ gdbpy_initialize_symbols()

static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_symbols ( void )
static

◆ gdbpy_lookup_global_symbol()

PyObject * gdbpy_lookup_global_symbol ( PyObject * self,
PyObject * args,
PyObject * kw )

◆ gdbpy_lookup_static_symbol()

PyObject * gdbpy_lookup_static_symbol ( PyObject * self,
PyObject * args,
PyObject * kw )

◆ gdbpy_lookup_static_symbols()

PyObject * gdbpy_lookup_static_symbols ( PyObject * self,
PyObject * args,
PyObject * kw )

◆ gdbpy_lookup_symbol()

PyObject * gdbpy_lookup_symbol ( PyObject * self,
PyObject * args,
PyObject * kw )

◆ set_symbol()

static void set_symbol ( symbol_object * obj,
struct symbol * symbol )
static

◆ symbol_object_to_symbol()

struct symbol * symbol_object_to_symbol ( PyObject * obj)

◆ symbol_to_symbol_object()

PyObject * symbol_to_symbol_object ( struct symbol * sym)

◆ sympy_dealloc()

static void sympy_dealloc ( PyObject * obj)
static

◆ sympy_get_addr_class()

static PyObject * sympy_get_addr_class ( PyObject * self,
void * closure )
static

Definition at line 148 of file py-symbol.c.

References symbol::aclass(), gdb_py_object_from_longest(), and SYMPY_REQUIRE_VALID.

◆ sympy_get_linkage_name()

static PyObject * sympy_get_linkage_name ( PyObject * self,
void * closure )
static

Definition at line 128 of file py-symbol.c.

References general_symbol_info::linkage_name(), and SYMPY_REQUIRE_VALID.

◆ sympy_get_name()

static PyObject * sympy_get_name ( PyObject * self,
void * closure )
static

Definition at line 118 of file py-symbol.c.

References general_symbol_info::natural_name(), and SYMPY_REQUIRE_VALID.

◆ sympy_get_print_name()

static PyObject * sympy_get_print_name ( PyObject * self,
void * closure )
static

Definition at line 138 of file py-symbol.c.

References SYMPY_REQUIRE_VALID, and sympy_str().

◆ sympy_get_symtab()

static PyObject * sympy_get_symtab ( PyObject * self,
void * closure )
static

◆ sympy_get_type()

static PyObject * sympy_get_type ( PyObject * self,
void * closure )
static

Definition at line 89 of file py-symbol.c.

References SYMPY_REQUIRE_VALID, symbol::type(), and type_to_type_object().

◆ sympy_is_argument()

static PyObject * sympy_is_argument ( PyObject * self,
void * closure )
static

Definition at line 158 of file py-symbol.c.

References symbol::is_argument(), and SYMPY_REQUIRE_VALID.

◆ sympy_is_constant()

static PyObject * sympy_is_constant ( PyObject * self,
void * closure )
static

Definition at line 168 of file py-symbol.c.

References symbol::aclass(), LOC_CONST, LOC_CONST_BYTES, and SYMPY_REQUIRE_VALID.

◆ sympy_is_function()

static PyObject * sympy_is_function ( PyObject * self,
void * closure )
static

Definition at line 181 of file py-symbol.c.

References symbol::aclass(), LOC_BLOCK, and SYMPY_REQUIRE_VALID.

◆ sympy_is_valid()

static PyObject * sympy_is_valid ( PyObject * self,
PyObject * args )
static

Definition at line 251 of file py-symbol.c.

References symbol_object_to_symbol().

◆ sympy_is_variable()

static PyObject * sympy_is_variable ( PyObject * self,
void * closure )
static

◆ sympy_line()

static PyObject * sympy_line ( PyObject * self,
void * closure )
static

Definition at line 238 of file py-symbol.c.

References gdb_py_object_from_longest(), symbol::line(), and SYMPY_REQUIRE_VALID.

◆ sympy_needs_frame()

static PyObject * sympy_needs_frame ( PyObject * self,
void * closure )
static

◆ sympy_repr()

static PyObject * sympy_repr ( PyObject * self)
static

Definition at line 384 of file py-symbol.c.

References general_symbol_info::print_name(), and symbol_object_to_symbol().

◆ sympy_str()

static PyObject * sympy_str ( PyObject * self)
static

Definition at line 76 of file py-symbol.c.

References general_symbol_info::print_name(), and SYMPY_REQUIRE_VALID.

Referenced by sympy_get_print_name().

◆ sympy_value()

static PyObject * sympy_value ( PyObject * self,
PyObject * args )
static

Variable Documentation

◆ symbol_object_getset

gdb_PyGetSetDef symbol_object_getset[]
static
Initial value:
= {
{ "type", sympy_get_type, NULL,
"Type of the symbol.", NULL },
{ "symtab", sympy_get_symtab, NULL,
"Symbol table in which the symbol appears.", NULL },
{ "name", sympy_get_name, NULL,
"Name of the symbol, as it appears in the source code.", NULL },
{ "linkage_name", sympy_get_linkage_name, NULL,
"Name of the symbol, as used by the linker (i.e., may be mangled).",
NULL },
{ "print_name", sympy_get_print_name, NULL,
"Name of the symbol in a form suitable for output.\n\
This is either name or linkage_name, depending on whether the user asked GDB\n\
to display demangled or mangled names.", NULL },
{ "addr_class", sympy_get_addr_class, NULL, "Address class of the symbol." },
{ "is_argument", sympy_is_argument, NULL,
"True if the symbol is an argument of a function." },
{ "is_constant", sympy_is_constant, NULL,
"True if the symbol is a constant." },
{ "is_function", sympy_is_function, NULL,
"True if the symbol is a function or method." },
{ "is_variable", sympy_is_variable, NULL,
"True if the symbol is a variable." },
{ "needs_frame", sympy_needs_frame, NULL,
"True if the symbol requires a frame for evaluation." },
{ "line", sympy_line, NULL,
"The source line number at which the symbol was defined." },
{ NULL }
}
static PyObject * sympy_get_print_name(PyObject *self, void *closure)
Definition py-symbol.c:138
static PyObject * sympy_is_function(PyObject *self, void *closure)
Definition py-symbol.c:181
static PyObject * sympy_get_type(PyObject *self, void *closure)
Definition py-symbol.c:89
static PyObject * sympy_get_symtab(PyObject *self, void *closure)
Definition py-symbol.c:105
static PyObject * sympy_needs_frame(PyObject *self, void *closure)
Definition py-symbol.c:213
static PyObject * sympy_is_constant(PyObject *self, void *closure)
Definition py-symbol.c:168
static PyObject * sympy_get_addr_class(PyObject *self, void *closure)
Definition py-symbol.c:148
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 PyObject * sympy_get_linkage_name(PyObject *self, void *closure)
Definition py-symbol.c:128
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

Definition at line 710 of file py-symbol.c.

◆ symbol_object_methods

PyMethodDef symbol_object_methods[]
static
Initial value:
= {
{ "is_valid", sympy_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return true if this symbol is valid, false if not." },
{ "value", sympy_value, METH_VARARGS,
"value ([frame]) -> gdb.Value\n\
Return the value of the symbol." },
{NULL}
}
static PyObject * sympy_value(PyObject *self, PyObject *args)
Definition py-symbol.c:266
static PyObject * sympy_is_valid(PyObject *self, PyObject *args)
Definition py-symbol.c:251

Definition at line 740 of file py-symbol.c.

◆ symbol_object_type

PyTypeObject symbol_object_type

◆ sympy_objfile_data_key

const registry<objfile>::key<symbol_object, symbol_object_deleter> sympy_objfile_data_key
static

Definition at line 73 of file py-symbol.c.

Referenced by set_symbol(), and sympy_dealloc().