diff options
author | John Gilmore <gnu@cygnus> | 1991-10-26 08:02:23 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-10-26 08:02:23 +0000 |
commit | d47d5315c8a7ac2df73d47c96d9345c573e41563 (patch) | |
tree | 59bcc9a767761c0cc4c90b530fed323eafb36dfc | |
parent | 2ce38c6d29f82ccd2bcc90ece2e66456685b9099 (diff) | |
download | gdb-d47d5315c8a7ac2df73d47c96d9345c573e41563.zip gdb-d47d5315c8a7ac2df73d47c96d9345c573e41563.tar.gz gdb-d47d5315c8a7ac2df73d47c96d9345c573e41563.tar.bz2 |
* symfile.c (syms_from_bfd): New routine.
(add_symbol_file): Call it to do the real work.
(syms_from_bfd): Initialize entry_point before calling symfile_init.
* symtab.h, symfile.c, coffread.c, mipsread.c, dwarfread.c:
Avoid declaring or setting entry_point (symfile.h & symfile.c cope).
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/coffread.c | 4 | ||||
-rw-r--r-- | gdb/dwarfread.c | 1 | ||||
-rw-r--r-- | gdb/mipsread.c | 20 | ||||
-rw-r--r-- | gdb/symfile.c | 103 |
5 files changed, 86 insertions, 49 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2a50492..3ff9fd1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -4,6 +4,13 @@ Sat Oct 26 00:16:32 1991 John Gilmore (gnu at cygus.com) from dbxread.c, so they can be shared with xcoffread.c. * buildsym.h: New file. Declarations for buildsym.c users. * dbxread.c: Remove large chunks into buildsym.c. + * Makefile.in: Add buildsym.c and buildsym.h. + + * symfile.c (syms_from_bfd): New routine. + (add_symbol_file): Call it to do the real work. + (syms_from_bfd): Initialize entry_point before calling symfile_init. + * symtab.h, symfile.c, coffread.c, mipsread.c, dwarfread.c: + Avoid declaring or setting entry_point (symfile.h & symfile.c cope). Fri Oct 25 18:59:32 1991 Per Bothner (bothner at cygnus.com) diff --git a/gdb/coffread.c b/gdb/coffread.c index d579413..b4ff6d2 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -96,10 +96,6 @@ static CORE_ADDR first_object_file_end; static FILE *nlist_stream_global; static int nlist_nsyms_global; -/* The entry point (starting address) of the file, if it is an executable. */ - -static CORE_ADDR entry_point; - /* The index in the symbol table of the last coff symbol that was processed. */ static int symnum; diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index ac08a51..ce29d83 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -93,7 +93,6 @@ typedef unsigned int DIEREF; /* Reference to a DIE */ #define STREQ(a,b) (strcmp(a,b)==0) -extern CORE_ADDR entry_point; /* Process entry point */ extern CORE_ADDR startup_file_start; /* From blockframe.c */ extern CORE_ADDR startup_file_end; /* From blockframe.c */ extern CORE_ADDR entry_scope_lowpc; /* From blockframe.c */ diff --git a/gdb/mipsread.c b/gdb/mipsread.c index b216dde..964f791 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -213,8 +213,6 @@ CORE_ADDR sigtramp_address, sigtramp_end; /* The entry point (starting address) of the file, if it is an executable. */ -static CORE_ADDR entry_point; - extern CORE_ADDR startup_file_start; /* From blockframe.c */ extern CORE_ADDR startup_file_end; /* From blockframe.c */ @@ -233,24 +231,6 @@ mipscoff_symfile_init (sf) { bfd *abfd = sf->sym_bfd; sf->sym_private = NULL; - - /* Save startup file's range of PC addresses to help blockframe.c - decide where the bottom of the stack is. */ - if (bfd_get_file_flags (abfd) & EXEC_P) - { - /* Executable file -- record its entry point so we'll recognize - the startup file because it contains the entry point. */ - entry_point = bfd_get_start_address (abfd); - } - else - { - /* Examination of non-executable.o files. Short-circuit this stuff. */ - /* ~0 will not be in any file, we hope. */ - entry_point = ~0; - /* set the startup file to be an empty range. */ - startup_file_start = 0; - startup_file_end = 0; - } } void diff --git a/gdb/symfile.c b/gdb/symfile.c index 9f1b302..65942c8 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -38,12 +38,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h> #include <sys/stat.h> +CORE_ADDR entry_point; /* Where execution starts in symfile */ + extern int info_verbose; extern void qsort (); extern char *getenv (); extern char *rindex (); +extern CORE_ADDR startup_file_start; /* From blockframe.c */ +extern CORE_ADDR startup_file_end; /* From blockframe.c */ + /* Functions this file defines */ static bfd *symfile_open(); static struct sym_fns *symfile_init(); @@ -89,6 +94,7 @@ long /* really time_t */ symfile_mtime = 0; /* Structures with which to manage partial symbol allocation. */ +#include "param.h" struct psymbol_allocation_list global_psymbols = {0}, static_psymbols = {0}; /* Flag for whether user will be reloading symbols multiple times. @@ -337,6 +343,11 @@ condense_misc_bunches (inclink) if (misc_function_vector[j].name[0] == '_') misc_function_vector[j].name++; #endif +#ifdef SOME_NAMES_HAVE_DOT + if (misc_function_vector[j].name[0] == '.') + misc_function_vector[j].name++; +#endif + } bunch = bunch->next; misc_bunch_index = MISC_BUNCH_SIZE; @@ -389,45 +400,39 @@ psymtab_to_symtab (pst) where the text segment was loaded. */ void -symbol_file_add (name, from_tty, addr, mainline) - char *name; - int from_tty; +syms_from_bfd (sym_bfd, addr, mainline) + bfd *sym_bfd; CORE_ADDR addr; int mainline; { - bfd *sym_bfd; asection *text_sect; struct sym_fns *sf; char *realname; - sym_bfd = symfile_open (name); - - entry_point = bfd_get_start_address (sym_bfd); - - if (mainline) - symfile_mtime = bfd_get_mtime (sym_bfd); - /* There is a distinction between having no symbol table (we refuse to read the file, leaving the old set of symbols around) and having no debugging symbols in your symbol table (we read the file and end up with a mostly empty symbol table). */ if (!(bfd_get_file_flags (sym_bfd) & HAS_SYMS)) + return; + + /* Save startup file's range of PC addresses to help blockframe.c + decide where the bottom of the stack is. */ + if (bfd_get_file_flags (sym_bfd) & EXEC_P) { - error ("%s has no symbol-table", name); + /* Executable file -- record its entry point so we'll recognize + the startup file because it contains the entry point. */ + entry_point = bfd_get_start_address (sym_bfd); } - - if ((symtab_list || partial_symtab_list) - && mainline - && from_tty - && !query ("Load new symbol table from \"%s\"? ", name)) - error ("Not confirmed."); - - if (from_tty) + else { - printf_filtered ("Reading symbols from %s...", name); - wrap_here (""); - fflush (stdout); + /* Examination of non-executable.o files. Short-circuit this stuff. */ + /* ~0 will not be in any file, we hope. */ + entry_point = ~0; + /* set the startup file to be an empty range. */ + startup_file_start = 0; + startup_file_end = 0; } sf = symfile_init (sym_bfd); @@ -472,6 +477,57 @@ symbol_file_add (name, from_tty, addr, mainline) /* If we have wiped out any old symbol tables, clean up. */ clear_symtab_users_once (); +} + + +/* Process a symbol file, as either the main file or as a dynamically + loaded file. + + NAME is the file name (which will be tilde-expanded and made + absolute herein) (but we don't free or modify NAME itself). + FROM_TTY says how verbose to be. MAINLINE specifies whether this + is the main symbol file, or whether it's an extra symbol file such + as dynamically loaded code. If !mainline, ADDR is the address + where the text segment was loaded. */ + +void +symbol_file_add (name, from_tty, addr, mainline) + char *name; + int from_tty; + CORE_ADDR addr; + int mainline; +{ + bfd *sym_bfd; + + sym_bfd = symfile_open (name); + + if (mainline) + symfile_mtime = bfd_get_mtime (sym_bfd); + + /* There is a distinction between having no symbol table + (we refuse to read the file, leaving the old set of symbols around) + and having no debugging symbols in your symbol table (we read + the file and end up with a mostly empty symbol table). */ + + if (!(bfd_get_file_flags (sym_bfd) & HAS_SYMS)) + { + error ("%s has no symbol-table", name); + } + + if ((symtab_list || partial_symtab_list) + && mainline + && from_tty + && !query ("Load new symbol table from \"%s\"? ", name)) + error ("Not confirmed."); + + if (from_tty) + { + printf_filtered ("Reading symbols from %s...", name); + wrap_here (""); + fflush (stdout); + } + + syms_from_bfd (sym_bfd, addr, mainline); if (from_tty) { @@ -755,7 +811,6 @@ clear_complaints () Caller must set these fields: LINETABLE(symtab) symtab->blockvector - symtab->typevector symtab->dirname symtab->free_code symtab->free_ptr |