aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog32
-rw-r--r--gdb/minsyms.c22
-rw-r--r--gdb/objfiles.c9
-rw-r--r--gdb/objfiles.h11
-rw-r--r--gdb/stabsread.c62
5 files changed, 124 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c7cd97b..e300be6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,35 @@
+Sat Jan 7 07:23:53 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
+
+ * 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.
+
Thu Jan 5 17:38:29 1995 Stu Grossman (grossman@cygnus.com)
* Makefile.in (install_only uninstall): Indent for clarity.
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 77d7466..26777f8 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1,5 +1,5 @@
/* GDB routines for manipulating the minimal symbol tables.
- Copyright 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
This file is part of GDB.
@@ -260,6 +260,22 @@ lookup_minimal_symbol_by_pc (pc)
return (best_symbol);
}
+/* Return leading symbol character for a BFD. If BFD is NULL,
+ return the leading symbol character from the main objfile. */
+
+static int get_symbol_leading_char PARAMS ((bfd *));
+
+static int
+get_symbol_leading_char (abfd)
+ bfd * abfd;
+{
+ if (abfd != NULL)
+ return bfd_get_symbol_leading_char (abfd);
+ if (symfile_objfile != NULL && symfile_objfile->obfd != NULL)
+ return bfd_get_symbol_leading_char (symfile_objfile->obfd);
+ return 0;
+}
+
/* Prepare to start collecting minimal symbols. Note that presetting
msym_bunch_index to BUNCH_SIZE causes the first call to save a minimal
symbol to allocate the memory for the first bunch. */
@@ -331,7 +347,7 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
{
const char *tempstring = name;
- if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd))
+ if (tempstring[0] == get_symbol_leading_char (objfile->obfd))
++tempstring;
if (STREQN (tempstring, "__gnu_compiled", 14))
return;
@@ -539,7 +555,7 @@ install_minimal_symbols (objfile)
each bunch is full. */
mcount = objfile->minimal_symbol_count;
- leading_char = bfd_get_symbol_leading_char (objfile->obfd);
+ leading_char = get_symbol_leading_char (objfile->obfd);
for (bunch = msym_bunch; bunch != NULL; bunch = bunch -> next)
{
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 891531d..cce17f8 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -1,5 +1,5 @@
/* GDB routines for manipulating objfiles.
- Copyright 1992 Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
This file is part of GDB.
@@ -59,6 +59,7 @@ extern char *error_pre_print;
struct objfile *object_files; /* Linked list of all objfiles */
struct objfile *current_objfile; /* For symbol file being read in */
struct objfile *symfile_objfile; /* Main symbol table loaded from */
+struct objfile *rt_common_objfile; /* For runtime common symbols */
int mapped_symbol_files; /* Try to use mapped symbol files */
@@ -372,6 +373,12 @@ free_objfile (objfile)
unlink_objfile (objfile);
+ /* If we are going to free the runtime common objfile, mark it
+ as unallocated. */
+
+ if (objfile == rt_common_objfile)
+ rt_common_objfile = NULL;
+
/* Before the symbol table code was redone to make it easier to
selectively load and remove information particular to a specific
linkage unit, gdb used to do these things whenever the monolithic
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 0a69f20..a4a1404 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -1,5 +1,5 @@
/* Definitions for symbol file management in GDB.
- Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
This file is part of GDB.
@@ -208,8 +208,8 @@ struct objfile
struct partial_symtab *free_psymtabs;
- /* The object file's BFD. Can be null, in which case bfd_open (name) and
- put the result here. */
+ /* The object file's BFD. Can be null if the objfile contains only
+ minimal symbols, e.g. the run time common symbols for SunOS4. */
bfd *obfd;
@@ -356,6 +356,11 @@ struct objfile
extern struct objfile *symfile_objfile;
+/* The object file that contains the runtime common minimal symbols
+ for SunOS4. Note that this objfile has no associated BFD. */
+
+extern struct objfile *rt_common_objfile;
+
/* When we need to allocate a new type, we need to know which type_obstack
to allocate the type on, since there is one for each objfile. The places
where types are allocated are deeply buried in function call hierarchies
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