Changes to build misc function vector entries from canonical bfd symbol

table entries.
This commit is contained in:
Fred Fish 1991-11-15 03:36:45 +00:00
parent 811b9ab218
commit a7446af61b
3 changed files with 121 additions and 17 deletions

View File

@ -1,3 +1,22 @@
Thu Nov 14 19:27:30 1991 Fred Fish (fnf at cygnus.com)
* dwarfread.c: Add misc function type parameter to internal
record_misc_function(). Remove calls to init_misc_bunches()
and condense_misc_bunches(), these are now done in elfread.c.
* elfread.c: Add support for reading bfd canonical symbol tables
and generating misc function vector entries for global and
absolute symbols. Do calls to init_misc_bunches() and
condense_misc_bunches() where they will enclose all calls to
record_misc_function(), including those in dwarfread.c.
Thu Nov 14 17:02:11 1991 Roland H. Pesch (pesch at cygnus.com)
* doc/Makefile.in: new targets gdb.me, gdb.ms, gdb.mm
(roffable documentation).
* doc/gdb.texinfo: embedded hints (as comments) for better
texi2roff conversion.
Thu Nov 14 13:18:25 1991 John Gilmore (gnu at cygnus.com)
* m88k-tdep.c (examine_prologue): Deal with OR instructions

View File

@ -448,7 +448,8 @@ static int
EXFUN(locval, (char *loc));
static void
EXFUN(record_misc_function, (char *name AND CORE_ADDR address));
EXFUN(record_misc_function, (char *name AND CORE_ADDR address AND
enum misc_function_type));
static int
EXFUN(compare_psymbols,
@ -522,9 +523,6 @@ DEFUN(dwarf_build_psymtabs,
init_psymbol_list (1024);
}
init_misc_bunches ();
make_cleanup (discard_misc_bunches, 0);
/* Follow the compilation unit sibling chain, building a partial symbol
table entry for each one. Save enough information about each compilation
unit to locate the full DWARF information later. */
@ -532,10 +530,6 @@ DEFUN(dwarf_build_psymtabs,
scan_compilation_units (filename, addr, dbbase, dbbase + dbsize,
dbfoff, lnoffset, objfile);
/* Go over the miscellaneous functions and install them in the miscellaneous
function vector. */
condense_misc_bunches (!mainline);
do_cleanups (back_to);
}
@ -548,7 +542,8 @@ LOCAL FUNCTION
SYNOPSIS
static void record_misc_function (char *name, CORE_ADDR address)
static void record_misc_function (char *name, CORE_ADDR address,
enum misc_function_type mf_type)
DESCRIPTION
@ -557,17 +552,14 @@ DESCRIPTION
symbol, records this information for later use in building the
miscellaneous function vector.
NOTES
FIXME: For now we just use mf_text as the type. This should be
fixed.
*/
static void
DEFUN(record_misc_function, (name, address), char *name AND CORE_ADDR address)
DEFUN(record_misc_function, (name, address, mf_type),
char *name AND CORE_ADDR address AND enum misc_function_type mf_type)
{
prim_record_misc_function (obsavestring (name, strlen (name)), address,
mf_text);
mf_type);
}
/*
@ -2615,11 +2607,13 @@ DEFUN(add_partial_symbol, (dip), struct dieinfo *dip)
switch (dip -> dietag)
{
case TAG_global_subroutine:
record_misc_function (dip -> at_name, dip -> at_low_pc);
record_misc_function (dip -> at_name, dip -> at_low_pc, mf_text);
add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE,
LOC_BLOCK, dip -> at_low_pc);
break;
case TAG_global_variable:
record_misc_function (dip -> at_name, locval (dip -> at_location),
mf_data);
add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE,
LOC_STATIC, 0);
break;

View File

@ -94,6 +94,71 @@ DEFUN(elf_locate_sections, (abfd, sectp, ei),
}
}
/*
LOCAL FUNCTION
record_misc_function -- add entry to miscellaneous function vector
SYNOPSIS
static void record_misc_function (char *name, CORE_ADDR address)
DESCRIPTION
Given a pointer to the name of a symbol that should be added to the
miscellaneous function vector, and the address associated with that
symbol, records this information for later use in building the
miscellaneous function vector.
NOTES
FIXME: For now we just use mf_unknown as the type. This should be
fixed.
*/
static void
DEFUN(record_misc_function, (name, address), char *name AND CORE_ADDR address)
{
prim_record_misc_function (obsavestring (name, strlen (name)), address,
mf_unknown);
}
static void
DEFUN (elf_symtab_read, (abfd, addr),
bfd *abfd AND
CORE_ADDR addr)
{
unsigned int storage_needed;
asymbol *sym;
asymbol **symbol_table;
unsigned int number_of_symbols;
unsigned int i;
struct cleanup *back_to;
storage_needed = get_symtab_upper_bound (abfd);
if (storage_needed > 0)
{
symbol_table = (asymbol **) bfd_xmalloc (storage_needed);
back_to = make_cleanup (free, symbol_table);
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
{
sym = *symbol_table++;
/* Select global symbols that are defined in a specific section
or are absolute. */
if (sym -> flags & BSF_GLOBAL
&& ((sym -> section != NULL) || (sym -> flags & BSF_ABSOLUTE)))
{
record_misc_function ((char *) sym -> name, sym -> value);
}
}
do_cleanups (back_to);
}
}
/* Scan and build partial symbols for a symbol file.
We have been initialized by a call to elf_symfile_init, which
currently does nothing.
@ -111,7 +176,14 @@ DEFUN(elf_locate_sections, (abfd, sectp, ei),
file, the corresponding partial symbol table is mutated into a full
fledged symbol table by going back and reading the symbols
for real. The function dwarf_psymtab_to_symtab() is the function that
does this for DWARF symbols. */
does this for DWARF symbols.
Note that ELF files have a "minimal" symbol table, which looks a lot
like a COFF symbol table, but has only the minimal information necessary
for linking. We process this also, and just use the information to
add to the misc function vector. This gives us some minimal debugging
capability even for files compiled without -g.
*/
static void
DEFUN(elf_symfile_read, (sf, addr, mainline),
@ -121,7 +193,19 @@ DEFUN(elf_symfile_read, (sf, addr, mainline),
{
bfd *abfd = sf->objfile->obfd;
struct elfinfo ei;
struct cleanup *back_to;
init_misc_bunches ();
back_to = make_cleanup (discard_misc_bunches, 0);
/* Process the normal ELF symbol table first. */
elf_symtab_read (abfd, addr);
/* Now process the DWARF debugging information, which is contained in
special ELF sections. We first have to find them... */
(void) memset ((char *) &ei, 0, sizeof (ei));
bfd_map_over_sections (abfd, elf_locate_sections, &ei);
if (ei.dboffset && ei.lnoffset)
{
@ -132,12 +216,19 @@ DEFUN(elf_symfile_read, (sf, addr, mainline),
ei.dboffset, ei.dbsize,
ei.lnoffset, ei.lnsize, sf->objfile);
}
if (!partial_symtab_list)
{
wrap_here ("");
printf_filtered ("(no debugging symbols found)...");
wrap_here ("");
}
/* Go over the miscellaneous functions and install them in the
miscellaneous function vector. */
condense_misc_bunches (!mainline);
do_cleanups (back_to);
}
/* Initialize anything that needs initializing when a completely new symbol