GDB (xrefs)
Classes | Defines | Typedefs | Functions | Variables
/home/stan/gdb/src/gdb/python/py-symtab.c File Reference
#include "defs.h"
#include "charset.h"
#include "symtab.h"
#include "source.h"
#include "python-internal.h"
#include "objfiles.h"
#include "block.h"

Go to the source code of this file.

Classes

struct  stpy_symtab_object
struct  salpy_sal_object

Defines

#define STPY_REQUIRE_VALID(symtab_obj, symtab)
#define SALPY_REQUIRE_VALID(sal_obj, sal)

Typedefs

typedef struct stpy_symtab_object symtab_object
typedef struct salpy_sal_object sal_object

Functions

static PyTypeObject
symtab_object_type 
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object")
static PyTypeObject sal_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object")
static PyObjectstpy_str (PyObject *self)
static PyObjectstpy_get_filename (PyObject *self, void *closure)
static PyObjectstpy_get_objfile (PyObject *self, void *closure)
static PyObjectstpy_fullname (PyObject *self, PyObject *args)
static PyObjectstpy_is_valid (PyObject *self, PyObject *args)
static PyObjectstpy_global_block (PyObject *self, PyObject *args)
static PyObjectstpy_static_block (PyObject *self, PyObject *args)
static PyObjectsalpy_str (PyObject *self)
static void stpy_dealloc (PyObject *obj)
static PyObjectsalpy_get_pc (PyObject *self, void *closure)
static PyObjectsalpy_get_last (PyObject *self, void *closure)
static PyObjectsalpy_get_line (PyObject *self, void *closure)
static PyObjectsalpy_get_symtab (PyObject *self, void *closure)
static PyObjectsalpy_is_valid (PyObject *self, PyObject *args)
static void salpy_dealloc (PyObject *self)
static int
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION 
set_sal (sal_object *sal_obj, struct symtab_and_line sal)
static void set_symtab (symtab_object *obj, struct symtab *symtab)
PyObjectsymtab_to_symtab_object (struct symtab *symtab)
PyObjectsymtab_and_line_to_sal_object (struct symtab_and_line sal)
struct symtab_and_linesal_object_to_symtab_and_line (PyObject *obj)
struct symtabsymtab_object_to_symtab (PyObject *obj)
static void del_objfile_symtab (struct objfile *objfile, void *datum)
static void del_objfile_sal (struct objfile *objfile, void *datum)
int gdbpy_initialize_symtabs (void)

Variables

static struct objfile_data * stpy_objfile_data_key
static struct objfile_data * salpy_objfile_data_key
static PyGetSetDef symtab_object_getset []
static PyMethodDef symtab_object_methods []
static PyTypeObject symtab_object_type
static PyGetSetDef sal_object_getset []
static PyMethodDef sal_object_methods []
static PyTypeObject sal_object_type

Define Documentation

#define SALPY_REQUIRE_VALID (   sal_obj,
  sal 
)
Value:
do {                                                                    \
    sal = sal_object_to_symtab_and_line (sal_obj);                      \
    if (sal == NULL)                                                    \
      {                                                                 \
          PyErr_SetString (PyExc_RuntimeError,                          \
                           _("Symbol Table and Line is invalid."));     \
          return NULL;                                                  \
        }                                                               \
  } while (0)

Definition at line 77 of file py-symtab.c.

Referenced by salpy_get_last(), salpy_get_line(), salpy_get_pc(), salpy_get_symtab(), and salpy_str().

#define STPY_REQUIRE_VALID (   symtab_obj,
  symtab 
)
Value:
do {                                                     \
    symtab = symtab_object_to_symtab (symtab_obj);       \
    if (symtab == NULL)                                  \
      {                                                  \
        PyErr_SetString (PyExc_RuntimeError,             \
                         _("Symbol Table is invalid.")); \
        return NULL;                                     \
      }                                                  \
  } while (0)

Definition at line 46 of file py-symtab.c.

Referenced by stpy_fullname(), stpy_get_filename(), stpy_get_objfile(), stpy_global_block(), stpy_static_block(), and stpy_str().


Typedef Documentation

typedef struct salpy_sal_object sal_object

Function Documentation

static PyTypeObject symtab_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "symtab_object"  ) [static]
static PyTypeObject sal_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "sal_object"  ) [static]
static void del_objfile_sal ( struct objfile objfile,
void *  datum 
) [static]
static void del_objfile_symtab ( struct objfile objfile,
void *  datum 
) [static]

Definition at line 420 of file py-symtab.c.

References sal_object_type.

Referenced by salpy_is_valid().

static void salpy_dealloc ( PyObject self) [static]
static PyObject* salpy_get_last ( PyObject self,
void *  closure 
) [static]

Definition at line 245 of file py-symtab.c.

References symtab_and_line::end, gdb_py_long_from_ulongest, and SALPY_REQUIRE_VALID.

