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.")); \ 170 return PyBool_FromLong (theclass ==
LOC_BLOCK);
251 PyObject *frame_obj = NULL;
254 if (!PyArg_ParseTuple (args,
"|O", &frame_obj))
259 PyErr_SetString (PyExc_TypeError,
"argument is not a frame");
266 PyErr_SetString (PyExc_TypeError,
"cannot get the value of a typedef");
272 if (frame_obj != NULL)
276 error (
_(
"invalid frame"));
280 error (
_(
"symbol requires a frame to compute its value"));
333 return (PyObject *) sym_obj;
352 else if (sym_obj->
symbol != NULL
376 static const char *keywords[] = {
"name",
"block",
"domain", NULL };
378 PyObject *block_obj = NULL, *sym_obj, *bool_obj;
407 &is_a_field_of_this).
symbol;
416 if (ret_tuple == NULL)
430 PyTuple_SET_ITEM (ret_tuple.get (), 0, sym_obj);
432 bool_obj = (is_a_field_of_this.
type != NULL) ? Py_True : Py_False;
433 Py_INCREF (bool_obj);
434 PyTuple_SET_ITEM (ret_tuple.get (), 1, bool_obj);
436 return ret_tuple.release ();
447 static const char *keywords[] = {
"name",
"domain", NULL };
514 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_CONST",
516 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_STATIC",
518 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_REGISTER",
520 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_ARG",
522 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_REF_ARG",
524 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_LOCAL",
526 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_TYPEDEF",
528 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_LABEL",
530 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_BLOCK",
532 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_CONST_BYTES",
534 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_UNRESOLVED",
536 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_OPTIMIZED_OUT",
538 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_COMPUTED",
540 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LOC_REGPARM_ADDR",
542 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_UNDEF_DOMAIN",
544 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_VAR_DOMAIN",
546 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_STRUCT_DOMAIN",
548 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_LABEL_DOMAIN",
550 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_VARIABLES_DOMAIN",
552 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_FUNCTIONS_DOMAIN",
554 || PyModule_AddIntConstant (
gdb_module,
"SYMBOL_TYPES_DOMAIN",
566 "Type of the symbol.", NULL },
568 "Symbol table in which the symbol appears.", NULL },
570 "Name of the symbol, as it appears in the source code.", NULL },
572 "Name of the symbol, as used by the linker (i.e., may be mangled).",
575 "Name of the symbol in a form suitable for output.\n\ 576 This is either name or linkage_name, depending on whether the user asked GDB\n\ 577 to display demangled or mangled names.", NULL },
580 "True if the symbol is an argument of a function." },
582 "True if the symbol is a constant." },
584 "True if the symbol is a function or method." },
586 "True if the symbol is a variable." },
588 "True if the symbol requires a frame for evaluation." },
590 "The source line number at which the symbol was defined." },
596 "is_valid () -> Boolean.\n\ 597 Return true if this symbol is valid, false if not." },
599 "value ([frame]) -> gdb.Value\n\ 600 Return the value of the symbol." },
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
int gdbpy_initialize_symbols(void)
static PyObject * sympy_value(PyObject *self, PyObject *args)
struct frame_info * get_selected_frame(const char *message)
#define SYMBOL_PRINT_NAME(symbol)
static struct frame_info * selected_frame
struct sympy_symbol_object * next
static void sympy_dealloc(PyObject *obj)
static void set_symbol(symbol_object *obj, struct symbol *symbol)
static PyObject * sympy_get_linkage_name(PyObject *self, void *closure)
enum domain_enum_tag domain_enum
PyTypeObject block_object_type
struct sympy_symbol_object symbol_object
#define SYMBOL_CLASS(symbol)
PyObject_HEAD struct symbol * symbol
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)
static int gdb_PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, const char **keywords,...)
struct symbol * symbol_object_to_symbol(PyObject *obj)
#define PyVarObject_HEAD_INIT(type, size)
PyTypeObject frame_object_type
struct objfile * symbol_objfile(const struct symbol *symbol)
static PyObject * sympy_get_addr_class(PyObject *self, void *closure)
static PyObject * sympy_line(PyObject *self, void *closure)
PyObject * symtab_to_symtab_object(struct symtab *symtab)
static const struct objfile_data * sympy_objfile_data_key
#define GDB_PY_HANDLE_EXCEPTION(Exception)
PyTypeObject symbol_object_type
static gdb_PyGetSetDef symbol_object_getset[]
#define CATCH(EXCEPTION, MASK)
static PyObject * sympy_is_function(PyObject *self, void *closure)
struct value * read_var_value(struct symbol *var, const struct block *var_block, struct frame_info *frame)
const struct block * get_frame_block(struct frame_info *frame, CORE_ADDR *addr_in_block)
int symbol_read_needs_frame(struct symbol *sym)
const struct block * block_object_to_block(PyObject *obj)
#define SYMBOL_LINE(symbol)
#define SYMBOL_LINKAGE_NAME(symbol)
PyObject * value_to_value_object(struct value *val)
PyObject * gdbpy_lookup_symbol(PyObject *self, PyObject *args, PyObject *kw)
static PyObject * sympy_is_variable(PyObject *self, void *closure)
struct block_symbol lookup_global_symbol(const char *name, const struct block *block, const domain_enum domain)
static void del_objfile_symbols(struct objfile *objfile, void *datum)
static PyObject * sympy_str(PyObject *self)
static PyObject * sympy_get_name(PyObject *self, void *closure)
#define SYMBOL_OBJFILE_OWNED(symbol)
#define SYMPY_REQUIRE_VALID(symbol_obj, symbol)
static PyObject * sympy_get_symtab(PyObject *self, void *closure)
static PyObject * sympy_get_print_name(PyObject *self, void *closure)
static PyMethodDef symbol_object_methods[]
static PyObject * sympy_is_constant(PyObject *self, void *closure)
PyObject * gdbpy_lookup_global_symbol(PyObject *self, PyObject *args, PyObject *kw)
#define SYMBOL_NATURAL_NAME(symbol)
#define SYMBOL_TYPE(symbol)
struct sympy_symbol_object * prev
static PyObject * sympy_is_argument(PyObject *self, void *closure)
PyObject * symbol_to_symbol_object(struct symbol *sym)
struct frame_info * frame_object_to_frame_info(PyObject *obj)
static PyObject * sympy_is_valid(PyObject *self, PyObject *args)
struct symtab * symbol_symtab(const struct symbol *symbol)
void error(const char *fmt,...)
static PyObject * sympy_get_type(PyObject *self, void *closure)
#define SYMBOL_IS_ARGUMENT(symbol)
static PyObject * sympy_needs_frame(PyObject *self, void *closure)
__extension__ enum domain_enum_tag domain
PyObject * type_to_type_object(struct type *type)