diff options
author | Stu Grossman <grossman@cygnus> | 1991-12-19 01:14:31 +0000 |
---|---|---|
committer | Stu Grossman <grossman@cygnus> | 1991-12-19 01:14:31 +0000 |
commit | 0a5d35ed30585c1d079e787f50fe0fd5c309fceb (patch) | |
tree | b9ebff12a9f17d22e87b251ddf28ad734cff1ec1 | |
parent | ce947b9d8d59e341291ff89b3fd1915d25bb78f5 (diff) | |
download | gdb-0a5d35ed30585c1d079e787f50fe0fd5c309fceb.zip gdb-0a5d35ed30585c1d079e787f50fe0fd5c309fceb.tar.gz gdb-0a5d35ed30585c1d079e787f50fe0fd5c309fceb.tar.bz2 |
* command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c,
sparc-tdep.c, symtab.h, target.h, value.h, vx-share/ptrace.h,
vx-share/xdr_ptrace.h, vx-share/xdr_rdb.h: ANSIfy enums.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/defs.h | 186 | ||||
-rw-r--r-- | gdb/eval.c | 29 | ||||
-rw-r--r-- | gdb/remote-sa.sparc.c | 2 | ||||
-rw-r--r-- | gdb/symtab.h | 28 |
5 files changed, 141 insertions, 110 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8e2ec1b..9fbf153 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Wed Dec 18 17:09:06 1991 Stu Grossman (grossman at cygnus.com) + + * command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c, + sparc-tdep.c, symtab.h, target.h, value.h, vx-share/ptrace.h, + vx-share/xdr_ptrace.h, vx-share/xdr_rdb.h: ANSIfy enums. + Mon Dec 16 12:31:46 1991 Fred Fish (fnf at cygnus.com) * config/mt-amix, config/mt-i386v4: Add solib.o to TDEPFILES @@ -30,59 +30,6 @@ typedef unsigned int CORE_ADDR; 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; @@ -186,6 +133,67 @@ extern unsigned output_radix; /* 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 */ + +/* 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 @@ -268,34 +276,46 @@ char *baud_rate; #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 */ - -/* 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 @@ -308,20 +328,6 @@ char *local_hex_string_custom (); /* language.c */ #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. */ @@ -1,5 +1,5 @@ /* 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. @@ -19,7 +19,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <stdio.h> #include "defs.h" -#include "param.h" #include "symtab.h" #include "value.h" #include "expression.h" @@ -96,7 +95,7 @@ parse_to_comma_and_eval (expp) } /* 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. */ @@ -109,7 +108,7 @@ static value evaluate_subexp_with_coercion (); 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 @@ -966,7 +965,7 @@ evaluate_subexp_for_address (exp, pos, noside) { 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"); @@ -1052,3 +1051,23 @@ evaluate_subexp_for_sizeof (exp, pos) (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; +} diff --git a/gdb/remote-sa.sparc.c b/gdb/remote-sa.sparc.c index fd73358..20f84a1 100644 --- a/gdb/remote-sa.sparc.c +++ b/gdb/remote-sa.sparc.c @@ -844,7 +844,7 @@ remote_single_step () CORE_ADDR next_pc, npc4, target, pc; typedef enum { - Error, not_branch, bicc, bicca, ba, baa, ticc, ta, + Error, not_branch, bicc, bicca, ba, baa, ticc, ta } branch_type; branch_type br, isannulled(); diff --git a/gdb/symtab.h b/gdb/symtab.h index 2c5646e..97b8800 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -103,7 +103,7 @@ enum type_code /* 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. */ @@ -197,7 +197,9 @@ struct 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; }; @@ -244,15 +246,17 @@ struct cplus_struct_type 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; @@ -358,7 +362,7 @@ struct block 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. */ @@ -381,7 +385,7 @@ enum address_class `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 @@ -730,13 +734,9 @@ B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)) #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; }. |