static PyObject* salpy_get_line ( PyObject self,
void *  closure 
) [static]

Definition at line 258 of file py-symtab.c.

References symtab_and_line::line, and SALPY_REQUIRE_VALID.

static PyObject* salpy_get_pc ( PyObject self,
void *  closure 
) [static]

Definition at line 232 of file py-symtab.c.

References gdb_py_long_from_ulongest, symtab_and_line::pc, and SALPY_REQUIRE_VALID.

static PyObject* salpy_get_symtab ( PyObject self,
void *  closure 
) [static]

Definition at line 268 of file py-symtab.c.

References SALPY_REQUIRE_VALID, and salpy_sal_object::symtab.

static PyObject* salpy_is_valid ( PyObject self,
PyObject args 
) [static]

Definition at line 284 of file py-symtab.c.

References sal_object_to_symtab_and_line().

static PyObject* salpy_str ( PyObject self) [static]
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION set_sal ( sal_object sal_obj,
struct symtab_and_line  sal 
) [static]
static void set_symtab ( symtab_object obj,
struct symtab symtab 
) [static]
static void stpy_dealloc ( PyObject obj) [static]
static PyObject* stpy_fullname ( PyObject self,
PyObject args 
) [static]
static PyObject* stpy_get_filename ( PyObject self,
void *  closure 
) [static]
static PyObject* stpy_get_objfile ( PyObject self,
void *  closure 
) [static]

Definition at line 117 of file py-symtab.c.

References symtab::objfile, objfile_to_objfile_object(), and STPY_REQUIRE_VALID.

static PyObject* stpy_global_block ( PyObject self,
PyObject args 
) [static]
static PyObject* stpy_is_valid ( PyObject self,
PyObject args 
) [static]

Definition at line 146 of file py-symtab.c.

References symtab_object_to_symtab().

static PyObject* stpy_static_block ( PyObject self,
PyObject args 
) [static]
static PyObject* stpy_str ( PyObject self) [static]

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

References STPY_REQUIRE_VALID, and symtab_to_filename_for_display().

Definition at line 399 of file py-symtab.c.

References Py_DECREF, sal_object_type, and set_sal().

Referenced by frapy_find_sal().

struct symtab* symtab_object_to_symtab ( PyObject obj) [read]

Definition at line 429 of file py-symtab.c.

References symtab_object_type.

Referenced by stpy_is_valid().

PyObject* symtab_to_symtab_object ( struct symtab symtab)

Definition at line 385 of file py-symtab.c.

References set_symtab(), and symtab_object_type.

Referenced by set_sal(), and sympy_get_symtab().


Variable Documentation

PyGetSetDef sal_object_getset[] [static]
Initial value:
 {
  { "symtab", salpy_get_symtab, NULL, "Symtab object.", NULL },
  { "pc", salpy_get_pc, NULL, "Return the symtab_and_line's pc.", NULL },
  { "last", salpy_get_last, NULL,
    "Return the symtab_and_line's last address.", NULL },
  { "line", salpy_get_line, NULL,
    "Return the symtab_and_line's line.", NULL },
  {NULL}  
}

Definition at line 571 of file py-symtab.c.

PyMethodDef sal_object_methods[] [static]
Initial value:
 {
  { "is_valid", salpy_is_valid, METH_NOARGS,
    "is_valid () -> Boolean.\n\
Return true if this symbol table and line is valid, false if not." },
  {NULL}  
}

Definition at line 581 of file py-symtab.c.

PyTypeObject sal_object_type [static]
struct objfile_data* salpy_objfile_data_key [static]

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

Referenced by gdbpy_initialize_symtabs(), salpy_dealloc(), and set_sal().

struct objfile_data* stpy_objfile_data_key [static]

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

Referenced by gdbpy_initialize_symtabs(), set_symtab(), and stpy_dealloc().

PyGetSetDef symtab_object_getset[] [static]
Initial value:
 {
  { "filename", stpy_get_filename, NULL,
    "The symbol table's source filename.", NULL },
  { "objfile", stpy_get_objfile, NULL, "The symtab's objfile.",
    NULL },
  {NULL}  
}

Definition at line 514 of file py-symtab.c.

PyMethodDef symtab_object_methods[] [static]
Initial value:
 {
  { "is_valid", stpy_is_valid, METH_NOARGS,
    "is_valid () -> Boolean.\n\
Return true if this symbol table is valid, false if not." },
  { "fullname", stpy_fullname, METH_NOARGS,
    "fullname () -> String.\n\
Return the symtab's full source filename." },
  { "global_block", stpy_global_block, METH_NOARGS,
    "global_block () -> gdb.Block.\n\
Return the global block of the symbol table." },
  { "static_block", stpy_static_block, METH_NOARGS,
    "static_block () -> gdb.Block.\n\
Return the static block of the symbol table." },
  {NULL}  
}

Definition at line 522 of file py-symtab.c.

PyTypeObject symtab_object_type [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines