GDB (xrefs)
Classes | Defines | Typedefs | Functions | Variables
/home/stan/gdb/src/gdb/python/py-type.c File Reference
#include "defs.h"
#include "value.h"
#include "exceptions.h"
#include "python-internal.h"
#include "charset.h"
#include "gdbtypes.h"
#include "cp-support.h"
#include "demangle.h"
#include "objfiles.h"
#include "language.h"
#include "vec.h"
#include "bcache.h"
#include "dwarf2loc.h"
#include "typeprint.h"

Go to the source code of this file.

Classes

struct  pyty_type_object
struct  pyty_field_object
struct  typy_iterator_object
struct  pyty_code
struct  type_equality_entry

Defines

#define ENTRY(X)   { X, #X }

Typedefs

typedef struct pyty_type_object type_object
typedef struct pyty_field_object field_object
typedef struct type_equality_entry type_equality_entry_d

Functions

static PyTypeObject
type_object_type 
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object")
static PyTypeObject
field_object_type 
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object")
static PyTypeObject
type_iterator_object_type 
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object")
static PyObjecttypy_make_iter (PyObject *self, enum gdbpy_iter_kind kind)
static void field_dealloc (PyObject *obj)
static PyObjectfield_new (void)
static PyObjecttypy_get_code (PyObject *self, void *closure)
static PyObjectconvert_field (struct type *type, int field)
static PyObjectfield_name (struct type *type, int field)
static PyObjectmake_fielditem (struct type *type, int i, enum gdbpy_iter_kind kind)
static PyObjecttypy_fields_items (PyObject *self, enum gdbpy_iter_kind kind)
static PyObjecttypy_values (PyObject *self, PyObject *args)
static PyObjecttypy_fields (PyObject *self, PyObject *args)
static PyObjecttypy_field_names (PyObject *self, PyObject *args)
static PyObjecttypy_items (PyObject *self, PyObject *args)
static PyObjecttypy_get_tag (PyObject *self, void *closure)
static PyObjecttypy_strip_typedefs (PyObject *self, PyObject *args)
static struct typetypy_get_composite (struct type *type)
static PyObjecttypy_array_1 (PyObject *self, PyObject *args, int is_vector)
static PyObjecttypy_array (PyObject *self, PyObject *args)
static PyObjecttypy_vector (PyObject *self, PyObject *args)
static PyObjecttypy_pointer (PyObject *self, PyObject *args)
static PyObjecttypy_range (PyObject *self, PyObject *args)
static PyObjecttypy_reference (PyObject *self, PyObject *args)
static PyObjecttypy_target (PyObject *self, PyObject *args)
static PyObjecttypy_const (PyObject *self, PyObject *args)
static PyObjecttypy_volatile (PyObject *self, PyObject *args)
static PyObjecttypy_unqualified (PyObject *self, PyObject *args)
static PyObjecttypy_get_sizeof (PyObject *self, void *closure)
static struct typetypy_lookup_typename (const char *type_name, const struct block *block)
static struct typetypy_lookup_type (struct demangle_component *demangled, const struct block *block)
static PyObjecttypy_legacy_template_argument (struct type *type, const struct block *block, int argno)
static PyObjecttypy_template_argument (PyObject *self, PyObject *args)
static PyObjecttypy_str (PyObject *self)
 DEF_VEC_O (type_equality_entry_d)
static int compare_maybe_null_strings (const char *s, const char *t)
static int check_types_equal (struct type *type1, struct type *type2, VEC(type_equality_entry_d)**worklist)
static int check_types_worklist (VEC(type_equality_entry_d)**worklist, struct bcache *cache)
static PyObjecttypy_richcompare (PyObject *self, PyObject *other, int op)
static void save_objfile_types (struct objfile *objfile, void *datum)
static void set_type (type_object *obj, struct type *type)
static void typy_dealloc (PyObject *obj)
static Py_ssize_t typy_length (PyObject *self)
static int typy_nonzero (PyObject *self)
static PyObjecttypy_getitem (PyObject *self, PyObject *key)
static PyObjecttypy_get (PyObject *self, PyObject *args)
static PyObjecttypy_has_key (PyObject *self, PyObject *args)
static PyObjecttypy_iteritems (PyObject *self, PyObject *args)
static PyObjecttypy_iterkeys (PyObject *self, PyObject *args)
static PyObjecttypy_iter (PyObject *self)
static PyObjecttypy_itervalues (PyObject *self, PyObject *args)
static PyObjecttypy_iterator_iter (PyObject *self)
static PyObjecttypy_iterator_iternext (PyObject *self)
static void typy_iterator_dealloc (PyObject *obj)
PyObjecttype_to_type_object (struct type *type)
struct typetype_object_to_type (PyObject *obj)
PyObjectgdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
int gdbpy_initialize_types (void)

