#include "symfile.h"
#include "objfiles.h"
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native */
+#include "libaout.h"
+#include "aout/aout64.h"
+#include "gdb-stabs.h"
#include "buildsym.h"
#include "complaints.h"
#include "demangle.h"
sym = find_symbol_in_list (symbols, name, pp-name);
if (!sym)
{
-#if 0
- /* The following code is disabled because AIX's xlc also
- puts out a stab but no C_EXT in the case where a
- symbol is referenced but not defined (in that
- compilation unit). So we just don't create a symbol,
- and the user will get the symbol from the compilation
- unit in which the symbol is actually defined. */
+ /* FIXME-maybe: it would be nice if we noticed whether
+ the variable was defined *anywhere*, not just whether
+ it is defined in this compilation unit. But neither
+ xlc or GCC seem to need such a definition, and until
+ we do psymtabs (so that the minimal symbols from all
+ compilation units are available now), I'm not sure
+ how to get the information. */
/* On xcoff, if a global is defined and never referenced,
ld will remove it from the executable. There is then
SYMBOL_TYPE (sym) = read_type (&pp, objfile);
}
add_symbol_to_list (sym, &global_symbols);
-#endif /* 0 */
}
else
{
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
+ switch (type & N_TYPE)
+ {
+ case N_TEXT:
+ SYMBOL_SECTION(sym) = SECT_OFF_TEXT;
+ break;
+ case N_DATA:
+ SYMBOL_SECTION(sym) = SECT_OFF_DATA;
+ break;
+ case N_BSS:
+ SYMBOL_SECTION(sym) = SECT_OFF_BSS;
+ break;
+ }
+
if (processing_gcc_compilation)
{
/* GCC 2.x puts the line number in desc. SunOS apparently puts in the
/* Sun cc uses a pair of symbols, one 'p' and one 'r' with the same
name to represent an argument passed in a register.
GCC uses 'P' for the same case. So if we find such a symbol pair
- we combine it into one 'P' symbol.
+ we combine it into one 'P' symbol. For Sun cc we need to do this
+ regardless of REG_STRUCT_HAS_ADDR, because the compiler puts out
+ the 'p' symbol even if it never saves the argument onto the stack.
- But we only do this in the REG_STRUCT_HAS_ADDR case, so that
+ On most machines, we want to preserve both symbols, so that
we can still get information about what is going on with the
stack (VAX for computing args_printed, using stack slots instead
of saved registers in backtraces, etc.).
if (local_symbols
&& local_symbols->nsyms > 0
+#ifndef USE_REGISTER_NOT_ARG
&& REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
SYMBOL_TYPE (sym))
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
- || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION))
+ || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
+#endif
+ )
{
struct symbol *prev_sym;
prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
- if (SYMBOL_CLASS (prev_sym) == LOC_REF_ARG
+ if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG
+ || SYMBOL_CLASS (prev_sym) == LOC_ARG)
&& STREQ (SYMBOL_NAME (prev_sym), SYMBOL_NAME(sym)))
{
SYMBOL_CLASS (prev_sym) = LOC_REGPARM;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL)
{
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+ /* gcc-2.6 or later (when using -fvtable-thunks)
+ emits a unique named type for a vtable entry.
+ Some gdb code depends on that specific name. */
+ extern const char vtbl_ptr_name[];
+
+ if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+ && strcmp (SYMBOL_NAME (sym), vtbl_ptr_name))
|| TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as "pointer to
if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1])
/* It's being defined as itself. That means it is "void". */
- type = init_type (TYPE_CODE_VOID, 0, 0, NULL, objfile);
+ type = init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
else
{
struct type *xtype;
case 'f': /* Function returning another type */
if (os9k_stabs && **pp == '(')
{
- /* Function prototype; skip it.
+ /* Function prototype; parse it.
We must conditionalize this on os9k_stabs because otherwise
it could be confused with a Sun-style (1,3) typenumber
(I think). */
- while (**pp != ')')
- ++*pp;
+ struct type *t;
++*pp;
+ while (**pp != ')')
+ {
+ t = read_type(pp, objfile);
+ if (**pp == ',') ++*pp;
+ }
}
type1 = read_type (pp, objfile);
type = make_function_type (type1, dbx_lookup_type (typenums));
"unsigned long", NULL);
break;
case 11:
- rettype = init_type (TYPE_CODE_VOID, 0, 0, "void", NULL);
+ rettype = init_type (TYPE_CODE_VOID, 1, 0, "void", NULL);
break;
case 12:
/* IEEE single precision (32 bit). */
if (**pp == ';')
++(*pp);
- return init_type (type_bits == 0 ? TYPE_CODE_VOID : TYPE_CODE_INT,
- type_bits / TARGET_CHAR_BIT,
- signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
- objfile);
+ if (type_bits == 0)
+ return init_type (TYPE_CODE_VOID, 1,
+ signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
+ objfile);
+ else
+ return init_type (TYPE_CODE_INT,
+ type_bits / TARGET_CHAR_BIT,
+ signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
+ objfile);
}
static struct type *
/* A type defined as a subrange of itself, with bounds both 0, is void. */
if (self_subrange && n2 == 0 && n3 == 0)
- return init_type (TYPE_CODE_VOID, 0, 0, NULL, objfile);
+ return init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
/* If n3 is zero and n2 is not, we want a floating type,
and n2 is the width in bytes.
{
SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msymbol);
}
+
+ SYMBOL_SECTION (sym) = SYMBOL_SECTION (msymbol);
if (prev)
{