mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 18:14:13 +08:00
* 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).
This commit is contained in:
parent
2ce38c6d29
commit
d47d5315c8
@ -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)
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
103
gdb/symfile.c
103
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
|
||||
|
Loading…
Reference in New Issue
Block a user