Variables

static struct pyty_code pyty_codes []
static struct objfile_data * typy_objfile_data_key
static PyGetSetDef type_object_getset []
static PyMethodDef type_object_methods []
static PyNumberMethods type_object_as_number
static PyMappingMethods typy_mapping
static PyTypeObject type_object_type
static PyGetSetDef field_object_getset []
static PyTypeObject field_object_type
static PyTypeObject type_iterator_object_type

Define Documentation

#define ENTRY (   X)    { X, #X }

Definition at line 88 of file py-type.c.

Referenced by lex_one_token().


Typedef Documentation

typedef struct pyty_type_object type_object

Function Documentation

static int check_types_equal ( struct type type1,
struct type type2,
VEC(type_equality_entry_d)**  worklist 
) [static]
static int check_types_worklist ( VEC(type_equality_entry_d)**  worklist,
struct bcache cache 
) [static]
static int compare_maybe_null_strings ( const char *  s,
const char *  t 
) [static]

Definition at line 977 of file py-type.c.

Referenced by check_types_equal().

static PyObject* convert_field ( struct type type,
int  field 
) [static]
static PyTypeObject type_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "type_object"  ) [static]
static PyTypeObject field_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "field_object"  ) [static]
static PyTypeObject type_iterator_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "typy_iterator_object"  ) [static]
static void field_dealloc ( PyObject obj) [static]

Definition at line 124 of file py-type.c.

References pyty_field_object::dict.

static PyObject* field_name ( struct type type,
int  field 
) [static]
static PyObject* field_new ( void  ) [static]

Definition at line 133 of file py-type.c.

References pyty_field_object::dict, field_object_type, and Py_DECREF.

Referenced by convert_field().

PyObject* gdbpy_lookup_type ( PyObject self,
PyObject args,
PyObject kw 
)

Definition at line 1494 of file py-type.c.

References _, block_object_to_block(), type_to_type_object(), and typy_lookup_typename().

static PyObject* make_fielditem ( struct type type,
int  i,
enum gdbpy_iter_kind  kind 
) [static]
static void save_objfile_types ( struct objfile objfile,
void *  datum 
) [static]
static void set_type ( type_object obj,
struct type type 
) [static]
struct type* type_object_to_type ( PyObject obj) [read]

Definition at line 1483 of file py-type.c.

References type_object_type.

Referenced by bpfinishpy_pre_stop_hook(), typy_richcompare(), and typy_str().

PyObject* type_to_type_object ( struct type type)
static PyObject* typy_array ( PyObject self,
PyObject args 
) [static]

Definition at line 520 of file py-type.c.

References typy_array_1().

static PyObject* typy_array_1 ( PyObject self,
PyObject args,
int  is_vector 
) [static]
static PyObject* typy_const ( PyObject self,
PyObject args 
) [static]
static void typy_dealloc ( PyObject obj) [static]
static PyObject* typy_field_names ( PyObject self,
PyObject args 
) [static]

Definition at line 390 of file py-type.c.

References iter_keys, and typy_fields_items().

static PyObject* typy_fields ( PyObject self,
PyObject args 
) [static]
static PyObject* typy_fields_items ( PyObject self,
enum gdbpy_iter_kind  kind 
) [static]
static PyObject* typy_get ( PyObject self,
PyObject args 
) [static]

Definition at line 1322 of file py-type.c.

References typy_getitem().

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

Definition at line 153 of file py-type.c.

References TYPE_CODE.

static struct type* typy_get_composite ( struct type type) [static, read]
static PyObject* typy_get_sizeof ( PyObject self,
void *  closure 
) [static]
static PyObject* typy_get_tag ( PyObject self,
void *  closure 
) [static]

Definition at line 406 of file py-type.c.

References TYPE_TAG_NAME.

static PyObject* typy_getitem ( PyObject self,
PyObject key 
) [static]
static PyObject* typy_has_key ( PyObject self,
PyObject args 
) [static]

Definition at line 1347 of file py-type.c.

References strcmp_iw(), TYPE_FIELD_NAME, TYPE_NFIELDS, and typy_get_composite().

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

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

References iter_items, and typy_fields_items().

static PyObject* typy_iter ( PyObject self) [static]

Definition at line 1418 of file py-type.c.

References iter_keys, and typy_make_iter().

