/* Read coff symbol tables and convert to internal format, for GDB.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
- Copyright 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993
+ Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-\f
+
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
int old_vector_length = type_vector_length;
type_vector_length *= 2;
- if (type_vector_length < index) {
+ if (index /* is still */ >= type_vector_length) {
type_vector_length = index * 2;
}
type_vector = (struct type **)
if (!stream)
perror_with_name(objfile->name);
+ /* Work around a stdio bug in SunOS4.1.1 (this makes me nervous....
+ it's hard to know I've really worked around it. This should be
+ harmless, anyway). */
+ rewind (stream);
+
/* Position to read the symbol table. */
val = fseek (stream, (long)symtab_offset, 0);
if (val < 0)
add_param_to_type(&in_function_type,sym);
#endif
coff_add_symbol_to_list (sym, &coff_local_symbols);
-#if !defined (BELIEVE_PCC_PROMOTION)
+#if !defined (BELIEVE_PCC_PROMOTION) && (TARGET_BYTE_ORDER == BIG_ENDIAN)
/* If PCC says a parameter is a short or a char,
- it is really an int. */
+ aligned on an int boundary, realign it to the "little end"
+ of the int. */
temptype = lookup_fundamental_type (current_objfile, FT_INTEGER);
if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype)
- && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
+ && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT
+ && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (temptype))
{
- SYMBOL_TYPE (sym) = TYPE_UNSIGNED (SYMBOL_TYPE (sym))
- ? lookup_fundamental_type (current_objfile,
- FT_UNSIGNED_INTEGER)
- : temptype;
+ SYMBOL_VALUE (sym) += TYPE_LENGTH (temptype)
+ - TYPE_LENGTH (SYMBOL_TYPE (sym));
}
#endif
break;
SYMBOL_VALUE (sym) = SDB_REG_TO_REGNUM(cs->c_value);
coff_add_symbol_to_list (sym, &coff_local_symbols);
#if !defined (BELIEVE_PCC_PROMOTION)
+ /* FIXME: This should retain the current type, since it's just
+ a register value. gnu@adobe, 26Feb93 */
/* If PCC says a parameter is a short or a char,
it is really an int. */
temptype = lookup_fundamental_type (current_objfile, FT_INTEGER);
/* Read a definition of an enumeration type,
and create and return a suitable type object.
Also defines the symbols that represent the values of the type. */
-/* Currently assumes it's sizeof (int) and doesn't use length. */
/* ARGSUSED */
static struct type *
/* Now fill in the fields of the type-structure. */
- TYPE_LENGTH (type) = TARGET_INT_BIT / TARGET_CHAR_BIT;
+ if (length > 0)
+ TYPE_LENGTH (type) = length;
+ else
+ TYPE_LENGTH (type) = TARGET_INT_BIT / TARGET_CHAR_BIT; /* Assume ints */
TYPE_CODE (type) = TYPE_CODE_ENUM;
TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *)