aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.h
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1991-11-19 15:59:55 +0000
committerFred Fish <fnf@specifix.com>1991-11-19 15:59:55 +0000
commitd018c8a6e1c03b8f220445f9de5af8ba4b3a4199 (patch)
treea79e51cdd5d25fc277ade0a367ecc2a2a892d280 /gdb/symtab.h
parent61af01bc7065b6aa740b0a9cccdcf43ed9c28803 (diff)
downloadgdb-d018c8a6e1c03b8f220445f9de5af8ba4b3a4199.zip
gdb-d018c8a6e1c03b8f220445f9de5af8ba4b3a4199.tar.gz
gdb-d018c8a6e1c03b8f220445f9de5af8ba4b3a4199.tar.bz2
Add defines so that parsers produced by SVR4 versions of yacc can coexist
in the same executable without collision (c-exp.y, m2-exp.y). Add forward delaration of function returning pointer to shut up compiler warnings about conversion of int to pointer (symtab.h).
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r--gdb/symtab.h165
1 files changed, 91 insertions, 74 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h
index c97c22a..d9c7696 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -122,10 +122,6 @@ enum type_code
someone referenced a type that wasn't definined in a source file
via (struct sir_not_appearing_in_this_film *)). */
#define TYPE_FLAG_STUB 8
-/* Set when a class has a constructor defined */
-#define TYPE_FLAG_HAS_CONSTRUCTOR 256
-/* Set when a class has a destructor defined */
-#define TYPE_FLAG_HAS_DESTRUCTOR 512
struct type
{
@@ -141,6 +137,8 @@ struct type
For an array type, describes the type of the elements.
For a function or method type, describes the type of the value.
For a range type, describes the type of the full range.
+ For a record type, it's the "main variant" of the record type,
+ used for computing pointers to members.
Unused otherwise. */
struct type *target_type;
/* Type that is a pointer to this type.
@@ -150,27 +148,13 @@ struct type
struct type *pointer_type;
/* C++: also need a reference type. */
struct type *reference_type;
- struct type **arg_types;
-
+
/* Type that is a function returning this type.
Zero if no such function type is known here.
The debugger may add the address of such a type
if it has to construct one later. */
struct type *function_type;
-/* Handling of pointers to members:
- TYPE_MAIN_VARIANT is used for pointer and pointer
- to member types. Normally it the value of the address of its
- containing type. However, for pointers to members, we must be
- able to allocate pointer to member types and look them up
- from some place of reference.
- NEXT_VARIANT is the next element in the chain.
-
- A long time ago (Jul 88; GDB 2.5) Tiemann said that main_variant
- may no longer be necessary and that he might eliminate it. I don't
- know whether this is still true (or ever was). */
- struct type *main_variant, *next_variant;
-
/* Flags about this type. */
short flags;
/* Number of fields described for this type */
@@ -206,7 +190,43 @@ struct type
char *name;
} *fields;
- /* C++ */
+ /* For types with virtual functions, VPTR_BASETYPE is the base class which
+ defined the virtual function table pointer. VPTR_FIELDNO is
+ the field number of that pointer in the structure.
+
+ For types that are pointer to member types, VPTR_BASETYPE
+ ifs the type that this pointer is a member of.
+
+ Unused otherwise. */
+ struct type *vptr_basetype;
+
+ int vptr_fieldno;
+
+ /* Slot to point to additional language-specific fields of this type. */
+ union
+ {
+ struct type **arg_types;
+ struct cplus_struct_type *cplus_stuff;
+ } type_specific;
+};
+
+/* C++ language-specific information for TYPE_CODE_STRUCT nodes. */
+struct cplus_struct_type
+{
+ /* Handling of pointers to members:
+ TYPE_MAIN_VARIANT is used for pointer and pointer
+ to member types. Normally it is the value of the address of its
+ containing type. However, for pointers to members, we must be
+ able to allocate pointer to member types and look them up
+ from some place of reference.
+ NEXT_VARIANT is the next element in the chain.
+
+ A long time ago (Jul 88; GDB 2.5) Tiemann said that
+ MAIN_VARIANT/NEXT_VARIANT may no longer be necessary and that he
+ might eliminate it. I don't know whether this is still true (or
+ ever was). */
+ struct type *next_variant;
+
B_TYPE *virtual_field_bits; /* if base class is virtual */
B_TYPE *private_field_bits;
B_TYPE *protected_field_bits;
@@ -258,18 +278,6 @@ struct type
unsigned char via_protected;
unsigned char via_public;
-
- /* For types with virtual functions, VPTR_BASETYPE is the base class which
- defined the virtual function table pointer. VPTR_FIELDNO is
- the field number of that pointer in the structure.
-
- For types that are pointer to member types, VPTR_BASETYPE
- ifs the type that this pointer is a member of.
-
- Unused otherwise. */
- struct type *vptr_basetype;
-
- int vptr_fieldno;
};
/* All of the name-scope contours of the program
@@ -674,8 +682,8 @@ int current_source_line;
#define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
#define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
#define TYPE_FUNCTION_TYPE(thistype) (thistype)->function_type
-#define TYPE_MAIN_VARIANT(thistype) (thistype)->main_variant
-#define TYPE_NEXT_VARIANT(thistype) (thistype)->next_variant
+#define TYPE_MAIN_VARIANT(thistype) (thistype)->target_type
+#define TYPE_NEXT_VARIANT(thistype) (TYPE_CPLUS_SPECIFIC (thistype))->next_variant
#define TYPE_LENGTH(thistype) (thistype)->length
#define TYPE_FLAGS(thistype) (thistype)->flags
#define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED)
@@ -686,16 +694,18 @@ int current_source_line;
#define TYPE_VPTR_BASETYPE(thistype) (thistype)->vptr_basetype
#define TYPE_DOMAIN_TYPE(thistype) (thistype)->vptr_basetype
#define TYPE_VPTR_FIELDNO(thistype) (thistype)->vptr_fieldno
-#define TYPE_FN_FIELDS(thistype) (thistype)->fn_fields
-#define TYPE_NFN_FIELDS(thistype) (thistype)->nfn_fields
-#define TYPE_NFN_FIELDS_TOTAL(thistype) (thistype)->nfn_fields_total
-#define TYPE_ARG_TYPES(thistype) (thistype)->arg_types
+#define TYPE_FN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fields
+#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
+#define TYPE_NFN_FIELDS_TOTAL(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields_total
+#define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types
+#define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff
#define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type
-#define TYPE_N_BASECLASSES(thistype) (thistype)->n_baseclasses
+#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
#define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name
#define TYPE_BASECLASS_BITPOS(thistype,index) (thistype)->fields[index].bitpos
#define BASETYPE_VIA_PUBLIC(thistype, index) (!TYPE_FIELD_PRIVATE(thistype, index))
-#define BASETYPE_VIA_VIRTUAL(thistype, index) B_TST((thistype)->virtual_field_bits, (index))
+#define BASETYPE_VIA_VIRTUAL(thistype, index) \
+ B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index))
#define TYPE_FIELD(thistype, n) (thistype)->fields[n]
#define TYPE_FIELD_TYPE(thistype, n) (thistype)->fields[n].type
@@ -705,44 +715,50 @@ int current_source_line;
#define TYPE_FIELD_BITSIZE(thistype, n) (thistype)->fields[n].bitsize
#define TYPE_FIELD_PACKED(thistype, n) (thistype)->fields[n].bitsize
-#define TYPE_FIELD_PRIVATE_BITS(thistype) (thistype)->private_field_bits
-#define TYPE_FIELD_PROTECTED_BITS(thistype) (thistype)->protected_field_bits
-#define TYPE_FIELD_VIRTUAL_BITS(thistype) (thistype)->virtual_field_bits
-#define SET_TYPE_FIELD_PRIVATE(thistype, n) B_SET ((thistype)->private_field_bits, (n))
-#define SET_TYPE_FIELD_PROTECTED(thistype, n) B_SET ((thistype)->protected_field_bits, (n))
-#define SET_TYPE_FIELD_VIRTUAL(thistype, n) B_SET ((thistype)->virtual_field_bits, (n))
-#define TYPE_FIELD_PRIVATE(thistype, n) B_TST((thistype)->private_field_bits, (n))
-#define TYPE_FIELD_PROTECTED(thistype, n) B_TST((thistype)->protected_field_bits, (n))
-#define TYPE_FIELD_VIRTUAL(thistype, n) B_TST((thistype)->virtual_field_bits, (n))
-
-#define TYPE_HAS_DESTRUCTOR(thistype) ((thistype)->flags & TYPE_FLAG_HAS_DESTRUCTOR)
-#define TYPE_HAS_CONSTRUCTOR(thistype) ((thistype)->flags & TYPE_FLAG_HAS_CONSTRUCTOR)
+#define TYPE_FIELD_PRIVATE_BITS(thistype) \
+ TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
+#define TYPE_FIELD_PROTECTED_BITS(thistype) \
+ TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
+#define TYPE_FIELD_VIRTUAL_BITS(thistype) \
+ TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
+#define SET_TYPE_FIELD_PRIVATE(thistype, n) \
+ B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
+#define SET_TYPE_FIELD_PROTECTED(thistype, n) \
+ B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
+#define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
+ B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
+#define TYPE_FIELD_PRIVATE(thistype, n) \
+ B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
+#define TYPE_FIELD_PROTECTED(thistype, n) \
+B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
+#define TYPE_FIELD_VIRTUAL(thistype, n) \
+ B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
#define TYPE_FIELD_STATIC(thistype, n) ((thistype)->fields[n].bitpos == -1)
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) ((char *)(thistype)->fields[n].bitsize)
-#define TYPE_FN_FIELDLISTS(thistype) (thistype)->fn_fieldlists
-#define TYPE_FN_FIELDLIST(thistype, n) (thistype)->fn_fieldlists[n]
-#define TYPE_FN_FIELDLIST1(thistype, n) (thistype)->fn_fieldlists[n].fn_fields
-#define TYPE_FN_FIELDLIST_NAME(thistype, n) (thistype)->fn_fieldlists[n].name
-#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) (thistype)->fn_fieldlists[n].length
-
-#define TYPE_FN_FIELD(thistype, n) (thistype)[n]
-#define TYPE_FN_FIELD_NAME(thistype, n) (thistype)[n].name
-#define TYPE_FN_FIELD_TYPE(thistype, n) (thistype)[n].type
-#define TYPE_FN_FIELD_ARGS(thistype, n) TYPE_ARG_TYPES ((thistype)[n].type)
-#define TYPE_FN_FIELD_PHYSNAME(thistype, n) (thistype)[n].physname
-#define TYPE_FN_FIELD_VIRTUAL_P(thistype, n) ((thistype)[n].voffset > 1)
-#define TYPE_FN_FIELD_STATIC_P(thistype, n) ((thistype)[n].voffset == VOFFSET_STATIC)
-#define TYPE_FN_FIELD_VOFFSET(thistype, n) ((thistype)[n].voffset-2)
-#define TYPE_FN_FIELD_FCONTEXT(thistype, n) ((thistype)[n].fcontext)
-
-#define TYPE_FN_PRIVATE_BITS(thistype) (thistype).private_fn_field_bits
-#define TYPE_FN_PROTECTED_BITS(thistype) (thistype).protected_fn_field_bits
-#define SET_TYPE_FN_PRIVATE(thistype, n) B_SET ((thistype).private_fn_field_bits, n)
-#define SET_TYPE_FN_PROTECTED(thistype, n) B_SET ((thistype).protected_fn_field_bits, n)
-#define TYPE_FN_PRIVATE(thistype, n) B_TST ((thistype).private_fn_field_bits, n)
-#define TYPE_FN_PROTECTED(thistype, n) B_TST ((thistype).protected_fn_field_bits, n)
+#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
+#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
+#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
+#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
+#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
+
+#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
+#define TYPE_FN_FIELD_NAME(thisfn, n) (thisfn)[n].name
+#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
+#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_ARG_TYPES ((thisfn)[n].type)
+#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
+#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
+#define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
+#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
+#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
+
+#define TYPE_FN_PRIVATE_BITS(thisfn) (thisfn).private_fn_field_bits
+#define TYPE_FN_PROTECTED_BITS(thisfn) (thisfn).protected_fn_field_bits
+#define SET_TYPE_FN_PRIVATE(thisfn, n) B_SET ((thisfn).private_fn_field_bits, n)
+#define SET_TYPE_FN_PROTECTED(thisfn, n) B_SET ((thisfn).protected_fn_field_bits, n)
+#define TYPE_FN_PRIVATE(thisfn, n) B_TST ((thisfn).private_fn_field_bits, n)
+#define TYPE_FN_PROTECTED(thisfn, n) B_TST ((thisfn).protected_fn_field_bits, n)
/* The virtual function table is now an array of structures
which have the form { int16 offset, delta; void *pfn; }.
@@ -799,6 +815,7 @@ extern char *type_name_no_tag ();
extern int contained_in();
/* C++ stuff. */
+extern struct type *lookup_template_type ();
extern struct type *lookup_reference_type ();
extern struct type *lookup_member_type ();
extern struct type *lookup_method_type ();