GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
py-symbol.c File Reference
#include "defs.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)
 
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)
 
int gdbpy_initialize_symbols (void)
 

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:354

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

Function Documentation

◆ gdbpy_initialize_symbols()

int gdbpy_initialize_symbols ( void  )

◆ 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 147 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 127 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 117 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 137 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 88 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 157 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 167 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 180 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 250 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 237 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_str()

static PyObject * sympy_str ( PyObject self)
static

Definition at line 75 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:137
static PyObject * sympy_is_function(PyObject *self, void *closure)
Definition py-symbol.c:180
static PyObject * sympy_get_type(PyObject *self, void *closure)
Definition py-symbol.c:88
static PyObject * sympy_get_symtab(PyObject *self, void *closure)
Definition py-symbol.c:104
static PyObject * sympy_needs_frame(PyObject *self, void *closure)
Definition py-symbol.c:212
static PyObject * sympy_is_constant(PyObject *self, void *closure)
Definition py-symbol.c:167
static PyObject * sympy_get_addr_class(PyObject *self, void *closure)
Definition py-symbol.c:147
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 PyObject * sympy_get_linkage_name(PyObject *self, void *closure)
Definition py-symbol.c:127
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

Definition at line 685 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:265
static PyObject * sympy_is_valid(PyObject *self, PyObject *args)
Definition py-symbol.c:250

Definition at line 715 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 72 of file py-symbol.c.

Referenced by set_symbol(), and sympy_dealloc().