/* DWARF debugging format support for GDB.
- Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1998
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2002
Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support. Portions based on dbxread.c,
mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port.
#define AT_short_element_list (0x00f0|FORM_BLOCK2)
-/* External variables referenced. */
-
-extern int info_verbose; /* From main.c; nonzero => verbose */
-extern char *warning_pre_print; /* From utils.c */
-
/* The DWARF debugging information consists of two major pieces,
one is a block of DWARF Information Entries (DIE's) and the other
is a line number table. The "struct dieinfo" structure contains
dbbase = xmalloc (dbsize);
dbroff = 0;
if ((bfd_seek (abfd, dbfoff, SEEK_SET) != 0) ||
- (bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
+ (bfd_bread (dbbase, dbsize, abfd) != dbsize))
{
- free (dbbase);
+ xfree (dbbase);
error ("can't read DWARF data from '%s'", bfd_get_filename (abfd));
}
- back_to = make_cleanup (free, dbbase);
+ back_to = make_cleanup (xfree, dbbase);
/* If we are reinitializing, or if we have never loaded syms yet, init.
Since we have no idea how many DIES we are looking at, we just guess
some arbitrary value. */
- if (mainline || objfile->global_psymbols.size == 0 ||
- objfile->static_psymbols.size == 0)
+ if (mainline
+ || (objfile->global_psymbols.size == 0
+ && objfile->static_psymbols.size == 0))
{
init_psymbol_list (objfile, 1024);
}
static void
free_utypes (PTR dummy)
{
- free (utypes);
+ xfree (utypes);
utypes = NULL;
numutypes = 0;
}
struct symbol *sym;
type = struct_type (dip, thisdie, enddie, objfile);
- if (!(TYPE_FLAGS (type) & TYPE_FLAG_STUB))
+ if (!TYPE_STUB (type))
{
sym = new_symbol (dip, objfile);
if (sym != NULL)
{
if (STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)))
{
+#if 0
+ /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
+ know whether it will use the old style or v3 mangling. */
set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
+#endif
}
else if (STREQN (producer, LCC_PRODUCER, strlen (LCC_PRODUCER)))
{
{
nextdie = thisdie + di.die_length;
}
-#ifdef SMASH_TEXT_ADDRESS
/* I think that these are always text, not data, addresses. */
- SMASH_TEXT_ADDRESS (di.at_low_pc);
- SMASH_TEXT_ADDRESS (di.at_high_pc);
-#endif
+ di.at_low_pc = SMASH_TEXT_ADDRESS (di.at_low_pc);
+ di.at_high_pc = SMASH_TEXT_ADDRESS (di.at_high_pc);
switch (di.die_tag)
{
case TAG_compile_unit:
base_section_offsets = pst->section_offsets;
baseaddr = ANOFFSET (pst->section_offsets, 0);
if (bfd_seek (abfd, foffset, SEEK_SET) ||
- (bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
+ (bfd_bread (dbbase, dbsize, abfd) != dbsize))
{
- free (dbbase);
+ xfree (dbbase);
error ("can't read DWARF data");
}
- back_to = make_cleanup (free, dbbase);
+ back_to = make_cleanup (xfree, dbbase);
/* If there is a line number table associated with this compilation unit
then read the size of this fragment in bytes, from the fragment itself.
if (LNFOFF (pst))
{
if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
- (bfd_read ((PTR) lnsizedata, sizeof (lnsizedata), 1, abfd) !=
- sizeof (lnsizedata)))
+ (bfd_bread ((PTR) lnsizedata, sizeof (lnsizedata), abfd)
+ != sizeof (lnsizedata)))
{
error ("can't read DWARF line number table size");
}
GET_UNSIGNED, pst->objfile);
lnbase = xmalloc (lnsize);
if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
- (bfd_read (lnbase, lnsize, 1, abfd) != lnsize))
+ (bfd_bread (lnbase, lnsize, abfd) != lnsize))
{
- free (lnbase);
+ xfree (lnbase);
error ("can't read DWARF line numbers");
}
- make_cleanup (free, lnbase);
+ make_cleanup (xfree, lnbase);
}
process_dies (dbbase, dbbase + dbsize, pst->objfile);