From 0848ad1c4da297c06f56855124aaf11b2cc30c71 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Fri, 2 Apr 1993 19:35:30 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 21 +++++++++++++++++++++ gdb/c-exp.y | 1 + gdb/ch-exp.y | 1 + gdb/m2-exp.y | 1 + gdb/stabsread.c | 29 ++++++++++++++++++++++++++--- gdb/xcoffexec.c | 6 +++--- 6 files changed, 53 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 408f1c1dd19..cf03d722247 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +Fri Apr 2 08:23:14 1993 Jim Kingdon (kingdon@cygnus.com) + + * xcoffexec.c: Call fatal() not abort(). + + * 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. + **** start-sanitize-chill **** + ch-exp.y (yylex): Deal with it. + **** end-sanitize-chill **** + +Thu Apr 1 18:43:02 1993 Stu Grossman (grossman@cygnus.com) + + * findvar.c (value_from_register): H8500 specific, check to see + if we are looking at short pointer. If so, skip crock. + * h8500-tdep.c (h8500_frame_chain): Mask down value from + read_memory_integer() to avoid getting messed up by sign extension. + Thu Apr 1 16:44:41 1993 K. Richard Pixley (rich@rtl.cygnus.com) * sparc-tdep.c (in_solib_trampoline), symfile.c (find_pc_section): diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 933007ed33f..654bf75c356 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -671,6 +671,7 @@ variable: name_not_typename case LOC_LABEL: case LOC_BLOCK: case LOC_CONST_BYTES: + case LOC_OPTIMIZED_OUT: /* In this case the expression can be evaluated regardless of what diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y index 41ff2458650..0a2efd15e5b 100644 --- a/gdb/ch-exp.y +++ b/gdb/ch-exp.y @@ -1979,6 +1979,7 @@ yylex () case LOC_UNDEF: case LOC_TYPEDEF: case LOC_CONST_BYTES: + case LOC_OPTIMIZED_OUT: error ("Symbol \"%s\" names no location.", simplename); break; } diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 8a7dbbacbf3..449b13f4bb1 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -617,6 +617,7 @@ variable: NAME case LOC_LABEL: /* maybe should go above? */ case LOC_BLOCK: case LOC_CONST_BYTES: + case LOC_OPTIMIZED_OUT: /* These are listed so gcc -Wall will reveal un-handled cases. */ break; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 796fac522f1..170dbe8e346 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 { diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c index 0fae0902de0..400d3cd914d 100644 --- a/gdb/xcoffexec.c +++ b/gdb/xcoffexec.c @@ -228,14 +228,14 @@ build_section_table (some_bfd, start, end) count = bfd_count_sections (some_bfd); if (count == 0) - abort(); /* return 1? */ + fatal ("aborting"); /* return 1? */ if (*start) free (*start); *start = (struct section_table *) xmalloc (count * sizeof (**start)); *end = *start; bfd_map_over_sections (some_bfd, add_to_section_table, (char *)end); if (*end > *start + count) - abort(); + fatal ("aborting"); /* We could realloc the table, but it probably loses for most files. */ return 0; } @@ -644,7 +644,7 @@ xfer_memory (memaddr, myaddr, len, write, target) boolean (*xfer_fn) PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type)); if (len <= 0) - abort(); + fatal ("aborting"); memend = memaddr + len; xfer_fn = write? bfd_set_section_contents: bfd_get_section_contents; -- 2.30.2