the program's identifiers (such as $this and $$vptr). */
#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
-/*
- * Allow things in gdb to be declared "const". If compiling ANSI, it
- * just works. If compiling with gcc but non-ansi, redefine to __const__.
- * If non-ansi, non-gcc, then eliminate "const" entirely, making those
- * objects be read-write rather than read-only.
- */
-#ifndef const
-#ifndef __STDC__
-# ifdef __GNUC__
-# define const __const__
-# else
-# define const /*nothing*/
-# endif /* GNUC */
-#endif /* STDC */
-#endif /* const */
-
-#ifndef volatile
-#ifndef __STDC__
-# ifdef __GNUC__
-# define volatile __volatile__
-# else
-# define volatile /*nothing*/
-# endif /* GNUC */
-#endif /* STDC */
-#endif /* volatile */
-
-extern char *savestring ();
-extern char *strsave ();
-extern char *concat ();
-#ifdef __STDC__
-extern void *xmalloc (), *xrealloc ();
-#else
-extern char *xmalloc (), *xrealloc ();
-#endif
-extern void free ();
-extern int parse_escape ();
-extern char *reg_names[];
-/* Indicate that these routines do not return to the caller. */
-extern volatile void error(), fatal();
-extern void warning_setup(), warning();
-
-/* Various possibilities for alloca. */
-#ifndef alloca
-# ifdef __GNUC__
-# define alloca __builtin_alloca
-# else
-# ifdef sparc
-# include <alloca.h>
-# endif
- extern char *alloca ();
-# endif
-#endif
-
extern int errno; /* System call error return status */
extern int quit_flag;
/* Baud rate specified for communication with serial target systems. */
char *baud_rate;
+/* Languages represented in the symbol table and elsewhere. */
+
+enum language
+{
+ language_unknown, /* Language not known */
+ language_auto, /* Placeholder for automatic setting */
+ language_c, /* C */
+ language_cplus, /* C++ */
+ language_m2 /* Modula-2 */
+};
+
+/* Return a format string for printf that will print a number in the local
+ (language-specific) hexadecimal format. Result is static and is
+ overwritten by the next call. local_hex_format_custom takes printf
+ options like "08" or "l" (to produce e.g. %08x or %lx). */
+
+#define local_hex_format() (current_language->la_hex_format)
+char *local_hex_format_custom(); /* language.c */
+
+/* Return a string that contains a number formatted in the local
+ (language-specific) hexadecimal format. Result is static and is
+ overwritten by the next call. local_hex_string_custom takes printf
+ options like "08" or "l". */
+
+char *local_hex_string (); /* language.c */
+char *local_hex_string_custom (); /* language.c */
+\f
+/* Host machine definition. This will be a symlink to one of the
+ xm-*.h files, built by the `configure' script. */
+
+#include "xm.h"
+
+/*
+ * Allow things in gdb to be declared "const". If compiling ANSI, it
+ * just works. If compiling with gcc but non-ansi, redefine to __const__.
+ * If non-ansi, non-gcc, then eliminate "const" entirely, making those
+ * objects be read-write rather than read-only.
+ */
+
+#ifndef const
+#ifndef __STDC__
+# ifdef __GNUC__
+# define const __const__
+# else
+# define const /*nothing*/
+# endif /* GNUC */
+#endif /* STDC */
+#endif /* const */
+
+#ifndef volatile
+#ifndef __STDC__
+# ifdef __GNUC__
+# define volatile __volatile__
+# else
+# define volatile /*nothing*/
+# endif /* GNUC */
+#endif /* STDC */
+#endif /* volatile */
+
+/* Defaults for system-wide constants (if not defined by xm.h, we fake it). */
+
#if !defined (UINT_MAX)
#define UINT_MAX 0xffffffff
#endif
#endif /* No LONG_LONG. */
#endif /* No longest_to_int. */
-/* Languages represented in the symbol table and elsewhere. */
+/* Assorted functions we can declare, now that const and volatile are
+ defined. */
+extern char *savestring ();
+extern char *strsave ();
+extern char *concat ();
+#ifdef __STDC__
+extern void *xmalloc (), *xrealloc ();
+#else
+extern char *xmalloc (), *xrealloc ();
+#endif
+extern void free ();
+extern int parse_escape ();
+extern char *reg_names[];
+/* Indicate that these routines do not return to the caller. */
+extern volatile void error(), fatal();
+extern void warning_setup(), warning();
-enum language
-{
- language_unknown, /* Language not known */
- language_auto, /* Placeholder for automatic setting */
- language_c, /* C */
- language_cplus, /* C++ */
- language_m2, /* Modula-2 */
-};
+/* Various possibilities for alloca. */
+#ifndef alloca
+# ifdef __GNUC__
+# define alloca __builtin_alloca
+# else
+# ifdef sparc
+# include <alloca.h>
+# endif
+ extern char *alloca ();
+# endif
+#endif
-/* Return a format string for printf that will print a number in the local
- (language-specific) hexadecimal format. Result is static and is
- overwritten by the next call. local_hex_format_custom takes printf
- options like "08" or "l" (to produce e.g. %08x or %lx). */
+/* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these. */
-#define local_hex_format() (current_language->la_hex_format)
-char *local_hex_format_custom(); /* language.c */
+#if !defined (BIG_ENDIAN)
+#define BIG_ENDIAN 4321
+#endif
-/* Return a string that contains a number formatted in the local
- (language-specific) hexadecimal format. Result is static and is
- overwritten by the next call. local_hex_string_custom takes printf
- options like "08" or "l". */
+#if !defined (LITTLE_ENDIAN)
+#define LITTLE_ENDIAN 1234
+#endif
-char *local_hex_string (); /* language.c */
-char *local_hex_string_custom (); /* language.c */
-\f
-/* System-dependent parameters for GDB.
+/* Target-system-dependent parameters for GDB.
The standard thing is to include defs.h. However, files that are
specific to a particular target can define TM_FILE_OVERRIDE before
#include "tm.h"
#endif
-/* Host machine definition. This will be a symlink to one of the
- xm-*.h files, built by the `configure' script. */
-
-#include "xm.h"
-
-/* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these. */
-#if !defined (BIG_ENDIAN)
-#define BIG_ENDIAN 4321
-#endif
-
-#if !defined (LITTLE_ENDIAN)
-#define LITTLE_ENDIAN 1234
-#endif
-
/* The bit byte-order has to do just with numbering of bits in
debugging symbols and such. Conceptually, it's quite separate
from byte/word byte order. */
/* Evaluate expressions for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+ Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
This file is part of GDB.
#include <stdio.h>
#include "defs.h"
-#include "param.h"
#include "symtab.h"
#include "value.h"
#include "expression.h"
}
\f
/* Evaluate an expression in internal prefix form
- such as is constructed by expread.y.
+ such as is constructed by parse.y.
See expression.h for info on the format of an expression. */
enum noside
{ EVAL_NORMAL,
EVAL_SKIP, /* Only effect is to increment pos. */
- EVAL_AVOID_SIDE_EFFECTS, /* Don't modify any variables or
+ EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or
call any functions. The value
returned will have the correct
type, and will have an
{
value x = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (VALUE_LVAL (x) == lval_memory)
- return value_zero (TYPE_POINTER_TYPE (VALUE_TYPE (x)),
+ return value_zero (lookup_pointer_type (VALUE_TYPE (x)),
not_lval);
else
error ("Attempt to take address of non-lval");
(LONGEST) TYPE_LENGTH (VALUE_TYPE (val)));
}
}
+
+/* Parse a type expression in the string [P..P+LENGTH). */
+
+struct type *
+parse_and_eval_type (p, length)
+ char *p;
+ int length;
+{
+ char *tmp = (char *)alloca (length + 4);
+ struct expression *expr;
+ tmp[0] = '(';
+ bcopy (p, tmp+1, length);
+ tmp[length+1] = ')';
+ tmp[length+2] = '0';
+ tmp[length+3] = '\0';
+ expr = parse_expression (tmp);
+ if (expr->elts[0].opcode != UNOP_CAST)
+ error ("Internal error in eval_type.");
+ return expr->elts[1].type;
+}
/* Modula-2 */
TYPE_CODE_CHAR, /* *real* character type */
- TYPE_CODE_BOOL, /* Builtin Modula-2 BOOLEAN */
+ TYPE_CODE_BOOL /* Builtin Modula-2 BOOLEAN */
};
/* This appears in a type's flags word for an unsigned integer type. */
/* Slot to point to additional language-specific fields of this type. */
union type_specific
{
+ /* ARG_TYPES is for TYPE_CODE_METHOD and TYPE_CODE_FUNCTION. */
struct type **arg_types;
+ /* CPLUS_STUFF is for TYPE_CODE_STRUCT. */
struct cplus_struct_type *cplus_stuff;
} type_specific;
};
struct type *fcontext;
unsigned int is_const : 1;
unsigned int is_volatile : 1;
+ unsigned int is_private : 1;
+ unsigned int is_protected : 1;
+ unsigned int is_stub : 1;
+ unsigned int dummy : 3;
+
/* Index into that baseclass's virtual function table,
minus 2; else if static: VOFFSET_STATIC; else: 0. */
- unsigned voffset : 30;
+ unsigned voffset : 24;
# define VOFFSET_STATIC 1
} *fn_fields;
- B_TYPE *private_fn_field_bits;
- B_TYPE *protected_fn_field_bits;
-
} *fn_fieldlists;
unsigned char via_protected;
enum namespace
{
- UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE, LABEL_NAMESPACE,
+ UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE, LABEL_NAMESPACE
};
/* An address-class says where to find the value of a symbol. */
`struct block'. Function names have this class. */
LOC_CONST_BYTES, /* Value is a constant byte-sequence pointed to by
SYMBOL_VALUE_ADDRESS, in target byte order. */
- LOC_LOCAL_ARG, /* Value is arg at spec'd offset in stack frame.
+ LOC_LOCAL_ARG /* Value is arg at spec'd offset in stack frame.
Differs from LOC_LOCAL in that symbol is an
argument; differs from LOC_ARG in that we find it
in the frame (FRAME_LOCALS_ADDRESS), not in the
#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)
+#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
+#define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
+#define TYPE_FN_FIELD_PROTECTED(thisfn, n) ((thisfn)[n].is_protected)
/* The virtual function table is now an array of structures
which have the form { int16 offset, delta; void *pfn; }.