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 /gdb/symfile.c | |
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).
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 103 |
1 files changed, 79 insertions, 24 deletions
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 |