static char stabs_symbol[] = STABS_SYMBOL;
-/* Extra builtin types */
-
-struct type *builtin_type_complex;
-struct type *builtin_type_double_complex;
-struct type *builtin_type_fixed_dec;
-struct type *builtin_type_float_dec;
-struct type *builtin_type_string;
+/* Types corresponding to btComplex, btDComplex, etc. These are here
+ rather than in gdbtypes.c or some such, because the meaning of codes
+ like btComplex is specific to the mdebug debug format. FIXME: We should
+ be using our own types thoughout this file, instead of sometimes using
+ builtin_type_*. */
+
+static struct type *mdebug_type_complex;
+static struct type *mdebug_type_double_complex;
+static struct type *mdebug_type_fixed_dec;
+static struct type *mdebug_type_float_dec;
+static struct type *mdebug_type_string;
/* Forward declarations */
else
t = pend->t;
- /* Alpha cc unnamed structs do not get a tag name. */
- if (sh->iss == 0)
+ /* Do not set the tag name if it is a compiler generated tag name
+ (.Fxx or .xxfake or empty) for unnamed struct/union/enums.
+ Alpha cc puts out an sh->iss of zero for those. */
+ if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
TYPE_TAG_NAME (t) = NULL;
else
TYPE_TAG_NAME (t) = obconcat (¤t_objfile->symbol_obstack,
if (type_code == TYPE_CODE_ENUM)
{
/* This is a non-empty enum. */
+
+ /* DEC c89 has the number of enumerators in the sh.value field,
+ not the type length, so we have to compensate for that
+ incompatibility quirk.
+ This might do the wrong thing for an enum with one or two
+ enumerators and gcc -gcoff -fshort-enums, but these cases
+ are hopefully rare enough. */
+ if (TYPE_LENGTH (t) == TYPE_NFIELDS (t))
+ TYPE_LENGTH (t) = TARGET_INT_BIT / HOST_CHAR_BIT;
for (ext_tsym = ext_sh + external_sym_size;
;
ext_tsym += external_sym_size)
0, /* btTypedef */
0, /* btRange */
0, /* btSet */
- &builtin_type_complex, /* btComplex */
- &builtin_type_double_complex, /* btDComplex */
+ &mdebug_type_complex, /* btComplex */
+ &mdebug_type_double_complex, /* btDComplex */
0, /* btIndirect */
- &builtin_type_fixed_dec, /* btFixedDec */
- &builtin_type_float_dec, /* btFloatDec */
- &builtin_type_string, /* btString */
+ &mdebug_type_fixed_dec, /* btFixedDec */
+ &mdebug_type_float_dec, /* btFloatDec */
+ &mdebug_type_string, /* btString */
0, /* btBit */
0, /* btPicture */
&builtin_type_void, /* btVoid */
if (tp == (struct type *) NULL)
tp = init_type (type_code, 0, 0, (char *) NULL, current_objfile);
+ /* DEC c89 produces cross references to qualified aggregate types,
+ dereference them. */
+ while (TYPE_CODE (tp) == TYPE_CODE_PTR
+ || TYPE_CODE (tp) == TYPE_CODE_ARRAY)
+ tp = tp->target_type;
+
/* Make sure that TYPE_CODE(tp) has an expected type code.
Any type may be returned from cross_ref if file indirect entries
are corrupted. */
if (pr->isym == -1)
{
/* Static procedure at address pr->adr. Sigh. */
+ /* FIXME-32x64. assuming pr->adr fits in long. */
complain (&pdr_static_symbol_complaint, (unsigned long) pr->adr);
return;
}
ms_type = mst_unknown;
complain (&unknown_ext_complaint, name);
}
- prim_record_minimal_symbol (name, ext_in->asym.value, ms_type);
+ prim_record_minimal_symbol (name, ext_in->asym.value, ms_type, objfile);
}
/* Pass 3 over files, over local syms: fill in static symbols */
/* I believe this is used only for file-local functions.
The comment in symconst.h ("load time only static procs")
isn't particularly clear on this point. */
- prim_record_minimal_symbol (name, sh.value, mst_file_text);
+ prim_record_minimal_symbol (name, sh.value, mst_file_text,
+ objfile);
/* FALLTHROUGH */
case stProc: /* Asm labels apparently */
case stStatic: /* Variable */
if (sh.sc == scData || sh.sc == scSData || sh.sc == scRData)
- prim_record_minimal_symbol (name, sh.value, mst_file_data);
+ prim_record_minimal_symbol (name, sh.value, mst_file_data,
+ objfile);
else
- prim_record_minimal_symbol (name, sh.value, mst_file_bss);
+ prim_record_minimal_symbol (name, sh.value, mst_file_bss,
+ objfile);
class = LOC_STATIC;
break;
if (ECOFF_IS_STAB (&sh))
{
int type_code = ECOFF_UNMARK_STAB (sh.index);
- process_one_symbol (type_code, 0, valu, name,
- pst->section_offsets, pst->objfile);
+
+ /* We should never get non N_STAB symbols here, but they
+ should be harmless, so keep process_one_symbol from
+ complaining about them. */
+ if (type_code & N_STAB)
+ {
+ process_one_symbol (type_code, 0, valu, name,
+ pst->section_offsets, pst->objfile);
+ }
if (type_code == N_FUN)
{
/* Make up special symbol to contain
add_symbol_to_list (s, &local_symbols);
}
}
- else if (sh.st == stLabel && sh.index != indexNil)
+ else if (sh.st == stLabel)
{
- /* Handle encoded stab line number. */
- record_line (current_subfile, sh.index, valu);
+ if (sh.index == indexNil)
+ {
+ /* This is what the gcc2_compiled and __gnu_compiled_*
+ show up as. So don't complain. */
+ ;
+ }
+ else
+ /* Handle encoded stab line number. */
+ record_line (current_subfile, sh.index, valu);
}
else if (sh.st == stProc || sh.st == stStaticProc || sh.st == stEnd)
/* These are generated by gcc-2.x, do not complain */
CORE_ADDR adr;
int last;
{
+ /* DEC c89 sometimes produces zero linenos which confuse gdb.
+ Change them to something sensible. */
+ if (lineno == 0)
+ lineno = 1;
if (last == 0)
last = -2; /* make sure we record first line */
{
/* Missing basic types */
- builtin_type_string =
+ /* Is a "string" the way btString means it the same as TYPE_CODE_STRING?
+ FIXME. */
+ mdebug_type_string =
init_type (TYPE_CODE_STRING,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "string",
(struct objfile *) NULL);
- builtin_type_complex =
- init_type (TYPE_CODE_FLT,
+
+ mdebug_type_complex =
+ init_type (TYPE_CODE_ERROR,
TARGET_COMPLEX_BIT / TARGET_CHAR_BIT,
0, "complex",
(struct objfile *) NULL);
- builtin_type_double_complex =
- init_type (TYPE_CODE_FLT,
+ mdebug_type_double_complex =
+ init_type (TYPE_CODE_ERROR,
TARGET_DOUBLE_COMPLEX_BIT / TARGET_CHAR_BIT,
0, "double complex",
(struct objfile *) NULL);
- builtin_type_fixed_dec =
+
+ /* We use TYPE_CODE_INT to print these as integers. Does this do any
+ good? Would we be better off with TYPE_CODE_ERROR? Should
+ TYPE_CODE_ERROR print things in hex if it knows the size? */
+ mdebug_type_fixed_dec =
init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "fixed decimal",
(struct objfile *) NULL);
- builtin_type_float_dec =
- init_type (TYPE_CODE_FLT,
+
+ mdebug_type_float_dec =
+ init_type (TYPE_CODE_ERROR,
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "floating decimal",
(struct objfile *) NULL);