Fri Jun 12 18:54:40 1992 John Gilmore (gnu at cygnus.com)
+ * arm-pinsn.c, i960-pinsn.c, m68k-pinsn.c, mips-pinsn.c,
+ ns32k-pinsn.c, pyr-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c,
+ vax-pinsn.c: Remove reg_names decl (now in defs.h).
+
+ Solaris-2 support on SPARC:
+
+ * dbxread.c: Add symbol_size to struct dbx_symfile_info.
+ Add symbol_size and file offsets to struct symloc.
+ Add static symbol_table_offset, string_table_offset,
+ file_string_table_offset, next_file_string_table_offset,
+ last_function_name.
+ (add_old_header_file): Convert error() to complain()t.
+ (dbx_symfile_read): Get symbol size via the objfile.
+ Also get symbol_table_offset.
+ (dbx_symfile_init): Record symbol size and count via the objfile.
+ (dbx_next_symbol_text): Always add file_string_table_offset when
+ accessing string table.
+ (read_dbx_symtab): Initialize file_string_table_offset to 0.
+ (SET_NAMESTRING): Use the offset.
+ (end_psymtab): Large kludge to determine addresses where source
+ files start and end (for the psymtab header).
+ (psymtab_to_symtab_1): Set file_string_table_offset before reading.
+ Get this, symbol size, and symbol offset, from psymtab.
+ (read_ofile_symtab): Don't back up one symbol for Solaris2.
+ Patch up last_source_start_addr if zero in N_SO.
+ (process_one_symbol): Add variable function_start_offset.
+ ( "", N_FUN, N_LBRAC, N_RBRAC, N_SLINE): Add ifdef for
+ BLOCK_ADDRESS_FUNCTION_RELATIVE.
+ ( "", N_OBJ, N_OPT): Ignore.
+ (elfstab_build_psymtabs): New function to read stabs out of
+ an ELF file.
+
+ * Makefile.in: Accept $(BISON) even though we really want $(YACC).
+ (gdb): use GLOBAL_CFLAGS when linking, too.
+ * partial-stab.h (N_UNDF): Deal with Sol2 relative stringtab offsets.
+ (N_OBJ, N_OPT): Ignore.
+ ('f', 'F'): Save last function name.
+
+ * elfread.c (record_minimal_symbol_and_info): Kludged to put
+ extra info in the minimal symbol.
+ (elf_symtab_read): The extra info is the size of an ELF object,
+ which was kludged to us in the `udata' field of the BFD symbol.
+ Gag me with a crowbar...
+ (elf_symfile_read): Keep track of both the absolute load address,
+ and the offset between load addr and symbols. Handle STABS as
+ well as DWARF sections, passing the absolute load address to
+ elfstab_build_psymtabs.
+
+ * symfile.h: Prototype elfstab_build_psymtabs.
+ * symfile.c: Add almost-OK debug versions of add_psymbol_*to_list.
+
+ * xm-sysv4.h: Add <limits.h> to avoid conflicting defns in defs.h.
+
* buildsym.h: Add processing_acc_compilation flag.
* buildsym.c (read_sun_builtin_type, read_sun_floating_type): New.
(define_symbol): Skip arg types in function entries. Resolve
* configure.in: Solaris config is sparc-sun-solaris2.
* config/sun4os5.m[ht]: Rename to config/sun4sol2.m[ht]; new xm, tm.
+ * objfiles.c (free_objfile): Eliminate storage leaks. Contributed
+ by <Peter.Schauer@regent.e-technik.tu-muenchen.dbp.de>.
+ * symfile.c (symfile_bfd_open): Comment where name is freed.
+ * symmisc.c (extend_psymbol_list): Comment where list is freed.
+
Fri Jun 12 12:49:43 1992 Fred Fish (fnf@cygnus.com)
* expprint.c (print_subexp): Add missing ']'.
unsigned int dbsize; /* Size of dwarf debug section */
unsigned int lnoffset; /* Offset to dwarf line number section */
unsigned int lnsize; /* Size of dwarf line number section */
+ asection *stabsect; /* Section pointer for .stab section */
+ asection *stabindexsect; /* Section pointer for .stab.index section */
};
static void
knowledge of DWARF (by design, so any debugging format can be
used).
+ We also recognize the ".stab" sections used by the Sun compilers
+ released with Solaris 2.
+
FIXME: The section names should not be hardwired strings. */
static void
ei -> lnoffset = sectp -> filepos;
ei -> lnsize = bfd_get_section_size_before_reloc (sectp);
}
+ else if (STREQ (sectp -> name, ".stab"))
+ {
+ ei -> stabsect = sectp;
+ }
+ else if (STREQ (sectp -> name, ".stab.index"))
+ {
+ ei -> stabindexsect = sectp;
+ }
}
#if 0 /* Currently unused */
prim_record_minimal_symbol (name, address, ms_type);
}
+static void
+record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
+ char *name;
+ CORE_ADDR address;
+ enum minimal_symbol_type ms_type;
+ char *info; /* FIXME, is this really char *? */
+ struct objfile *objfile;
+{
+ name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
+ prim_record_minimal_symbol_and_info (name, address, ms_type, info);
+}
+
/*
LOCAL FUNCTION
{
ms_type = mst_unknown;
}
- record_minimal_symbol ((char *) sym -> name, symaddr, ms_type, objfile);
+ /* Pass symbol size field in via BFD. FIXME!!! */
+ record_minimal_symbol_and_info ((char *) sym -> name,
+ symaddr, ms_type, sym->udata, objfile);
}
}
do_cleanups (back_to);
symbol tables. When more extensive information is requested of a
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.
+ for real.
+
+ We look for sections with specific names, to tell us what debug
+ format to look for: FIXME!!!
+
+ dwarf_build_psymtabs() builds psymtabs for DWARF symbols;
+ elfstab_build_psymtabs() handles STABS 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 gdb's minimal symbol table. This gives us some minimal debugging
- capability even for files compiled without -g.
- */
+ for linking. We process this also, and use the information to
+ build gdb's minimal symbol table. This gives us some minimal debugging
+ capability even for files compiled without -g. */
static void
elf_symfile_read (objfile, addr, mainline)
struct elfinfo ei;
struct cleanup *back_to;
asection *text_sect;
+ CORE_ADDR offset;
init_minimal_symbol_collection ();
back_to = make_cleanup (discard_minimal_symbols, 0);
of the text section, we can compute the relocation amount. */
text_sect = bfd_get_section_by_name (objfile -> obfd, ".text");
- addr -= bfd_section_vma (objfile -> obfd, text_sect);
+ offset = addr - bfd_section_vma (objfile -> obfd, text_sect);
/* Process the normal ELF symbol table first. */
- elf_symtab_read (abfd, addr, objfile);
+ elf_symtab_read (abfd, offset, objfile);
- /* Now process the DWARF debugging information, which is contained in
+ /* Now process 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, (PTR) &ei);
if (ei.dboffset && ei.lnoffset)
{
+ /* DWARF sections */
dwarf_build_psymtabs (fileno ((FILE *)(abfd -> iostream)),
bfd_get_filename (abfd),
- addr, mainline,
+ offset, mainline,
ei.dboffset, ei.dbsize,
ei.lnoffset, ei.lnsize, objfile);
}
+ if (ei.stabsect)
+ {
+ /* STABS sections */
+
+ /* FIXME: Sun didn't really know how to implement this well.
+ They made .stab sections that don't point to the .stabstr
+ section with the sh_link field. BFD doesn't make string table
+ sections visible to the caller. So we have to search the
+ ELF section table, not the BFD section table, for the string
+ table. */
+ Elf_Internal_Shdr *elf_sect = bfd_elf_find_section (abfd, ".stabstr");
+
+ if (elf_sect)
+ elfstab_build_psymtabs (objfile,
+ addr, /* We really pass the text seg addr, not the offset, here. */
+ mainline,
+ ei.stabsect->filepos, /* .stab offset */
+ bfd_get_section_size_before_reloc (ei.stabsect),/* .stab size */
+ elf_sect->sh_offset, /* .stabstr offset */
+ elf_sect->sh_size); /* .stabstr size */
+ }
if (!have_partial_symbols ())
{
file is specified (not just adding some symbols from another file, e.g. a
shared library).
- For now at least, we have nothing in particular to do, so this function is
- just a stub. */
+ We reinitialize buildsym, since we may be reading stabs from an ELF file. */
static void
elf_new_init (ignore)
if (objfile -> obfd != NULL)
{
+ char *name = bfd_get_filename (objfile->obfd);
bfd_close (objfile -> obfd);
+ free (name);
}
/* Remove it from the chain of all objfiles. */
unlink_objfile (objfile);
-#if 0 /* FIXME!! */
-
/* 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
#endif
clear_pc_function_cache ();
-#endif
-
/* The last thing we do is free the objfile struct itself for the
non-reusable case, or detach from the mapped file for the reusable
case. Note that the mmalloc_detach or the mfree is the last thing
{
mfree (objfile -> md, objfile -> name);
}
+ if (objfile->global_psymbols.list)
+ mfree (objfile->md, objfile->global_psymbols.list);
+ if (objfile->static_psymbols.list)
+ mfree (objfile->md, objfile->static_psymbols.list);
/* Free the obstacks for non-reusable objfiles */
obstack_free (&objfile -> psymbol_obstack, 0);
obstack_free (&objfile -> symbol_obstack, 0);