aboutsummaryrefslogtreecommitdiff
path: root/gdb/stabsread.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>1995-01-07 15:30:58 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>1995-01-07 15:30:58 +0000
commit02b40a193ee4627451f2c525671883ad94f17452 (patch)
treeaf34b2a2958c34c3cf9b43f16c845cdd3d1b0a41 /gdb/stabsread.c
parent4a4f9e3bf1f7f3d3b30311626cb04ed2518cf826 (diff)
downloadgdb-02b40a193ee4627451f2c525671883ad94f17452.zip
gdb-02b40a193ee4627451f2c525671883ad94f17452.tar.gz
gdb-02b40a193ee4627451f2c525671883ad94f17452.tar.bz2
* dbxread.c (process_one_symbol): Handle N_FUN symbols
for Sun acc 3.0 under SunOS4. Changes to improve handling of runtime common symbols under SunOS4. * minsyms.c (get_symbol_leading_char): New routine to determine the leading symbol character for an objfile. (prim_record_minimal_symbol_and_info, install_minimal_symbols): Use it. * objfiles.h (rt_common_objfile): New global, points to objfile containing the runtime common minimal symbols. * objfiles.c (free_objfile): Mark rt_common_objfile as unallocated before freeing it. * solib.c (allocate_rt_common_objfile): New routine to allocate an objfile for the runtime common minimal symbols. (solib_add_common_symbols): Allocate an objfile for the runtime common symbols if necessary and put common symbols into it. Clean up code and comments. (solib_add, special_symbol_handling): Cleanup comments regarding runtime common symbols. * stabsread.c (scan_file_globals_1): New routine, contains old scan_file_globals code. Checks if there are any unresolved global symbols before starting the expensive minimal symbol table search. (scan_file_globals): Now calls scan_file_globals_1 for the passed objfile and eventually for the runtime common objfile. Complains about any unresolved global symbols and removes them from the global symbol chain to avoid dangling pointers into the symbol table if the symbol table is reread.
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r--gdb/stabsread.c62
1 files changed, 57 insertions, 5 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index a21e521..8bc9948 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1,5 +1,5 @@
/* Support routines for decoding "stabs" debugging information format.
- Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
@@ -186,6 +186,9 @@ struct complaint unrecognized_cplus_name_complaint =
struct complaint rs6000_builtin_complaint =
{"Unknown builtin type %d", 0, 0};
+struct complaint unresolved_sym_chain_complaint =
+ {"%s: `%s' from global_sym_chain unresolved", 0, 0};
+
struct complaint stabs_general_complaint =
{"%s", 0, 0};
@@ -3801,18 +3804,31 @@ GDB internal error. cleanup_undefined_types with bad type %d.", 0, 0};
/* Scan through all of the global symbols defined in the object file,
assigning values to the debugging symbols that need to be assigned
- to. Get these symbols from the minimal symbol table. */
+ to. Get these symbols from the minimal symbol table.
+ Return 1 if there might still be unresolved debugging symbols, else 0. */
-void
-scan_file_globals (objfile)
+static int scan_file_globals_1 PARAMS ((struct objfile *));
+
+static int
+scan_file_globals_1 (objfile)
struct objfile *objfile;
{
int hash;
struct minimal_symbol *msymbol;
struct symbol *sym, *prev;
+ /* Avoid expensive loop through all minimal symbols if there are
+ no unresolved symbols. */
+ for (hash = 0; hash < HASHSIZE; hash++)
+ {
+ if (global_sym_chain[hash])
+ break;
+ }
+ if (hash >= HASHSIZE)
+ return 0;
+
if (objfile->msymbols == 0) /* Beware the null file. */
- return;
+ return 1;
for (msymbol = objfile -> msymbols; SYMBOL_NAME (msymbol) != NULL; msymbol++)
{
@@ -3883,6 +3899,42 @@ scan_file_globals (objfile)
}
}
}
+ return 1;
+}
+
+/* Assign values to global debugging symbols.
+ Search the passed objfile first, then try the runtime common symbols.
+ Complain about any remaining unresolved symbols and remove them
+ from the chain. */
+
+void
+scan_file_globals (objfile)
+ struct objfile *objfile;
+{
+ int hash;
+ struct symbol *sym, *prev;
+
+ if (scan_file_globals_1 (objfile) == 0)
+ return;
+ if (rt_common_objfile && scan_file_globals_1 (rt_common_objfile) == 0)
+ return;
+
+ for (hash = 0; hash < HASHSIZE; hash++)
+ {
+ sym = global_sym_chain[hash];
+ while (sym)
+ {
+ complain (&unresolved_sym_chain_complaint,
+ objfile->name, SYMBOL_NAME (sym));
+
+ /* Change the symbol address from the misleading chain value
+ to address zero. */
+ prev = sym;
+ sym = SYMBOL_VALUE_CHAIN (sym);
+ SYMBOL_VALUE_ADDRESS (prev) = 0;
+ }
+ }
+ memset (global_sym_chain, 0, sizeof (global_sym_chain));
}
/* Initialize anything that needs initializing when starting to read