/* Read coff symbol tables and convert to internal format, for GDB.
Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
- 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
#include "coff/internal.h" /* Internal format of COFF symbols in BFD */
#include "libcoff.h" /* FIXME secret internal data from BFD */
-
-#include "symfile.h"
#include "objfiles.h"
#include "buildsym.h"
#include "gdb-stabs.h"
csi = (struct coff_symfile_info *) csip;
name = bfd_get_section_name (abfd, sectp);
- if (STREQ (name, ".text"))
+ if (DEPRECATED_STREQ (name, ".text"))
{
csi->textaddr = bfd_section_vma (abfd, sectp);
csi->textsize += bfd_section_size (abfd, sectp);
{
csi->textsize += bfd_section_size (abfd, sectp);
}
- else if (STREQ (name, ".stabstr"))
+ else if (DEPRECATED_STREQ (name, ".stabstr"))
{
csi->stabstrsect = sectp;
}
last_source_file = savestring (name, strlen (name));
current_source_start_addr = start_addr;
current_source_end_addr = start_addr + size;
-
- if (current_objfile->ei.entry_point >= current_source_start_addr &&
- current_objfile->ei.entry_point < current_source_end_addr)
- {
- current_objfile->ei.deprecated_entry_file_lowpc = current_source_start_addr;
- current_objfile->ei.deprecated_entry_file_highpc = current_source_end_addr;
- }
}
/* Finish the symbol definitions for one main source file,
coff_symfile_init (struct objfile *objfile)
{
/* Allocate struct to keep track of stab reading. */
- objfile->sym_stab_info = (struct dbx_symfile_info *)
- xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
+ objfile->deprecated_sym_stab_info = (struct dbx_symfile_info *)
+ xmalloc (sizeof (struct dbx_symfile_info));
- memset (objfile->sym_stab_info, 0,
+ memset (objfile->deprecated_sym_stab_info, 0,
sizeof (struct dbx_symfile_info));
/* Allocate struct to keep track of the symfile */
- objfile->sym_private = xmmalloc (objfile->md,
- sizeof (struct coff_symfile_info));
+ objfile->deprecated_sym_private = xmalloc (sizeof (struct coff_symfile_info));
- memset (objfile->sym_private, 0, sizeof (struct coff_symfile_info));
+ memset (objfile->deprecated_sym_private, 0, sizeof (struct coff_symfile_info));
/* COFF objects may be reordered, so set OBJF_REORDERED. If we
find this causes a significant slowdown in gdb then we could
int len;
char * target;
- info = (struct coff_symfile_info *) objfile->sym_private;
- dbxinfo = objfile->sym_stab_info;
+ info = (struct coff_symfile_info *) objfile->deprecated_sym_private;
+ dbxinfo = objfile->deprecated_sym_stab_info;
symfile_bfd = abfd; /* Kludge for swap routines */
/* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
/* Free the installed minimal symbol data. */
do_cleanups (cleanup_minimal_symbols);
+ /* If we are reinitializing, or if we have not loaded syms yet,
+ empty the psymtab. "mainline" is cleared so the *_read_psymtab
+ functions do not all re-initialize it. */
+ if (mainline)
+ {
+ init_psymbol_list (objfile, 0);
+ mainline = 0;
+ }
+
bfd_map_over_sections (abfd, coff_locate_sections, (void *) info);
if (info->stabsects)
info->stabsects,
info->stabstrsect->filepos, stabstrsize);
}
- if (dwarf2_has_info (abfd))
+ if (dwarf2_has_info (objfile))
{
/* DWARF2 sections. */
dwarf2_build_psymtabs (objfile, mainline);
}
+ dwarf2_build_frame_info (objfile);
+
do_cleanups (back_to);
}
static void
coff_symfile_finish (struct objfile *objfile)
{
- if (objfile->sym_private != NULL)
+ if (objfile->deprecated_sym_private != NULL)
{
- xmfree (objfile->md, objfile->sym_private);
+ xfree (objfile->deprecated_sym_private);
}
/* Let stabs reader clean up */
case C_THUMBSTATFUNC:
if (cs->c_name[0] == '.')
{
- if (STREQ (cs->c_name, ".text"))
+ if (DEPRECATED_STREQ (cs->c_name, ".text"))
{
/* FIXME: don't wire in ".text" as section name
or symbol name! */
break;
case C_FCN:
- if (STREQ (cs->c_name, ".bf"))
+ if (DEPRECATED_STREQ (cs->c_name, ".bf"))
{
within_function = 1;
new->name =
process_coff_symbol (&fcn_cs_saved, &fcn_aux_saved, objfile);
}
- else if (STREQ (cs->c_name, ".ef"))
+ else if (DEPRECATED_STREQ (cs->c_name, ".ef"))
{
if (!within_function)
error ("Bad coff function information\n");
break;
case C_BLOCK:
- if (STREQ (cs->c_name, ".bb"))
+ if (DEPRECATED_STREQ (cs->c_name, ".bb"))
{
tmpaddr = cs->c_value;
tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
push_context (++depth, tmpaddr);
}
- else if (STREQ (cs->c_name, ".eb"))
+ else if (DEPRECATED_STREQ (cs->c_name, ".eb"))
{
if (context_stack_depth <= 0)
{ /* We attempted to pop an empty context stack */
/* line numbers start at one for the first line of the function */
first_line--;
- for (;;)
+ /* If the line number table is full (e.g. 64K lines in COFF debug
+ info), the next function's L_LNNO32 might not be zero, so don't
+ overstep the table's end in any case. */
+ while (rawptr <= &linetab[0] + linetab_size)
{
bfd_coff_swap_lineno_in (symfile_bfd, rawptr, &lptr);
rawptr += local_linesz;
- /* The next function, or the sentinel, will have L_LNNO32 zero; we exit. */
+ /* The next function, or the sentinel, will have L_LNNO32 zero;
+ we exit. */
if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
record_line (current_subfile, first_line + L_LNNO32 (&lptr),
lptr.l_addr.l_paddr
for (sym = opaque_type_chain[hash]; sym;)
{
if (name[0] == DEPRECATED_SYMBOL_NAME (sym)[0] &&
- STREQ (name + 1, DEPRECATED_SYMBOL_NAME (sym) + 1))
+ strcmp (name + 1, DEPRECATED_SYMBOL_NAME (sym) + 1) == 0)
{
if (prev)
{
struct objfile *objfile)
{
struct symbol *sym
- = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+ = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
char *name;
list->field.name =
obsavestring (name,
strlen (name),
- ¤t_objfile->symbol_obstack);
+ ¤t_objfile->objfile_obstack);
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
FIELD_BITPOS (list->field) = 8 * ms->c_value;
FIELD_BITSIZE (list->field) = 0;
list->field.name =
obsavestring (name,
strlen (name),
- ¤t_objfile->symbol_obstack);
+ ¤t_objfile->objfile_obstack);
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
FIELD_BITPOS (list->field) = ms->c_value;
FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
{
case C_MOE:
sym = (struct symbol *) obstack_alloc
- (¤t_objfile->symbol_obstack,
+ (¤t_objfile->objfile_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
DEPRECATED_SYMBOL_NAME (sym) =
obsavestring (name, strlen (name),
- ¤t_objfile->symbol_obstack);
+ ¤t_objfile->objfile_obstack);
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = ms->c_value;