static void typy_iterator_dealloc ( PyObject obj) [static]

Definition at line 1462 of file py-type.c.

References Py_DECREF, and typy_iterator_object::source.

static PyObject* typy_iterator_iter ( PyObject self) [static]

Definition at line 1434 of file py-type.c.

static PyObject* typy_iterator_iternext ( PyObject self) [static]
static PyObject* typy_iteritems ( PyObject self,
PyObject args 
) [static]

Definition at line 1401 of file py-type.c.

References iter_items, and typy_make_iter().

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

Definition at line 1409 of file py-type.c.

References iter_keys, and typy_make_iter().

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

Definition at line 1426 of file py-type.c.

References iter_values, and typy_make_iter().

static PyObject* typy_legacy_template_argument ( struct type type,
const struct block block,
int  argno 
) [static]
static Py_ssize_t typy_length ( PyObject self) [static]

Definition at line 1262 of file py-type.c.

References TYPE_NFIELDS, and typy_get_composite().

static struct type* typy_lookup_type ( struct demangle_component *  demangled,
const struct block block 
) [static, read]
static struct type* typy_lookup_typename ( const char *  type_name,
const struct block block 
) [static, read]
static PyObject * typy_make_iter ( PyObject self,
enum gdbpy_iter_kind  kind 
) [static]
static int typy_nonzero ( PyObject self) [static]

Definition at line 1278 of file py-type.c.

static PyObject* typy_pointer ( PyObject self,
PyObject args 
) [static]
static PyObject* typy_range ( PyObject self,
PyObject args 
) [static]
static PyObject* typy_reference ( PyObject self,
PyObject args 
) [static]
static PyObject* typy_richcompare ( PyObject self,
PyObject other,
int  op 
) [static]
static PyObject* typy_str ( PyObject self) [static]
static PyObject* typy_strip_typedefs ( PyObject self,
PyObject args 
) [static]
static PyObject* typy_target ( PyObject self,
PyObject args 
) [static]

Definition at line 632 of file py-type.c.

References _, TYPE_TARGET_TYPE, and type_to_type_object().

static PyObject* typy_template_argument ( PyObject self,
PyObject args 
) [static]
static PyObject* typy_unqualified ( PyObject self,
PyObject args 
) [static]
static PyObject* typy_values ( PyObject self,
PyObject args 
) [static]

Definition at line 355 of file py-type.c.

References iter_values, and typy_fields_items().

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

Definition at line 528 of file py-type.c.

References typy_array_1().

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

Variable Documentation

PyGetSetDef field_object_getset[] [static]
Initial value:
{
  { "__dict__", gdb_py_generic_dict, NULL,
    "The __dict__ for this field.", &field_object_type },
  { NULL }
}

Definition at line 1731 of file py-type.c.

PyTypeObject field_object_type [static]

Definition at line 1738 of file py-type.c.

Referenced by field_new(), and gdbpy_initialize_types().

struct pyty_code pyty_codes[] [static]
PyTypeObject type_iterator_object_type [static]
Initial value:
 {
  PyVarObject_HEAD_INIT (NULL, 0)
  "gdb.TypeIterator",             
  sizeof (typy_iterator_object),  
  0,                              
  typy_iterator_dealloc,          
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  0,                              
  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER,  
  "GDB type iterator object",     
  0,                              
  0,                              
  0,                              
  0,                              
  typy_iterator_iter,             
  typy_iterator_iternext,         
  0                               
}

Definition at line 1780 of file py-type.c.

Referenced by gdbpy_initialize_types(), and typy_make_iter().

PyNumberMethods type_object_as_number [static]

Definition at line 1648 of file py-type.c.

PyGetSetDef type_object_getset[] [static]
Initial value:
{
  { "code", typy_get_code, NULL,
    "The code for this type.", NULL },
  { "sizeof", typy_get_sizeof, NULL,
    "The size of this type, in bytes.", NULL },
  { "tag", typy_get_tag, NULL,
    "The tag name for this type, or None.", NULL },
  { NULL }
}

Definition at line 1562 of file py-type.c.

PyMethodDef type_object_methods[] [static]

Definition at line 1573 of file py-type.c.

PyTypeObject type_object_type [static]

Definition at line 1689 of file py-type.c.

Referenced by gdbpy_initialize_types(), type_object_to_type(), and type_to_type_object().

PyMappingMethods typy_mapping [static]
Initial value:

Definition at line 1683 of file py-type.c.

struct objfile_data* typy_objfile_data_key [static]

Definition at line 1183 of file py-type.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines