diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-04-02 19:35:30 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-04-02 19:35:30 +0000 |
commit | 0848ad1c4da297c06f56855124aaf11b2cc30c71 (patch) | |
tree | dc65b5c8708dee270cf23d0fe2a572ce6c6af45c /gdb/stabsread.c | |
parent | c209295fa5aa466f9eceb3167a13d9df58a33bc1 (diff) | |
download | gdb-0848ad1c4da297c06f56855124aaf11b2cc30c71.zip gdb-0848ad1c4da297c06f56855124aaf11b2cc30c71.tar.gz gdb-0848ad1c4da297c06f56855124aaf11b2cc30c71.tar.bz2 |
* stabsread.c (patch_block_stabs): If stab & no symbol, make
a LOC_OPTIMIZED_OUT symbol.
symtab.h (enum address_class): Add LOC_OPTIMIZED_OUT.
findvar.c (read_var_value), printcmd.c (address_info),
symmisc.c (print_{,partial_}symbol), c-exp.y (variable),
m2-exp.y (yylex): Deal with it.
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r-- | gdb/stabsread.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 796fac5..170dbe8 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -382,9 +382,32 @@ patch_block_stabs (symbols, stabs, objfile) sym = find_symbol_in_list (symbols, name, pp-name); if (!sym) { -#ifndef IBM6000_TARGET - printf ("ERROR! stab symbol not found!\n"); /* FIXME */ -#endif + /* On xcoff, if a global is defined and never referenced, + ld will remove it from the executable. There is then + a N_GSYM stab for it, but no regular (C_EXT) symbol. */ + sym = (struct symbol *) + obstack_alloc (&objfile->symbol_obstack, + sizeof (struct symbol)); + + memset (sym, 0, sizeof (struct symbol)); + SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; + SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT; + SYMBOL_NAME (sym) = + obstack_copy0 (&objfile->symbol_obstack, name, pp - name); + pp += 2; + if (*(pp-1) == 'F' || *(pp-1) == 'f') + { + /* I don't think the linker does this with functions, + so as far as I know this is never executed. + But it doesn't hurt to check. */ + SYMBOL_TYPE (sym) = + lookup_function_type (read_type (&pp, objfile)); + } + else + { + SYMBOL_TYPE (sym) = read_type (&pp, objfile); + } + add_symbol_to_list (sym, &global_symbols); } else { |