42#define SYMPY_REQUIRE_VALID(symbol_obj, symbol) \
44 symbol = symbol_object_to_symbol (symbol_obj); \
47 PyErr_SetString (PyExc_RuntimeError, \
48 _("Symbol is invalid.")); \
189 return PyBool_FromLong (theclass ==
LOC_BLOCK);
223 catch (
const gdb_exception &except)
269 PyObject *frame_obj = NULL;
272 if (!PyArg_ParseTuple (args,
"|O", &frame_obj))
277 PyErr_SetString (PyExc_TypeError,
"argument is not a frame");
284 PyErr_SetString (PyExc_TypeError,
"cannot get the value of a typedef");
290 if (frame_obj != NULL)
294 error (_(
"invalid frame"));
298 error (_(
"symbol requires a frame to compute its value"));
306 catch (
const gdb_exception &except)
349 return (PyObject *) sym_obj;
368 else if (sym_obj->
symbol != NULL
375 Py_TYPE (obj)->tp_free (obj);
390 static const char *keywords[] = {
"name",
"block",
"domain", NULL };
392 PyObject *block_obj = NULL, *sym_obj, *bool_obj;
411 catch (
const gdb_exception &except)
420 &is_a_field_of_this).
symbol;
422 catch (
const gdb_exception &except)
428 if (ret_tuple == NULL)
442 PyTuple_SET_ITEM (ret_tuple.get (), 0, sym_obj);
444 bool_obj = PyBool_FromLong (is_a_field_of_this.
type != NULL);
445 PyTuple_SET_ITEM (ret_tuple.get (), 1, bool_obj);
447 return ret_tuple.release ();
458 static const char *keywords[] = {
"name",
"domain", NULL };
470 catch (
const gdb_exception &except)
498 static const char *keywords[] = {
"name",
"domain", NULL };
518 catch (
const gdb_exception &except)
525 if (
block !=
nullptr)
533 catch (
const gdb_exception &except)
563 static const char *keywords[] = {
"name",
"domain", NULL };
570 if (return_list == NULL)
587 bv = cust->blockvector ();
590 if (
block !=
nullptr)
599 if (PyList_Append (return_list.get (), sym_obj) == -1)
606 catch (
const gdb_exception &except)
611 return return_list.release ();
621 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_CONST",
623 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_STATIC",
625 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_REGISTER",
627 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_ARG",
629 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_REF_ARG",
631 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_LOCAL",
633 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_TYPEDEF",
635 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_LABEL",
637 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_BLOCK",
639 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_CONST_BYTES",
641 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_UNRESOLVED",
643 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_OPTIMIZED_OUT",
645 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_COMPUTED",
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",
653 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_VAR_DOMAIN",
655 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_STRUCT_DOMAIN",
657 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LABEL_DOMAIN",
659 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_MODULE_DOMAIN",
661 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_COMMON_BLOCK_DOMAIN",
671 if (PyModule_AddIntConstant (
gdb_module,
"SYMBOL_VARIABLES_DOMAIN",
673 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_FUNCTIONS_DOMAIN",
675 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_TYPES_DOMAIN",
687 "Type of the symbol.", NULL },
689 "Symbol table in which the symbol appears.", NULL },
691 "Name of the symbol, as it appears in the source code.", NULL },
693 "Name of the symbol, as used by the linker (i.e., may be mangled).",
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 },
701 "True if the symbol is an argument of a function." },
703 "True if the symbol is a constant." },
705 "True if the symbol is a function or method." },
707 "True if the symbol is a variable." },
709 "True if the symbol requires a frame for evaluation." },
711 "The source line number at which the symbol was defined." },
717 "is_valid () -> Boolean.\n\
718Return true if this symbol is valid, false if not." },
720 "value ([frame]) -> gdb.Value\n\
721Return the value of the symbol." },
726 PyVarObject_HEAD_INIT (NULL, 0)
const struct block * get_frame_block(frame_info_ptr frame, CORE_ADDR *addr_in_block)
void set(unsigned key, void *datum)
int symbol_read_needs_frame(struct symbol *sym)
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
static frame_info_ptr selected_frame
frame_info_ptr get_selected_frame(const char *message)
struct program_space * current_program_space
PyTypeObject block_object_type
const struct block * block_object_to_block(PyObject *obj)
PyTypeObject frame_object_type
frame_info_ptr frame_object_to_frame_info(PyObject *obj)
gdb::ref_ptr< T, gdbpy_ref_policy< T > > gdbpy_ref
struct symbol * symbol_object_to_symbol(PyObject *obj)
static PyObject * sympy_value(PyObject *self, PyObject *args)
static PyObject * sympy_get_print_name(PyObject *self, void *closure)
static void set_symbol(symbol_object *obj, struct symbol *symbol)
int gdbpy_initialize_symbols(void)
static PyObject * sympy_is_function(PyObject *self, void *closure)
PyObject * symbol_to_symbol_object(struct symbol *sym)
PyObject * gdbpy_lookup_static_symbol(PyObject *self, PyObject *args, PyObject *kw)
#define SYMPY_REQUIRE_VALID(symbol_obj, symbol)
PyObject * gdbpy_lookup_global_symbol(PyObject *self, PyObject *args, PyObject *kw)
static PyObject * sympy_get_type(PyObject *self, void *closure)
static PyObject * sympy_str(PyObject *self)
static PyObject * sympy_get_symtab(PyObject *self, void *closure)
static void sympy_dealloc(PyObject *obj)
PyTypeObject symbol_object_type
static PyObject * sympy_needs_frame(PyObject *self, void *closure)
static PyMethodDef symbol_object_methods[]
PyObject * gdbpy_lookup_symbol(PyObject *self, PyObject *args, PyObject *kw)
static PyObject * sympy_is_constant(PyObject *self, void *closure)
static const registry< objfile >::key< symbol_object, symbol_object_deleter > sympy_objfile_data_key
static PyObject * sympy_get_addr_class(PyObject *self, void *closure)
PyObject * gdbpy_lookup_static_symbols(PyObject *self, PyObject *args, PyObject *kw)
static PyObject * sympy_line(PyObject *self, void *closure)
static PyObject * sympy_is_argument(PyObject *self, void *closure)
static gdb_PyGetSetDef symbol_object_getset[]
static PyObject * sympy_get_linkage_name(PyObject *self, void *closure)
static PyObject * sympy_is_valid(PyObject *self, PyObject *args)
static PyObject * sympy_get_name(PyObject *self, void *closure)
static PyObject * sympy_is_variable(PyObject *self, void *closure)
PyObject * symtab_to_symtab_object(struct symtab *symtab)
PyObject * type_to_type_object(struct type *type)
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
PyObject * value_to_value_object(struct value *val)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
static int gdb_PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, const char **keywords,...)
struct block * static_block()
const char * natural_name() const
const char * print_name() const
const char * linkage_name() const
compunit_symtab_range compunits()
objfiles_range objfiles()
void operator()(symbol_object *obj)
PyObject_HEAD struct symbol * symbol
address_class aclass() const
struct type * type() const
domain_enum domain() const
bool is_objfile_owned() const
struct objfile * objfile() const
unsigned short line() const
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)
struct block_symbol lookup_static_symbol(const char *name, const domain_enum domain)
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)
struct block_symbol lookup_global_symbol(const char *name, const struct block *block, const domain_enum domain)
struct block_symbol lookup_symbol_in_static_block(const char *name, const struct block *block, const domain_enum domain)