This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC][patch 7/9] export block and symbol mechanism to Python
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 29 Apr 2008 12:52:19 -0300
- Subject: [RFC][patch 7/9] export block and symbol mechanism to Python
- References: <20080429155212.444237503@br.ibm.com>
2008-04-29 Thiago Jung Bauermann <bauerman@br.ibm.com>
* Makefile.in (SUBDIR_PYTHON_OBS): Add python-block.o and
python-symbol.o.
(SUBDIR_PYTHON_SRCS): Add python/block.c and python/symbol.c.
(python-block.o, python-symbol.o): New targets.
* python/block.c: New file.
* python/python-internal.h (block_object_type,
symbol_object_type, symbol_to_symbol_object,
block_to_block_object, block_object_to_block,
symbol_object_to_symbol, gdbpy_initialize_symbols,
gdbpy_initialize_blocks): Declare.
* python/python.c (demand_python): Add find_pc_function function.
Call gdbpy_initialize_symbols and gdbpy_initialize_blocks.
(gdbpy_find_pc_function): New function.
* python/symbol.c: New file.
Index: tromey.git/gdb/Makefile.in
===================================================================
--- tromey.git.orig/gdb/Makefile.in 2008-04-29 11:05:45.000000000 -0300
+++ tromey.git/gdb/Makefile.in 2008-04-29 11:06:02.000000000 -0300
@@ -262,17 +262,21 @@ SUBDIR_TUI_CFLAGS= \
#
SUBDIR_PYTHON_OBS = \
python.o \
+ python-block.o \
python-breakpoint.o \
python-cmd.o \
python-frame.o \
python-hooks.o \
+ python-symbol.o \
python-value.o
SUBDIR_PYTHON_SRCS = \
python/python.c \
+ python/block.c \
python/breakpoint.c \
python/cmd.c \
python/frame.c \
python/hooks.c \
+ python/symbol.c \
python/value.c
SUBDIR_PYTHON_DEPS =
SUBDIR_PYTHON_LDFLAGS=
@@ -3421,6 +3425,10 @@ python.o: $(srcdir)/python/python.c $(de
$(command_h) $(libiberty_h) $(cli_decode_h) $(charset_h) $(top_h) \
$(exceptions_h) $(python_internal_h) $(version_h) $(solib_h)
$(CC) -c $(INTERNAL_CFLAGS) $(PYTHON_CFLAGS) $(srcdir)/python/python.c
+python-block.o: $(srcdir)/python/block.c $(defs_h) $(block_h) $(dictionary_h) \
+ $(symtab_h) $(python_h) $(python_internal_h)
+ $(CC) -c $(INTERNAL_CFLAGS) $(PYTHON_CFLAGS) \
+ $(srcdir)/python/block.c -o python-block.o
python-breakpoint.o: $(srcdir)/python/breakpoint.c $(defs_h) $(python_h) \
$(value_h) $(exceptions_h) $(python_internal_h) $(charset_h) \
$(breakpoint_h) $(gdbcmd_h)
@@ -3440,6 +3448,10 @@ python-hooks.o: $(srcdir)/python/hooks.c
$(charset_h) $(gdb_events_h) $(python_h) $(python_internal_h)
$(CC) -c $(INTERNAL_CFLAGS) $(PYTHON_CFLAGS) \
$(srcdir)/python/hooks.c -o python-hooks.o
+python-symbol.o: $(srcdir)/python/symbol.c $(defs_h) $(symtab_h) $(python_h) \
+ $(python_internal_h)
+ $(CC) -c $(INTERNAL_CFLAGS) $(PYTHON_CFLAGS) \
+ $(srcdir)/python/symbol.c -o python-symbol.o
python-value.o: $(srcdir)/python/value.c $(defs_h) $(exceptions_h) \
$(python_internal_h) $(value_h)
$(CC) -c $(INTERNAL_CFLAGS) $(PYTHON_CFLAGS) \
Index: tromey.git/gdb/python/block.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ tromey.git/gdb/python/block.c 2008-04-29 11:06:02.000000000 -0300
@@ -0,0 +1,258 @@
+/* Python interface to blocks.
+
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "block.h"
+#include "dictionary.h"
+#include "symtab.h"
+#include "python-internal.h"
+
+typedef struct {
+ PyObject_HEAD
+ struct block *block;
+} block_object;
+
+static PyObject *blpy_iter (PyObject *self);
+static PyObject *blpy_itersymbols (PyObject *self, PyObject *args);
+static PyObject *blpy_get_start (PyObject *self, PyObject *args);
+static PyObject *blpy_get_end (PyObject *self, PyObject *args);
+static PyObject *blpy_get_function (PyObject *self, PyObject *args);
+static PyObject *blpy_get_superblock (PyObject *self, PyObject *args);
+
+static PyMethodDef block_object_methods[] = {
+ { "itersymbols", blpy_itersymbols, METH_NOARGS,
+ "Return an iterator to walk through the symbols in the block." },
+ { "get_start", blpy_get_start, METH_NOARGS,
+ "Return the start address of this block." },
+ { "get_end", blpy_get_end, METH_NOARGS,
+ "Return the end address of this block." },
+ { "get_function", blpy_get_function, METH_NOARGS,
+ "Return the symbol that names this block, or None." },
+ { "get_superblock", blpy_get_end, METH_NOARGS,
+ "Return the block containing this block, or None." },
+ {NULL} /* Sentinel */
+};
+
+PyTypeObject block_object_type = {
+ PyObject_HEAD_INIT (NULL)
+ 0, /*ob_size*/
+ "gdb.Block", /*tp_name*/
+ sizeof (block_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/
+ "GDB block object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ blpy_iter, /* tp_iter */
+ 0, /* tp_iternext */
+ block_object_methods /* tp_methods */
+};
+
+typedef struct {
+ PyObject_HEAD
+ struct dictionary *dict;
+ struct dict_iterator iter;
+ int initialized_p;
+} block_syms_iterator_object;
+
+static PyObject *blpy_block_syms_iter (PyObject *self);
+static PyObject *blpy_block_syms_iternext (PyObject *self);
+
+static PyTypeObject block_syms_iterator_object_type = {
+ PyObject_HEAD_INIT (NULL)
+ 0, /*ob_size*/
+ "gdb.BlockIterator", /*tp_name*/
+ sizeof (block_syms_iterator_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/
+ "GDB block syms iterator object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ blpy_block_syms_iter, /* tp_iter */
+ blpy_block_syms_iternext, /* tp_iternext */
+ 0 /* tp_methods */
+};
+
+
+static PyObject *
+blpy_iter (PyObject *self)
+{
+ block_syms_iterator_object *block_iter_obj;
+
+ block_iter_obj = PyObject_New (block_syms_iterator_object,
+ &block_syms_iterator_object_type);
+ if (block_iter_obj == NULL)
+ {
+ PyErr_SetString (PyExc_MemoryError,
+ "Could not allocate iterator object.");
+ return NULL;
+ }
+
+ block_iter_obj->dict = BLOCK_DICT (((block_object *) self)->block);
+ block_iter_obj->initialized_p = 0;
+
+ return (PyObject *) block_iter_obj;
+}
+
+static PyObject *
+blpy_itersymbols (PyObject *self, PyObject *args)
+{
+ return blpy_iter (self);
+}
+
+static PyObject *
+blpy_get_start (PyObject *self, PyObject *args)
+{
+ block_object *self_block = (block_object *) self;
+
+ return PyLong_FromUnsignedLongLong (BLOCK_START (self_block->block));
+}
+
+static PyObject *
+blpy_get_end (PyObject *self, PyObject *args)
+{
+ block_object *self_block = (block_object *) self;
+
+ return PyLong_FromUnsignedLongLong (BLOCK_END (self_block->block));
+}
+
+static PyObject *
+blpy_get_function (PyObject *self, PyObject *args)
+{
+ block_object *self_block = (block_object *) self;
+ struct symbol *sym;
+
+ sym = BLOCK_FUNCTION (self_block->block);
+ if (sym)
+ return symbol_to_symbol_object (sym);
+
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+blpy_get_superblock (PyObject *self, PyObject *args)
+{
+ block_object *self_block = (block_object *) self;
+ struct block *block;
+
+ block = BLOCK_SUPERBLOCK (self_block->block);
+ if (block)
+ return block_to_block_object (block);
+
+ Py_RETURN_NONE;
+}
+
+PyObject *
+block_to_block_object (struct block *block)
+{
+ block_object *block_obj;
+
+ block_obj = PyObject_New (block_object, &block_object_type);
+ if (block_obj == NULL)
+ {
+ PyErr_SetString (PyExc_MemoryError, "Could not allocate block object.");
+ return NULL;
+ }
+
+ block_obj->block = block;
+
+ return (PyObject *) block_obj;
+}
+
+struct block *
+block_object_to_block (PyObject *obj)
+{
+ return ((block_object *) obj)->block;
+}
+
+static PyObject *
+blpy_block_syms_iter (PyObject *self)
+{
+ return self;
+}
+
+static PyObject *
+blpy_block_syms_iternext (PyObject *self)
+{
+ block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) self;
+ struct symbol *sym;
+
+ if (!iter_obj->initialized_p)
+ {
+ sym = dict_iterator_first (iter_obj->dict, &(iter_obj->iter));
+ iter_obj->initialized_p = 1;
+ }
+ else
+ sym = dict_iterator_next (&(iter_obj->iter));
+
+ return (sym == NULL)? NULL : symbol_to_symbol_object (sym);
+}
+
+void
+gdbpy_initialize_blocks (void)
+{
+ block_object_type.tp_new = PyType_GenericNew;
+ if (PyType_Ready (&block_object_type) < 0)
+ return;
+
+ block_syms_iterator_object_type.tp_new = PyType_GenericNew;
+ if (PyType_Ready (&block_syms_iterator_object_type) < 0)
+ return;
+
+ Py_INCREF (&block_object_type);
+ PyModule_AddObject (gdb_module, "Block", (PyObject *) &block_object_type);
+
+ Py_INCREF (&block_syms_iterator_object_type);
+ PyModule_AddObject (gdb_module, "BlockIterator",
+ (PyObject *) &block_syms_iterator_object_type);
+}
Index: tromey.git/gdb/python/python-internal.h
===================================================================
--- tromey.git.orig/gdb/python/python-internal.h 2008-04-29 11:05:45.000000000 -0300
+++ tromey.git/gdb/python/python-internal.h 2008-04-29 11:06:02.000000000 -0300
@@ -27,7 +27,9 @@
#endif
extern PyObject *gdb_module;
+extern PyTypeObject block_object_type;
extern PyTypeObject value_object_type;
+extern PyTypeObject symbol_object_type;
PyObject *gdbpy_make_value_from_int (PyObject *self, PyObject *args);
PyObject *gdbpy_get_value_from_history (PyObject *self, PyObject *args);
@@ -38,9 +40,13 @@ PyObject *gdbpy_frame_stop_reason_string
PyObject *gdbpy_get_selected_frame (PyObject *self, PyObject *args);
PyObject *variable_to_python (struct cmd_list_element *);
+PyObject *symbol_to_symbol_object (struct symbol *sym);
+PyObject *block_to_block_object (struct block *block);
PyObject *value_to_value_object (struct value *v);
PyObject *gdb_owned_value_to_value_object (struct value *v);
+struct block *block_object_to_block (PyObject *obj);
+struct symbol *symbol_object_to_symbol (PyObject *obj);
struct value *value_object_to_value (PyObject *self);
PyObject *gdbpy_get_hook_function (const char *);
@@ -50,6 +56,8 @@ void gdbpy_initialize_hooks (void);
void gdbpy_initialize_breakpoints (void);
void gdbpy_initialize_frames (void);
void gdbpy_initialize_commands (void);
+void gdbpy_initialize_symbols (void);
+void gdbpy_initialize_blocks (void);
/* Use this after a TRY_EXCEPT to throw the appropriate Python
exception. FIXME: throw different errors depending on
Index: tromey.git/gdb/python/python.c
===================================================================
--- tromey.git.orig/gdb/python/python.c 2008-04-29 11:05:45.000000000 -0300
+++ tromey.git/gdb/python/python.c 2008-04-29 11:06:02.000000000 -0300
@@ -36,6 +36,7 @@ PyObject *gdb_module;
static PyObject *get_show_variable (PyObject *, PyObject *);
static PyObject *execute_gdb_command (PyObject *, PyObject *);
static PyObject *gdbpy_solib_address (PyObject *, PyObject *);
+static PyObject *gdbpy_find_pc_function (PyObject *, PyObject *);
void
@@ -70,6 +71,9 @@ demand_python ()
{ "solib_address", gdbpy_solib_address, METH_VARARGS,
"Return shared library holding a given address, or None." },
+ { "find_pc_function", gdbpy_find_pc_function, METH_VARARGS,
+ "Return the function containing the given pc value, or None." },
+
{NULL, NULL, 0, NULL}
};
@@ -86,6 +90,8 @@ demand_python ()
gdbpy_initialize_breakpoints ();
gdbpy_initialize_frames ();
gdbpy_initialize_commands ();
+ gdbpy_initialize_symbols ();
+ gdbpy_initialize_blocks ();
PyRun_SimpleString ("import gdb");
@@ -365,6 +371,23 @@ gdbpy_solib_address (PyObject *self, PyO
return str_obj;
}
+PyObject *
+gdbpy_find_pc_function (PyObject *self, PyObject *args)
+{
+ unsigned long long pc;
+ struct symbol *sym;
+ PyObject *sym_obj;
+
+ if (!PyArg_ParseTuple (args, "K", &pc))
+ return NULL;
+
+ sym = find_pc_function (pc);
+ if (sym)
+ return symbol_to_symbol_object (sym);
+
+ Py_RETURN_NONE;
+}
+
void
Index: tromey.git/gdb/python/symbol.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ tromey.git/gdb/python/symbol.c 2008-04-29 11:06:02.000000000 -0300
@@ -0,0 +1,224 @@
+/* Python interface to symbols.
+
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "symtab.h"
+#include "python-internal.h"
+
+typedef struct {
+ PyObject_HEAD
+ struct symbol *symbol;
+} symbol_object;
+
+static PyObject *sympy_str (PyObject *self);
+static PyObject *sympy_get_value (PyObject *self, PyObject *args);
+static PyObject *sympy_get_natural_name (PyObject *self, PyObject *args);
+static PyObject *sympy_get_linkage_name (PyObject *self, PyObject *args);
+static PyObject *sympy_get_print_name (PyObject *self, PyObject *args);
+static PyObject *sympy_get_class (PyObject *self, PyObject *args);
+
+static PyMethodDef symbol_object_methods[] = {
+ { "get_value", sympy_get_value, METH_NOARGS,
+ "Return the value of the symbol." },
+ { "get_natural_name", sympy_get_natural_name, METH_NOARGS,
+ "Return the \"natural\" name of the symbol." },
+ { "get_linkage_name", sympy_get_linkage_name, METH_NOARGS,
+ "Return the name of the symbol as used by the linker." },
+ { "get_print_name", sympy_get_print_name, METH_NOARGS,
+ "Return the name of the symbol in a form suitable for output." },
+ { "get_class", sympy_get_class, METH_NOARGS,
+ "Return the class of the symbol." },
+ {NULL} /* Sentinel */
+};
+
+PyTypeObject symbol_object_type = {
+ PyObject_HEAD_INIT (NULL)
+ 0, /*ob_size*/
+ "gdb.Symbol", /*tp_name*/
+ sizeof (symbol_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ sympy_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB symbol object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ symbol_object_methods /* tp_methods */
+};
+
+
+static PyObject *
+sympy_str (PyObject *self)
+{
+ int ret;
+ char *s;
+ PyObject *result;
+
+ ret = asprintf (&s, "symbol for %s",
+ SYMBOL_PRINT_NAME (((symbol_object *) self)->symbol));
+ if (ret < 0)
+ Py_RETURN_NONE;
+
+ result = PyString_FromString (s);
+ xfree (s);
+
+ return result;
+}
+
+static PyObject *
+sympy_get_value (PyObject *self, PyObject *args)
+{
+ symbol_object *self_sym = (symbol_object *) self;
+
+ switch (SYMBOL_CLASS (self_sym->symbol))
+ {
+ case LOC_BLOCK:
+ return block_to_block_object (SYMBOL_BLOCK_VALUE (self_sym->symbol));
+ }
+
+ PyErr_SetString (PyExc_NotImplementedError,
+ "Symbol type not yet supported in Python scripts.");
+ return NULL;
+}
+
+static PyObject *
+sympy_get_natural_name (PyObject *self, PyObject *args)
+{
+ symbol_object *self_sym = (symbol_object *) self;
+
+ return PyString_FromString (SYMBOL_NATURAL_NAME (self_sym->symbol));
+}
+
+static PyObject *
+sympy_get_linkage_name (PyObject *self, PyObject *args)
+{
+ symbol_object *self_sym = (symbol_object *) self;
+
+ return PyString_FromString (SYMBOL_LINKAGE_NAME (self_sym->symbol));
+}
+
+static PyObject *
+sympy_get_print_name (PyObject *self, PyObject *args)
+{
+ symbol_object *self_sym = (symbol_object *) self;
+
+ return PyString_FromString (SYMBOL_PRINT_NAME (self_sym->symbol));
+}
+
+static PyObject *
+sympy_get_class (PyObject *self, PyObject *args)
+{
+ symbol_object *self_sym = (symbol_object *) self;
+
+ return PyInt_FromLong (SYMBOL_CLASS (self_sym->symbol));
+}
+
+PyObject *
+symbol_to_symbol_object (struct symbol *sym)
+{
+ symbol_object *sym_obj;
+
+ sym_obj = PyObject_New (symbol_object, &symbol_object_type);
+ if (sym_obj == NULL)
+ {
+ PyErr_SetString (PyExc_MemoryError, "Could not allocate symbol object.");
+ return NULL;
+ }
+
+ sym_obj->symbol = sym;
+
+ return (PyObject *) sym_obj;
+}
+
+struct symbol *
+symbol_object_to_symbol (PyObject *obj)
+{
+ return ((symbol_object *) obj)->symbol;
+}
+
+void
+gdbpy_initialize_symbols (void)
+{
+ symbol_object_type.tp_new = PyType_GenericNew;
+ if (PyType_Ready (&symbol_object_type) < 0)
+ return;
+
+ /* FIXME: These would probably be best exposed as class attributes of Symbol,
+ but I don't know how to do it except by messing with the type's dictionary.
+ That seems too messy. */
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST", LOC_CONST);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC", LOC_STATIC);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER", LOC_REGISTER);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG", LOC_ARG);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG", LOC_REF_ARG);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM", LOC_REGPARM);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
+ LOC_REGPARM_ADDR);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL", LOC_LOCAL);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF", LOC_TYPEDEF);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL", LOC_LABEL);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK", LOC_BLOCK);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
+ LOC_CONST_BYTES);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL_ARG", LOC_LOCAL_ARG);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BASEREG", LOC_BASEREG);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BASEREG_ARG",
+ LOC_BASEREG_ARG);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED", LOC_UNRESOLVED);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_HP_THREAD_LOCAL_STATIC",
+ LOC_HP_THREAD_LOCAL_STATIC);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
+ LOC_OPTIMIZED_OUT);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_INDIRECT", LOC_INDIRECT);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED", LOC_COMPUTED);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED_ARG",
+ LOC_COMPUTED_ARG);
+
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN", UNDEF_DOMAIN);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN", VAR_DOMAIN);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN", STRUCT_DOMAIN);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN", LABEL_DOMAIN);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
+ VARIABLES_DOMAIN);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
+ FUNCTIONS_DOMAIN);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN", TYPES_DOMAIN);
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_METHODS_DOMAIN", METHODS_DOMAIN);
+
+ Py_INCREF (&symbol_object_type);
+ PyModule_AddObject (gdb_module, "Symbol", (PyObject *) &symbol_object_type);
+}
--
--
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center