/* Read hp debug symbols and convert to internal format, for GDB.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
Written by the Center for Software Science at the University of Utah
and by Cygnus Support. */
#include "gdb-stabs.h"
#include "gdbtypes.h"
#include "demangle.h"
+#include "solib-som.h"
+#include "gdb_assert.h"
+#include "hppa-tdep.h"
/* Private information attached to an objfile which we use to find
and internalize the HP C debug symbols within that objfile. */
/* Accessor macros to get at the fields. */
#define HPUX_SYMFILE_INFO(o) \
- ((struct hpread_symfile_info *)((o)->sym_private))
+ ((struct hpread_symfile_info *)((o)->deprecated_sym_private))
#define GNTT(o) (HPUX_SYMFILE_INFO(o)->gntt)
#define LNTT(o) (HPUX_SYMFILE_INFO(o)->lntt)
#define SLT(o) (HPUX_SYMFILE_INFO(o)->slt)
#define WITHIN_FUNCTION(o) (HPUX_SYMFILE_INFO(o)->within_function)
#define CURRENT_FUNCTION_VALUE(o) (HPUX_SYMFILE_INFO(o)->current_function_value)
-/* Given the native debug symbol SYM, set NAMEP to the name associated
- with the debug symbol. Note we may be called with a debug symbol which
- has no associated name, in that case we return an empty string.
-
- Also note we "know" that the name for any symbol is always in the
- same place. Hence we don't have to conditionalize on the symbol type. */
-#define SET_NAMESTRING(SYM, NAMEP, OBJFILE) \
- if (! hpread_has_name ((SYM)->dblock.kind)) \
- *NAMEP = ""; \
- else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \
- { \
- complain (&string_table_offset_complaint, (char *) symnum); \
- *NAMEP = ""; \
- } \
- else \
- *NAMEP = (SYM)->dsfile.name + VT (OBJFILE)
\f
/* We put a pointer to this structure in the read_symtab_private field
of the psymtab. */
#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
#define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
\f
-/* FIXME: Shouldn't this stuff be in a .h file somewhere? */
/* Complaints about the symbols we have encountered. */
-extern struct complaint string_table_offset_complaint;
-extern struct complaint lbrac_unmatched_complaint;
-extern struct complaint lbrac_mismatch_complaint;
-\f
-static struct complaint hpread_unhandled_end_common_complaint =
-{
- "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n", 0, 0
-};
-
-static struct complaint hpread_unhandled_type_complaint =
-{
- "hpread_type_translate: unhandled type code.", 0, 0
-};
-
-static struct complaint hpread_struct_complaint =
-{
- "hpread_read_struct_type: expected SVAR type...", 0, 0
-};
-
-static struct complaint hpread_array_complaint =
-{
- "error in hpread_array_type.", 0, 0
-};
-
-static struct complaint hpread_type_lookup_complaint =
-{
- "error in hpread_type_lookup().", 0, 0
-};
-
-
-static struct complaint hpread_unexpected_end_complaint =
-{
- "internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind.", 0, 0
-};
-
-static struct complaint hpread_tagdef_complaint =
-{
- "error processing class tagdef", 0, 0
-};
-
-static struct complaint hpread_unhandled_common_complaint =
+static void
+lbrac_unmatched_complaint (int arg1)
{
- "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON.", 0, 0
-};
+ complaint (&symfile_complaints, _("unmatched N_LBRAC before symtab pos %d"),
+ arg1);
+}
-static struct complaint hpread_unhandled_blockdata_complaint =
+static void
+lbrac_mismatch_complaint (int arg1)
{
- "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_BLOCKDATA.", 0, 0
-};
+ complaint (&symfile_complaints,
+ _("N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d"), arg1);
+}
/* To generate dumping code, uncomment this define. The dumping
itself is controlled by routine-local statics called "dumping". */
/* Forward procedure declarations */
+/* Used in somread.c. */
void hpread_symfile_init (struct objfile *);
void do_pxdb (bfd *);
void hpread_symfile_finish (struct objfile *);
+static void set_namestring (union dnttentry *sym, char **namep,
+ struct objfile *objfile);
+
static union dnttentry *hpread_get_gntt (int, struct objfile *);
static union dnttentry *hpread_get_lntt (int index, struct objfile *objfile);
static CORE_ADDR hpread_get_location (sltpointer, struct objfile *);
+static int hpread_has_name (enum dntt_entry_type kind);
+
static void hpread_psymtab_to_symtab_1 (struct partial_symtab *);
-void hpread_psymtab_to_symtab (struct partial_symtab *);
+static void hpread_psymtab_to_symtab (struct partial_symtab *);
static struct symtab *hpread_expand_symtab
(struct objfile *, int, int, CORE_ADDR, int,
static void hpread_adjust_bitoffsets (struct type *, int);
+static int hpread_adjust_stack_address (CORE_ADDR func_addr);
+
static dnttpointer hpread_get_next_skip_over_anon_unions
(int, dnttpointer, union dnttentry **, struct objfile *);
\f
-/* Global to indicate presence of HP-compiled objects,
- in particular, SOM executable file with SOM debug info
- Defined in symtab.c, used in hppa-tdep.c. */
-extern int hp_som_som_object_present;
-
/* Static used to indicate a class type that requires a
fix-up of one of its method types */
static struct type *fixup_class = NULL;
#include "gdb_string.h"
/* check for the existence of a file, given its full pathname */
-int
+static int
file_exists (char *filename)
{
if (filename)
static char main_string[] = "main";
\f
+
+/* Given the native debug symbol SYM, set NAMEP to the name associated
+ with the debug symbol. Note we may be called with a debug symbol which
+ has no associated name, in that case we return an empty string. */
+
+static void
+set_namestring (union dnttentry *sym, char **namep, struct objfile *objfile)
+{
+ /* Note that we "know" that the name for any symbol is always in the same
+ place. Hence we don't have to conditionalize on the symbol type. */
+ if (! hpread_has_name (sym->dblock.kind))
+ *namep = "";
+ else if ((unsigned) sym->dsfile.name >= VT_SIZE (objfile))
+ {
+ complaint (&symfile_complaints, _("bad string table offset in symbol %d"),
+ symnum);
+ *namep = "";
+ }
+ else
+ *namep = sym->dsfile.name + VT (objfile);
+}
+
/* Call PXDB to process our file.
Approach copied from DDE's "dbgk_run_pxdb". Note: we
NOTE: uses system function and string functions directly.
Return value: 1 if ok, 0 if not */
-int
+static int
hpread_call_pxdb (const char *file_name)
{
char *p;
strcat (p, " ");
strcat (p, file_name);
- warning ("File not processed by pxdb--about to process now.\n");
+ warning (_("File not processed by pxdb--about to process now."));
status = system (p);
retval = (status == 0);
}
else
{
- warning ("pxdb not found at standard location: /opt/langtools/bin\ngdb will not be able to debug %s.\nPlease install pxdb at the above location and then restart gdb.\nYou can also run pxdb on %s with the command\n\"pxdb %s\" and then restart gdb.", file_name, file_name, file_name);
+ warning (_("pxdb not found at standard location: /opt/langtools/bin\ngdb will not be able to debug %s.\nPlease install pxdb at the above location and then restart gdb.\nYou can also run pxdb on %s with the command\n\"pxdb %s\" and then restart gdb."), file_name, file_name, file_name);
retval = 0;
}
by PXDB, and we have thus called PXDB to do this processing
and the file therefore needs to be re-loaded. Otherwise
return 0. */
-int
+static int
hpread_pxdb_needed (bfd *sym_bfd)
{
asection *pinfo_section, *debug_section, *header_section;
if (header_section_size == (bfd_size_type) sizeof (DOC_info_PXDB_header))
{
buf = alloca (sizeof (DOC_info_PXDB_header));
+ memset (buf, 0, sizeof (DOC_info_PXDB_header));
if (!bfd_get_section_contents (sym_bfd,
header_section,
buf, 0,
header_section_size))
- error ("bfd_get_section_contents\n");
+ error (_("bfd_get_section_contents."));
tmp = bfd_get_32 (sym_bfd, (bfd_byte *) (buf + sizeof (int) * 4));
pxdbed = (tmp >> 31) & 0x1;
if (!pxdbed)
- error ("file debug header info invalid\n");
+ error (_("file debug header info invalid."));
do_pxdb = 0;
}
else
- error ("invalid $HEADER$ size in executable \n");
+ error (_("invalid $HEADER$ size in executable."));
}
else
{
buf = alloca (sizeof (PXDB_header));
+ memset (buf, 0, sizeof (PXDB_header));
if (!bfd_get_section_contents (sym_bfd,
header_section,
buf, 0,
header_section_size))
- error ("bfd_get_section_contents\n");
+ error (_("bfd_get_section_contents."));
tmp = bfd_get_32 (sym_bfd, (bfd_byte *) (buf + sizeof (int) * 3));
pxdbed = (tmp >> 31) & 0x1;
if (pxdbed)
do_pxdb = 0;
else
- error ("file debug header invalid\n");
+ error (_("file debug header invalid."));
}
else /*not pxdbed and doc OR not pxdbed and non doc */
do_pxdb = 1;
do { \
if( !told_objfile ) { \
told_objfile = 1; \
- warning ("\nIn object file \"%s\":\n", \
+ warning (_("\nIn object file \"%s\":"), \
objfile->name); \
} \
} while (0)
static pst_syms_struct *pst_syms_array = 0;
-static pst_syms_count = 0;
-static pst_syms_size = 0;
+static int pst_syms_count = 0;
+static int pst_syms_size = 0;
/* used by the TELL_OBJFILE macro */
-static boolean told_objfile = 0;
+static int told_objfile = 0;
/* Set up psymtab symbol index stuff */
static void
if (CURR_PROC_END > end_adr)
{
TELL_OBJFILE;
- warning ("Procedure \"%s\" [0x%x] spans file or module boundaries.", rtn_name, curr_pd);
+ warning (_("Procedure \"%s\" [0x%x] spans file or module boundaries."), rtn_name, curr_pd);
}
/* Add this routine symbol to the list in the objfile.
strlen (rtn_name),
rtn_dem_name,
strlen (rtn_dem_name),
- VAR_NAMESPACE,
+ VAR_DOMAIN,
LOC_BLOCK, /* "I am a routine" */
&objfile->global_psymbols,
(qPD[curr_pd].adrStart + /* Starting address of rtn */
strlen (rtn_name),
rtn_dem_name,
strlen (rtn_dem_name),
- VAR_NAMESPACE,
+ VAR_DOMAIN,
LOC_BLOCK, /* "I am a routine" */
&objfile->static_psymbols,
(qPD[curr_pd].adrStart + /* Starting address of rtn */
a file can result in a compiled object which does not have a module
entry for it, so in such cases we create a psymtab for the file. */
-int
+static int
hpread_quick_traverse (struct objfile *objfile, char *gntt_bits,
char *vt_bits, PXDB_header_ptr pxdb_header_p)
{
while (VALID_CURR_FILE || VALID_CURR_MODULE)
{
- char *mod_name_string;
+ char *mod_name_string = NULL;
char *full_name_string;
/* First check for modules like "version.c", which have no code
(CURR_MODULE_END == 0) || (CURR_MODULE_END == -1)))
{
TELL_OBJFILE;
- warning ("Module \"%s\" [0x%s] has non-standard addresses. It starts at 0x%s, ends at 0x%s, and will be skipped.",
+ warning (_("Module \"%s\" [0x%s] has non-standard addresses. It starts at 0x%s, ends at 0x%s, and will be skipped."),
mod_name_string, paddr_nz (curr_md), paddr_nz (start_adr), paddr_nz (end_adr));
/* On to next module */
curr_md++;
if (CURR_PROC_START < start_adr)
{
TELL_OBJFILE;
- warning ("Found procedure \"%s\" [0x%x] that is not in any file or module.",
+ warning (_("Found procedure \"%s\" [0x%x] that is not in any file or module."),
&vt_bits[(long) qPD[curr_pd].sbProc], curr_pd);
start_adr = CURR_PROC_START;
if (CURR_PROC_ISYM < start_sym)
if (VALID_FILE (curr_fd + 1) && (FILE_START (curr_fd + 1) <= end_adr))
{
TELL_OBJFILE;
- warning ("File \"%s\" [0x%x] has ending address after starting address of next file; adjusting ending address down.",
+ warning (_("File \"%s\" [0x%x] has ending address after starting address of next file; adjusting ending address down."),
full_name_string, curr_fd);
end_adr = FILE_START (curr_fd + 1) - 1; /* Is -4 (or -8 for 64-bit) better? */
}
if (VALID_MODULE (curr_md) && (CURR_MODULE_START <= end_adr))
{
TELL_OBJFILE;
- warning ("File \"%s\" [0x%x] has ending address after starting address of next module; adjusting ending address down.",
+ warning (_("File \"%s\" [0x%x] has ending address after starting address of next module; adjusting ending address down."),
full_name_string, curr_fd);
end_adr = CURR_MODULE_START - 1; /* Is -4 (or -8 for 64-bit) better? */
}
record_pst_syms (start_sym, end_sym);
if (NULL == pst)
- warning ("No symbols in psymtab for file \"%s\" [0x%x].", full_name_string, curr_fd);
+ warning (_("No symbols in psymtab for file \"%s\" [0x%x]."), full_name_string, curr_fd);
#ifdef DUMPING
if (dumping)
if (CURR_FILE_START < CURR_MODULE_START)
{
TELL_OBJFILE;
- warning ("File \"%s\" [0x%x] crosses beginning of module \"%s\".",
+ warning (_("File \"%s\" [0x%x] crosses beginning of module \"%s\"."),
&vt_bits[(long) qFD[curr_fd].sbFile],
curr_fd, mod_name_string);
if (CURR_FILE_END > end_adr)
{
TELL_OBJFILE;
- warning ("File \"%s\" [0x%x] crosses end of module \"%s\".",
+ warning (_("File \"%s\" [0x%x] crosses end of module \"%s\"."),
&vt_bits[(long) qFD[curr_fd].sbFile],
curr_fd, mod_name_string);
end_adr = CURR_FILE_END;
if (VALID_MODULE (curr_md + 1) && (MODULE_START (curr_md + 1) <= end_adr))
{
TELL_OBJFILE;
- warning ("Module \"%s\" [0x%x] has ending address after starting address of next module; adjusting ending address down.",
+ warning (_("Module \"%s\" [0x%x] has ending address after starting address of next module; adjusting ending address down."),
mod_name_string, curr_md);
end_adr = MODULE_START (curr_md + 1) - 1; /* Is -4 (or -8 for 64-bit) better? */
}
if (VALID_FILE (curr_fd + 1) && (FILE_START (curr_fd + 1) <= end_adr))
{
TELL_OBJFILE;
- warning ("Module \"%s\" [0x%x] has ending address after starting address of next file; adjusting ending address down.",
+ warning (_("Module \"%s\" [0x%x] has ending address after starting address of next file; adjusting ending address down."),
mod_name_string, curr_md);
end_adr = FILE_START (curr_fd + 1) - 1; /* Is -4 (or -8 for 64-bit) better? */
}
if (CURR_PROC_START < start_adr)
{
TELL_OBJFILE;
- warning ("Found procedure \"%s\" [0x%x] that is not in any file or module.",
+ warning (_("Found procedure \"%s\" [0x%x] that is not in any file or module."),
&vt_bits[(long) qPD[curr_pd].sbProc], curr_pd);
start_adr = CURR_PROC_START;
if (CURR_PROC_ISYM < start_sym)
record_pst_syms (start_sym, end_sym);
if (NULL == pst)
- warning ("No symbols in psymtab for module \"%s\" [0x%x].", mod_name_string, curr_md);
+ warning (_("No symbols in psymtab for module \"%s\" [0x%x]."), mod_name_string, curr_md);
#ifdef DUMPING
if (dumping)
start_adr = CURR_PROC_START;
end_adr = qPD[pxdb_header_p->pd_entries - 1].adrEnd;
TELL_OBJFILE;
- warning ("Found functions beyond end of all files and modules [0x%x].", curr_pd);
+ warning (_("Found functions beyond end of all files and modules [0x%x]."), curr_pd);
#ifdef DUMPING
if (dumping)
{
/* Get appropriate header, based on pxdb type.
Return value: 1 if ok, 0 if not */
-int
+static int
hpread_get_header (struct objfile *objfile, PXDB_header_ptr pxdb_header_p)
{
asection *pinfo_section, *debug_section, *header_section;
if (!doc_header.pxdbed)
{
/* This shouldn't happen if we check in "symfile.c". */
- warning ("File \"%s\" not processed by pxdb!", objfile->name);
+ warning (_("File \"%s\" not processed by pxdb!"), objfile->name);
return 0;
}
asection *vt_section, *slt_section, *lntt_section, *gntt_section;
/* Allocate struct to keep track of the symfile */
- objfile->sym_private = (PTR)
- xmmalloc (objfile->md, sizeof (struct hpread_symfile_info));
- memset (objfile->sym_private, 0, sizeof (struct hpread_symfile_info));
+ objfile->deprecated_sym_private =
+ xmalloc (sizeof (struct hpread_symfile_info));
+ memset (objfile->deprecated_sym_private, 0, sizeof (struct hpread_symfile_info));
/* We haven't read in any types yet. */
DNTT_TYPE_VECTOR (objfile) = 0;
return;
GNTT (objfile)
- = obstack_alloc (&objfile->symbol_obstack,
+ = obstack_alloc (&objfile->objfile_obstack,
bfd_section_size (objfile->obfd, gntt_section));
bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile),
return;
LNTT (objfile)
- = obstack_alloc (&objfile->symbol_obstack,
+ = obstack_alloc (&objfile->objfile_obstack,
bfd_section_size (objfile->obfd, lntt_section));
bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile),
return;
SLT (objfile) =
- obstack_alloc (&objfile->symbol_obstack,
+ obstack_alloc (&objfile->objfile_obstack,
bfd_section_size (objfile->obfd, slt_section));
bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile),
VT_SIZE (objfile) = bfd_section_size (objfile->obfd, vt_section);
VT (objfile) =
- (char *) obstack_alloc (&objfile->symbol_obstack,
+ (char *) obstack_alloc (&objfile->objfile_obstack,
VT_SIZE (objfile));
bfd_get_section_contents (objfile->obfd, vt_section, VT (objfile),
/* A source file of some kind. Note this may simply
be an included file. */
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ set_namestring (dn_bufp, &namestring, objfile);
/* Check if this is the source file we are already working
with. */
psymtab_include_list = (char **)
alloca ((includes_allocated *= 2) *
sizeof (char *));
- memcpy ((PTR) psymtab_include_list, (PTR) orig,
+ memcpy (psymtab_include_list, orig,
includes_used * sizeof (char *));
}
continue;
if (!have_name)
{
pst->filename = (char *)
- obstack_alloc (&pst->objfile->psymbol_obstack,
+ obstack_alloc (&pst->objfile->objfile_obstack,
strlen (namestring) + 1);
strcpy (pst->filename, namestring);
have_name = 1;
}
/* Now begin a new module and a new psymtab for it */
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ set_namestring (dn_bufp, &namestring, objfile);
valu = hpread_get_textlow (i, hp_symnum, objfile, symcount);
valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
if (!pst)
texthigh = valu;
valu = dn_bufp->dfunc.lowaddr +
ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ set_namestring (dn_bufp, &namestring, objfile);
if (dn_bufp->dfunc.global)
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, LOC_BLOCK,
+ VAR_DOMAIN, LOC_BLOCK,
&objfile->global_psymbols, valu,
0, language_unknown, objfile);
else
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, LOC_BLOCK,
+ VAR_DOMAIN, LOC_BLOCK,
&objfile->static_psymbols, valu,
0, language_unknown, objfile);
within_function = 1;
texthigh = valu;
valu = dn_bufp->ddocfunc.lowaddr +
ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ set_namestring (dn_bufp, &namestring, objfile);
if (dn_bufp->ddocfunc.global)
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, LOC_BLOCK,
+ VAR_DOMAIN, LOC_BLOCK,
&objfile->global_psymbols, valu,
0, language_unknown, objfile);
else
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, LOC_BLOCK,
+ VAR_DOMAIN, LOC_BLOCK,
&objfile->static_psymbols, valu,
0, language_unknown, objfile);
within_function = 1;
{
/* Variables, typedefs an the like. */
enum address_class storage;
- namespace_enum namespace;
+ domain_enum domain;
/* Don't add locals to the partial symbol table. */
if (within_function
|| dn_bufp->dblock.kind == DNTT_TYPE_DVAR))
continue;
- /* TAGDEFs go into the structure namespace. */
+ /* TAGDEFs go into the structure domain. */
if (dn_bufp->dblock.kind == DNTT_TYPE_TAGDEF)
- namespace = STRUCT_NAMESPACE;
+ domain = STRUCT_DOMAIN;
else
- namespace = VAR_NAMESPACE;
+ domain = VAR_DOMAIN;
/* What kind of "storage" does this use? */
if (dn_bufp->dblock.kind == DNTT_TYPE_SVAR)
else
storage = LOC_UNDEF;
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ set_namestring (dn_bufp, &namestring, objfile);
if (!pst)
{
pst = hpread_start_psymtab (objfile,
if (dn_bufp->dsvar.global)
{
add_psymbol_to_list (namestring, strlen (namestring),
- namespace, storage,
+ domain, storage,
&objfile->global_psymbols,
valu,
0, language_unknown, objfile);
else
{
add_psymbol_to_list (namestring, strlen (namestring),
- namespace, storage,
+ domain, storage,
&objfile->static_psymbols,
valu,
0, language_unknown, objfile);
}
/* For TAGDEF's, the above code added the tagname to the
- struct namespace. This will cause tag "t" to be found
+ struct domain. This will cause tag "t" to be found
on a reference of the form "(struct t) x". But for
C++ classes, "t" will also be a typename, which we
want to find on a reference of the form "ptype t".
- Therefore, we also add "t" to the var namespace.
+ Therefore, we also add "t" to the var domain.
Do the same for enum's due to the way aCC generates
debug info for these (see more extended comment
in hp-symtab-read.c).
if (global)
{
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, storage,
+ VAR_DOMAIN, storage,
&objfile->global_psymbols,
dn_bufp->dsvar.location,
0, language_unknown, objfile);
else
{
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, storage,
+ VAR_DOMAIN, storage,
&objfile->static_psymbols,
dn_bufp->dsvar.location,
0, language_unknown, objfile);
case DNTT_TYPE_MEMENUM:
case DNTT_TYPE_CONST:
/* Constants and members of enumerated types. */
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ set_namestring (dn_bufp, &namestring, objfile);
if (!pst)
{
pst = hpread_start_psymtab (objfile,
}
if (dn_bufp->dconst.global)
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST,
&objfile->global_psymbols, 0,
0, language_unknown, objfile);
else
add_psymbol_to_list (namestring, strlen (namestring),
- VAR_NAMESPACE, LOC_CONST,
+ VAR_DOMAIN, LOC_CONST,
&objfile->static_psymbols, 0,
0, language_unknown, objfile);
continue;
void
hpread_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);
}
}
\f
/* Various small functions to get entries in the debug symbol sections. */
-union dnttentry *
+static union dnttentry *
hpread_get_lntt (int index, struct objfile *objfile)
{
return (union dnttentry *)
&(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
}
-union sltentry *
+static union sltentry *
hpread_get_slt (int index, struct objfile *objfile)
{
return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
hpread_get_textlow (int global, int index, struct objfile *objfile,
int symcount)
{
- union dnttentry *dn_bufp;
+ union dnttentry *dn_bufp = NULL;
struct minimal_symbol *msymbol;
/* Look for a DNTT_TYPE_FUNCTION symbol. */
&& index < symcount);
}
+ /* NOTE: cagney/2003-03-29: If !(index < symcount), dn_bufp is left
+ undefined and that means that the test below is using a garbage
+ pointer from the stack. */
+ gdb_assert (dn_bufp != NULL);
+
/* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION. This
might happen when a sourcefile has no functions. */
if (dn_bufp->dblock.kind == DNTT_TYPE_END)
result->textlow += offset;
result->read_symtab_private = (char *)
- obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc));
LDSYMOFF (result) = ldsymoff;
result->read_symtab = hpread_psymtab_to_symtab;
if (number_dependencies)
{
pst->dependencies = (struct partial_symtab **)
- obstack_alloc (&objfile->psymbol_obstack,
+ obstack_alloc (&objfile->objfile_obstack,
number_dependencies * sizeof (struct partial_symtab *));
memcpy (pst->dependencies, dependency_list,
number_dependencies * sizeof (struct partial_symtab *));
subpst->section_offsets = pst->section_offsets;
subpst->read_symtab_private =
- (char *) obstack_alloc (&objfile->psymbol_obstack,
+ (char *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc));
LDSYMOFF (subpst) =
LDSYMLEN (subpst) =
/* We could save slight bits of space by only making one of these,
shared by the entire set of include files. FIXME-someday. */
subpst->dependencies = (struct partial_symtab **)
- obstack_alloc (&objfile->psymbol_obstack,
+ obstack_alloc (&objfile->objfile_obstack,
sizeof (struct partial_symtab *));
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;
* leave it here in case it proves useful later on. - RT).
*/
-int
+static int
hpread_has_name (enum dntt_entry_type kind)
{
switch (kind)
hpread_expand_symtab (pst->objfile, LDSYMOFF (pst), LDSYMLEN (pst),
pst->textlow, pst->texthigh - pst->textlow,
pst->section_offsets, pst->filename);
- sort_symtab_syms (pst->symtab);
do_cleanups (old_chain);
}
/* Read in all of the symbols for a given psymtab for real.
Be verbose about it if the user wants that. */
-void
+static void
hpread_psymtab_to_symtab (struct partial_symtab *pst)
{
/* Get out quick if given junk. */
if (dn_bufp->dblock.extension)
continue;
- /* Yow! We call SET_NAMESTRING on things without names! */
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ /* Yow! We call set_namestring on things without names! */
+ set_namestring (dn_bufp, &namestring, objfile);
hpread_process_one_debug_symbol (dn_bufp, namestring, section_offsets,
objfile, text_offset, text_size,
}
current_objfile = NULL;
- hp_som_som_object_present = 1; /* Indicate we've processed an HP SOM SOM file */
+ deprecated_hp_som_som_object_present = 1; /* Indicate we've processed an HP SOM SOM file */
return end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
}
{
if (!typep.dntti.immediate)
{
- error ("error in hpread_type_translate\n.");
+ error (_("error in hpread_type_translate\n."));
return FT_VOID;
}
case HP_TYPE_GLOBAL_ANYPOINTER:
case HP_TYPE_LOCAL_ANYPOINTER:
default:
- warning ("hpread_type_translate: unhandled type code.\n");
+ warning (_("hpread_type_translate: unhandled type code."));
return FT_VOID;
}
}
{
DNTT_TYPE_VECTOR_LENGTH (objfile) = LNTT_SYMCOUNT (objfile) + GNTT_SYMCOUNT (objfile);
DNTT_TYPE_VECTOR (objfile) = (struct type **)
- xmmalloc (objfile->md, DNTT_TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
+ xmalloc (DNTT_TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *));
memset (&DNTT_TYPE_VECTOR (objfile)[old_len], 0,
(DNTT_TYPE_VECTOR_LENGTH (objfile) - old_len) *
sizeof (struct type *));
if (size_changed)
{
DNTT_TYPE_VECTOR (objfile) = (struct type **)
- xmrealloc (objfile->md,
- (char *) DNTT_TYPE_VECTOR (objfile),
+ xrealloc ((char *) DNTT_TYPE_VECTOR (objfile),
(DNTT_TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *)));
memset (&DNTT_TYPE_VECTOR (objfile)[old_len], 0,
memp = hpread_get_lntt (mem.dnttp.index, objfile);
name = VT (objfile) + memp->dmember.name;
- sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+ sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
- &objfile->symbol_obstack);
+ DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+ &objfile->objfile_obstack);
SYMBOL_CLASS (sym) = LOC_CONST;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = memp->dmember.value;
add_symbol_to_list (sym, symlist);
nsyms++;
TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *)
- obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nsyms);
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nsyms);
/* Find the symbols for the members and put them into the type.
The symbols can be found in the symlist that we put them on
{
struct symbol *xsym = syms->symbol[j];
SYMBOL_TYPE (xsym) = type;
- TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+ TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
TYPE_FIELD_BITSIZE (type, n) = 0;
+ TYPE_FIELD_STATIC_KIND (type, n) = 0;
}
if (syms == osyms)
break;
/* Get the name. */
name = VT (objfile) + paramp->dfparam.name;
- sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+ sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
(void) memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
- &objfile->symbol_obstack);
+ DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+ &objfile->objfile_obstack);
/* Figure out where it lives. */
if (paramp->dfparam.regparam)
SYMBOL_CLASS (sym) = LOC_REF_ARG;
else
SYMBOL_CLASS (sym) = LOC_ARG;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
if (paramp->dfparam.copyparam)
{
SYMBOL_VALUE (sym) = paramp->dfparam.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
SYMBOL_VALUE (sym)
- += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+ += hpread_adjust_stack_address (CURRENT_FUNCTION_VALUE (objfile));
+
/* This is likely a pass-by-invisible reference parameter,
Hack on the symbol class to make GDB happy. */
/* ??rehrauer: This appears to be broken w/r/t to passing
/* Note how many parameters we found. */
TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *)
- obstack_alloc (&objfile->type_obstack,
+ obstack_alloc (&objfile->objfile_obstack,
sizeof (struct field) * nsyms);
/* Find the symbols for the parameters and
for (j = 0; j < syms->nsyms; j++, n++)
{
struct symbol *xsym = syms->symbol[j];
- TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+ TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
TYPE_FIELD_ARTIFICIAL (type, n) = 0;
TYPE_FIELD_BITSIZE (type, n) = 0;
+ TYPE_FIELD_STATIC_KIND (type, n) = 0;
}
}
/* Mark it as having been processed */
hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
struct objfile *objfile, int newblock)
{
- struct type *type, *type1;
struct pending *syms;
struct pending *local_list = NULL;
int nsyms = 0;
+ struct type *type;
dnttpointer param;
union dnttentry *paramp;
char *name;
}
else
{
+ struct type *type1 = NULL;
/* Nope, so read it in and store it away. */
if (dn_bufp->dblock.kind == DNTT_TYPE_DOC_FUNCTION ||
dn_bufp->dblock.kind == DNTT_TYPE_DOC_MEMFUNC)
type1 = lookup_function_type (hpread_type_lookup (dn_bufp->ddocfunc.retval,
objfile));
+ /* NOTE: cagney/2003-03-29: Oh, no not again. TYPE1 is
+ potentially left undefined here. Assert it isn't and hope
+ the assert never fails ... */
+ gdb_assert (type1 != NULL);
+
replace_type (type, type1);
/* Mark it -- in the middle of processing */
/* Get the name. */
name = VT (objfile) + paramp->dfparam.name;
- sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+ sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
(void) memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = name;
+ DEPRECATED_SYMBOL_NAME (sym) = name;
/* Figure out where it lives. */
if (paramp->dfparam.regparam)
SYMBOL_CLASS (sym) = LOC_REF_ARG;
else
SYMBOL_CLASS (sym) = LOC_ARG;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
if (paramp->dfparam.copyparam)
{
SYMBOL_VALUE (sym) = paramp->dfparam.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
SYMBOL_VALUE (sym)
- += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+ += hpread_adjust_stack_address(CURRENT_FUNCTION_VALUE (objfile));
+
/* This is likely a pass-by-invisible reference parameter,
Hack on the symbol class to make GDB happy. */
/* ??rehrauer: This appears to be broken w/r/t to passing
/* Note how many parameters we found. */
TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *)
- obstack_alloc (&objfile->type_obstack,
+ obstack_alloc (&objfile->objfile_obstack,
sizeof (struct field) * nsyms);
/* Find the symbols for the parameters and
for (j = 0; j < syms->nsyms; j++, n++)
{
struct symbol *xsym = syms->symbol[j];
- TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
+ TYPE_FIELD_NAME (type, n) = DEPRECATED_SYMBOL_NAME (xsym);
TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
TYPE_FIELD_ARTIFICIAL (type, n) = 0;
TYPE_FIELD_BITSIZE (type, n) = 0;
+ TYPE_FIELD_STATIC_KIND (type, n) = 0;
}
}
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
FIELD_BITSIZE (list->field) = 0;
+ FIELD_STATIC_KIND (list->field) = 0;
/* The "classname" field is actually a DNTT pointer to the base class */
baseclass = hpread_type_lookup (parentp->dinheritance.classname,
fieldp = hpread_get_lntt (field.dnttp.index, objfile);
if (fieldp->dblock.kind != DNTT_TYPE_TEMPLATE_ARG)
{
- warning ("Invalid debug info: Template argument entry is of wrong kind");
+ warning (_("Invalid debug info: Template argument entry is of wrong kind"));
break;
}
/* Bump the count */
n_templ_args++;
/* Allocate and fill in a struct next_template */
t_new = (struct next_template *) alloca (sizeof (struct next_template));
+ memset (t_new, 0, sizeof (struct next_template));
t_new->next = t_list;
t_list = t_new;
t_list->arg.name = VT (objfile) + fieldp->dtempl_arg.name;
if (n_templ_args > 0)
TYPE_TEMPLATE_ARGS (type) = (struct template_arg *)
- obstack_alloc (&objfile->type_obstack, sizeof (struct template_arg) * n_templ_args);
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct template_arg) * n_templ_args);
for (n = n_templ_args; t_list; t_list = t_list->next)
{
n -= 1;
{
TYPE_FLAGS (type) |= TYPE_FLAG_INCOMPLETE;
if (fixup_class)
- warning ("Two classes to fix up for method?? Type information may be incorrect for some classes.");
+ warning (_("Two classes to fix up for method?? Type information may be incorrect for some classes."));
if (fixup_method)
- warning ("Two methods to be fixed up at once?? Type information may be incorrect for some classes.");
+ warning (_("Two methods to be fixed up at once?? Type information may be incorrect for some classes."));
fixup_class = type; /* remember this class has to be fixed up */
fixup_method = memtype; /* remember the method type to be used in fixup */
}
fn_p = fn_list;
while (fn_p)
{
- if (STREQ (fn_p->field.name, method_name))
+ if (DEPRECATED_STREQ (fn_p->field.name, method_name))
break;
fn_p = fn_p->next;
}
/* Get space to record this member function */
/* Note: alloca used; this will disappear on routine exit */
fn_new = (struct next_fn_field *) alloca (sizeof (struct next_fn_field));
+ memset (fn_new, 0, sizeof (struct next_fn_field));
fn_new->next = fn_list;
fn_list = fn_new;
/* But mark it as NULL if the method was incompletely processed
We'll fix this up later when the method is fully processed */
if (TYPE_INCOMPLETE (memtype))
- {
- fn_p->field.fn_fields[ix].type = NULL;
- }
+ fn_p->field.fn_fields[ix].type = NULL;
else
- {
- fn_p->field.fn_fields[ix].type = memtype;
-
- /* The argument list */
- TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type).arg_types
- = (struct type **) obstack_alloc (&objfile->type_obstack,
- (sizeof (struct type *)
- * (TYPE_NFIELDS (memtype)
- + 1)));
- for (i = 0; i < TYPE_NFIELDS (memtype); i++)
- TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
- .arg_types[i] = TYPE_FIELDS (memtype)[i].type;
- /* void termination */
- TYPE_TYPE_SPECIFIC (fn_p->field.fn_fields[ix].type)
- .arg_types[TYPE_NFIELDS (memtype)] = builtin_type_void;
- }
+ fn_p->field.fn_fields[ix].type = memtype;
/* For virtual functions, fill in the voffset field with the
* virtual table offset. (This is just copied over from the
/* Get space to record this static member */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
list->field.name = VT (objfile) + fn_fieldp->dsvar.name;
- FIELD_BITSIZE (list->field) = -1; /* indicates static member */
SET_FIELD_PHYSNAME (list->field, 0); /* initialize to empty */
memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile);
Code below is replicated from the case for FIELDs further
below, except that fieldp is replaced by fn_fieldp */
if (!fn_fieldp->dfield.a_union)
- warning ("Debug info inconsistent: FIELD of anonymous union doesn't have a_union bit set");
+ warning (_("Debug info inconsistent: FIELD of anonymous union doesn't have a_union bit set"));
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
{
/* Field of anonymous union; union is not inside a class */
if (!fn_fieldp->dsvar.a_union)
- warning ("Debug info inconsistent: SVAR field in anonymous union doesn't have a_union bit set");
+ warning (_("Debug info inconsistent: SVAR field in anonymous union doesn't have a_union bit set"));
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
list->field.name = VT (objfile) + fn_fieldp->dsvar.name;
FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */
FIELD_BITSIZE (list->field) = 0; /* use length from type */
+ FIELD_STATIC_KIND (list->field) = 0;
memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile);
list->field.type = memtype;
list->attributes = 0;
{
/* Field of anonymous union; union is not inside a class */
if (!fn_fieldp->ddvar.a_union)
- warning ("Debug info inconsistent: DVAR field in anonymous union doesn't have a_union bit set");
+ warning (_("Debug info inconsistent: DVAR field in anonymous union doesn't have a_union bit set"));
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
list->field.name = VT (objfile) + fn_fieldp->ddvar.name;
FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */
FIELD_BITSIZE (list->field) = 0; /* use length from type */
+ FIELD_STATIC_KIND (list->field) = 0;
memtype = hpread_type_lookup (fn_fieldp->ddvar.type, objfile);
list->field.type = memtype;
list->attributes = 0;
if ((fn_fieldp->dblock.kind != DNTT_TYPE_MEMACCESS) &&
(fn_fieldp->dblock.kind != DNTT_TYPE_MEMENUM) &&
(fn_fieldp->dblock.kind != DNTT_TYPE_FUNC_TEMPLATE))
- warning ("Internal error: Unexpected debug record kind %d found following DNTT_GENFIELD",
+ warning (_("Internal error: Unexpected debug record kind %d found following DNTT_GENFIELD"),
fn_fieldp->dblock.kind);
}
/* walk to the next FIELD or GENFIELD */
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
list->field.name = VT (objfile) + fieldp->dfield.name;
- /* A FIELD by itself (without a GENFIELD) can also be a static member */
+ /* A FIELD by itself (without a GENFIELD) can also be a static
+ member. Mark it as static with a physname of NULL.
+ fix_static_member_physnames will assign the physname later. */
if (fieldp->dfield.staticmem)
{
- FIELD_BITPOS (list->field) = -1;
+ SET_FIELD_PHYSNAME (list->field, NULL);
+ FIELD_BITPOS (list->field) = 0;
FIELD_BITSIZE (list->field) = 0;
}
else
/* Non-static data member */
{
+ FIELD_STATIC_KIND (list->field) = 0;
FIELD_BITPOS (list->field) = fieldp->dfield.bitoffset;
if (fieldp->dfield.bitlength % 8)
FIELD_BITSIZE (list->field) = fieldp->dfield.bitlength;
{
/* neither field nor genfield ?? is this possible?? */
/* pai:: FIXME walk to the next -- how? */
- warning ("Internal error: unexpected DNTT kind %d encountered as field of struct",
+ warning (_("Internal error: unexpected DNTT kind %d encountered as field of struct"),
fieldp->dblock.kind);
- warning ("Skipping remaining fields of struct");
+ warning (_("Skipping remaining fields of struct"));
break; /* get out of loop of fields */
}
}
break;
i_new = (struct next_instantiation *) alloca (sizeof (struct next_instantiation));
+ memset (i_new, 0, sizeof (struct next_instantiation));
i_new->next = i_list;
i_list = i_new;
i_list->t = hpread_type_lookup (field, objfile);
TYPE_NINSTANTIATIONS (type) = ninstantiations;
if (ninstantiations > 0)
TYPE_INSTANTIATIONS (type) = (struct type **)
- obstack_alloc (&objfile->type_obstack, sizeof (struct type *) * ninstantiations);
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct type *) * ninstantiations);
for (n = ninstantiations; i_list; i_list = i_list->next)
{
n -= 1;
TYPE_NFIELDS (type) = nfields;
TYPE_N_BASECLASSES (type) = n_base_classes;
TYPE_FIELDS (type) = (struct field *)
- obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields);
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nfields);
/* Copy the saved-up fields into the field vector. */
for (n = nfields, tmp_list = list; tmp_list; tmp_list = tmp_list->next)
{
TYPE_NFN_FIELDS (type) = n_fn_fields;
TYPE_NFN_FIELDS_TOTAL (type) = n_fn_fields_total;
TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
- obstack_alloc (&objfile->type_obstack, sizeof (struct fn_fieldlist) * n_fn_fields);
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct fn_fieldlist) * n_fn_fields);
for (n = n_fn_fields; fn_list; fn_list = fn_list->next)
{
n -= 1;
return; /* physnames are already set */
SET_FIELD_PHYSNAME (TYPE_FIELDS (type)[i],
- obstack_alloc (&objfile->type_obstack,
+ obstack_alloc (&objfile->objfile_obstack,
strlen (class_name) + strlen (TYPE_FIELD_NAME (type, i)) + 3));
strcpy (TYPE_FIELD_STATIC_PHYSNAME (type, i), class_name);
strcat (TYPE_FIELD_STATIC_PHYSNAME (type, i), "::");
{
/* Set the method type */
TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j) = method;
- /* The argument list */
- TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types
- = (struct type **) obstack_alloc (&objfile->type_obstack,
- sizeof (struct type *) * (TYPE_NFIELDS (method) + 1));
- for (k = 0; k < TYPE_NFIELDS (method); k++)
- TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[k] = TYPE_FIELDS (method)[k].type;
- /* void termination */
- TYPE_TYPE_SPECIFIC (TYPE_FN_FIELD_TYPE (TYPE_FN_FIELDLIST1 (class, i), j)).arg_types[TYPE_NFIELDS (method)] = builtin_type_void;
/* Break out of both loops -- only one method to fix up in a class */
goto finish;
if (!((dn_bufp->darray.arrayisbytes && dn_bufp->darray.elemisbytes) ||
(!dn_bufp->darray.arrayisbytes && !dn_bufp->darray.elemisbytes)))
{
- warning ("error in hpread_array_type.\n");
+ warning (_("error in hpread_array_type."));
return NULL;
}
else if (dn_bufp->darray.arraylength == 0x7fffffff)
*/
TYPE_NFIELDS (type) = 1;
TYPE_FIELDS (type) = (struct field *)
- obstack_alloc (&objfile->type_obstack, sizeof (struct field));
+ obstack_alloc (&objfile->objfile_obstack, sizeof (struct field));
TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype,
objfile);
return type;
TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8;
TYPE_NFIELDS (type) = 2;
TYPE_FIELDS (type)
- = (struct field *) obstack_alloc (&objfile->type_obstack,
+ = (struct field *) obstack_alloc (&objfile->objfile_obstack,
2 * sizeof (struct field));
if (dn_bufp->dsubr.dyn_low)
dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile);
else
{
- complain (&hpread_type_lookup_complaint);
+ complaint (&symfile_complaints, _("error in hpread_type_lookup()."));
return NULL;
}
/* Build the correct name. */
TYPE_NAME (structtype)
- = (char *) obstack_alloc (&objfile->type_obstack,
+ = (char *) obstack_alloc (&objfile->objfile_obstack,
strlen (prefix) + strlen (suffix) + 1);
TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix);
TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix);
struct type *retvaltype;
int nargs;
int i;
- struct type **args_type;
class_type = hpread_type_lookup (dn_bufp->dptrmem.pointsto,
objfile);
functype = hpread_type_lookup (dn_bufp->dptrmem.memtype,
objfile);
retvaltype = TYPE_TARGET_TYPE (functype);
nargs = TYPE_NFIELDS (functype);
- args_type = (struct type **) xmalloc ((nargs + 1) * sizeof (struct type *));
- for (i = 0; i < nargs; i++)
- {
- args_type[i] = TYPE_FIELD_TYPE (functype, i);
- }
- args_type[nargs] = NULL;
ptrmemtype = alloc_type (objfile);
- smash_to_method_type (ptrmemtype, class_type, retvaltype, args_type);
+
+ smash_to_method_type (ptrmemtype, class_type, retvaltype,
+ TYPE_FIELDS (functype),
+ TYPE_NFIELDS (functype),
+ 0);
return make_pointer_type (ptrmemtype, NULL);
}
break;
* Called from hpread_process_one_debug_symbol()
* If "f" is not a member function, return NULL.
*/
-char *
+static char *
class_of (struct type *functype)
{
struct type *first_param_type;
char *class_scope_name;
/* Allocate one GDB debug symbol and fill in some default values. */
- sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+ sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
+ DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->objfile_obstack);
SYMBOL_LANGUAGE (sym) = language_auto;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_LINE (sym) = 0;
SYMBOL_VALUE (sym) = 0;
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
/* Stack must be empty now. */
if (context_stack_depth != 0)
- complain (&lbrac_unmatched_complaint, (char *) symnum);
+ lbrac_unmatched_complaint (symnum);
new = push_context (0, valu);
/* Built a type for the function. This includes processing
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_TYPE (sym) = hpread_read_function_type (hp_type, dn_bufp, objfile, 1);
- /* The "SYMBOL_NAME" field is expected to be the mangled name
+ /* All functions in C++ have prototypes. For C we don't have enough
+ information in the debug info. */
+ if (SYMBOL_LANGUAGE (sym) == language_cplus)
+ TYPE_FLAGS (SYMBOL_TYPE (sym)) |= TYPE_FLAG_PROTOTYPED;
+
+ /* The "DEPRECATED_SYMBOL_NAME" field is expected to be the mangled name
* (if any), which we get from the "alias" field of the SOM record
* if that exists.
*/
if ((dn_bufp->dfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
dn_bufp->dfunc.alias && /* has an alias */
*(char *) (VT (objfile) + dn_bufp->dfunc.alias)) /* not a null string */
- SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.alias;
+ DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.alias;
else
- SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
+ DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
/* Special hack to get around HP compilers' insistence on
* reporting "main" as "_MAIN_" for C/C++ */
- if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") == 0) &&
+ if ((strcmp (DEPRECATED_SYMBOL_NAME (sym), "_MAIN_") == 0) &&
(strcmp (VT (objfile) + dn_bufp->dfunc.name, "main") == 0))
- SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
+ DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->dfunc.name;
/* The SYMBOL_CPLUS_DEMANGLED_NAME field is expected to
* be the demangled name.
* some things broke, so I'm leaving it in here, and
* working around the issue in stack.c. - RT
*/
- SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
- if ((SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->dfunc.alias) &&
+ SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack);
+ if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->dfunc.alias) &&
(!SYMBOL_CPLUS_DEMANGLED_NAME (sym)))
{
CURRENT_FUNCTION_VALUE (objfile) = valu;
/* Stack must be empty now. */
if (context_stack_depth != 0)
- complain (&lbrac_unmatched_complaint, (char *) symnum);
+ lbrac_unmatched_complaint (symnum);
new = push_context (0, valu);
/* Built a type for the function. This includes processing
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_TYPE (sym) = hpread_read_doc_function_type (hp_type, dn_bufp, objfile, 1);
- /* The "SYMBOL_NAME" field is expected to be the mangled name
+ /* The "DEPRECATED_SYMBOL_NAME" field is expected to be the mangled name
* (if any), which we get from the "alias" field of the SOM record
* if that exists.
*/
if ((dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS) &&
dn_bufp->ddocfunc.alias && /* has an alias */
*(char *) (VT (objfile) + dn_bufp->ddocfunc.alias)) /* not a null string */
- SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.alias;
+ DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.alias;
else
- SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
+ DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
/* Special hack to get around HP compilers' insistence on
* reporting "main" as "_MAIN_" for C/C++ */
- if ((strcmp (SYMBOL_NAME (sym), "_MAIN_") == 0) &&
+ if ((strcmp (DEPRECATED_SYMBOL_NAME (sym), "_MAIN_") == 0) &&
(strcmp (VT (objfile) + dn_bufp->ddocfunc.name, "main") == 0))
- SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
+ DEPRECATED_SYMBOL_NAME (sym) = VT (objfile) + dn_bufp->ddocfunc.name;
if (dn_bufp->ddocfunc.language == HP_LANGUAGE_CPLUSPLUS)
{
* some things broke, so I'm leaving it in here, and
* working around the issue in stack.c. - RT
*/
- SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
+ SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack);
- if ((SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->ddocfunc.alias) &&
+ if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->ddocfunc.alias) &&
(!SYMBOL_CPLUS_DEMANGLED_NAME (sym)))
{
new = pop_context ();
desc = dn_bufp->dend.beginscope.dnttp.index;
if (desc != new->depth)
- complain (&lbrac_mismatch_complaint, (char *) symnum);
+ lbrac_mismatch_complaint (symnum);
/* Make a block for the local symbols within. */
finish_block (new->name, &local_symbols, new->old_blocks,
case DNTT_TYPE_COMMON:
/* End a FORTRAN common block. We don't currently handle these */
- complain (&hpread_unhandled_end_common_complaint);
+ complaint (&symfile_complaints,
+ _("unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n"));
break;
case DNTT_TYPE_CLASS_SCOPE:
new = pop_context ();
desc = dn_bufp->dend.beginscope.dnttp.index;
if (desc != new->depth)
- complain (&lbrac_mismatch_complaint, (char *) symnum);
+ lbrac_mismatch_complaint ((char *) symnum);
/* Make a block for the local symbols within. */
finish_block (new->name, &local_symbols, new->old_blocks,
new->start_addr, valu, objfile);
break;
default:
- complain (&hpread_unexpected_end_complaint);
+ complaint (&symfile_complaints,
+ _("internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind."));
break;
}
break;
/* DNTT_TYPE_IMPORT is not handled */
case DNTT_TYPE_LABEL:
- SYMBOL_NAMESPACE (sym) = LABEL_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = LABEL_DOMAIN;
break;
case DNTT_TYPE_FPARAM:
SYMBOL_CLASS (sym) = LOC_REF_ARG;
else
SYMBOL_CLASS (sym) = LOC_ARG;
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
if (dn_bufp->dfparam.copyparam)
{
SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
SYMBOL_VALUE (sym)
- += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+ += hpread_adjust_stack_address (CURRENT_FUNCTION_VALUE (objfile));
}
else
SYMBOL_VALUE (sym) = dn_bufp->dfparam.location;
* in the symbol table contains a pointer to the real "g".
* We use the storage class LOC_INDIRECT to indicate this. RT
*/
- if (is_in_import_list (SYMBOL_NAME (sym), objfile))
+ if (is_in_import_list (DEPRECATED_SYMBOL_NAME (sym), objfile))
SYMBOL_CLASS (sym) = LOC_INDIRECT;
SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location + data_offset;
{
/* Thread-local variable.
*/
- SYMBOL_CLASS (sym) = LOC_THREAD_LOCAL_STATIC;
- SYMBOL_BASEREG (sym) = CR27_REGNUM;
+ SYMBOL_CLASS (sym) = LOC_HP_THREAD_LOCAL_STATIC;
+ SYMBOL_BASEREG (sym) = HPPA_CR27_REGNUM;
if (objfile->flags & OBJF_SHARED)
{
* to "somsolib.c". But C lets us point to one.
*/
struct so_list *so;
+ struct hppa_objfile_private *priv;
- if (objfile->obj_private == NULL)
- error ("Internal error in reading shared library information.");
+ priv = (struct hppa_objfile_private *)
+ objfile_data (objfile, hppa_objfile_priv_data);
+ if (priv == NULL)
+ error (_("Internal error in reading shared library information."));
- so = ((obj_private_data_t *) (objfile->obj_private))->so_info;
+ so = ((struct hppa_objfile_private *) priv)->so_info;
if (so == NULL)
- error ("Internal error in reading shared library information.");
+ error (_("Internal error in reading shared library information."));
/* Thread-locals in shared libraries do NOT have the
* standard offset ("data_offset"), so we re-calculate
* to interpret the private shared-library data.
*/
SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location +
- so_lib_thread_start_addr (so);
+ gdbarch_tdep (current_gdbarch)->solib_thread_start_addr (so);
}
}
break;
SYMBOL_CLASS (sym) = LOC_LOCAL;
SYMBOL_VALUE (sym) = dn_bufp->ddvar.location;
-#ifdef HPREAD_ADJUST_STACK_ADDRESS
SYMBOL_VALUE (sym)
- += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile));
-#endif
+ += hpread_adjust_stack_address (CURRENT_FUNCTION_VALUE (objfile));
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile);
if (dn_bufp->ddvar.global)
add_symbol_to_list (sym, &global_symbols);
case DNTT_TYPE_TYPEDEF:
/* A typedef. We do want to process these, since a name is
- * added to the namespace for the typedef'ed name.
+ * added to the domain for the typedef'ed name.
*/
- SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
if (dn_bufp->dtype.global)
add_symbol_to_list (sym, &global_symbols);
int global = dn_bufp->dtag.global;
/* Structure, union, enum, template, or class tag definition */
/* We do want to process these, since a name is
- * added to the namespace for the tag name (and if C++ class,
+ * added to the domain for the tag name (and if C++ class,
* for the typename also).
*/
- SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
+ SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
/* The tag contains in its "type" field a pointer to the
* DNTT_TYPE_STRUCT, DNTT_TYPE_UNION, DNTT_TYPE_ENUM,
* record that actually defines the type.
*/
SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile);
- TYPE_NAME (sym->type) = SYMBOL_NAME (sym);
- TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym);
+ TYPE_NAME (sym->type) = DEPRECATED_SYMBOL_NAME (sym);
+ TYPE_TAG_NAME (sym->type) = DEPRECATED_SYMBOL_NAME (sym);
if (dn_bufp->dtag.global)
add_symbol_to_list (sym, &global_symbols);
else if (WITHIN_FUNCTION (objfile))
dn_bufp = hpread_get_lntt (dn_bufp->dtag.type.dnttp.index, objfile);
else
{
- complain (&hpread_tagdef_complaint);
+ complaint (&symfile_complaints, _("error processing class tagdef"));
return;
}
if (dn_bufp->dblock.kind == DNTT_TYPE_CLASS ||
{
struct symbol *newsym;
- newsym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+ newsym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symbol));
memset (newsym, 0, sizeof (struct symbol));
- SYMBOL_NAME (newsym) = name;
+ DEPRECATED_SYMBOL_NAME (newsym) = name;
SYMBOL_LANGUAGE (newsym) = language_auto;
- SYMBOL_NAMESPACE (newsym) = VAR_NAMESPACE;
+ SYMBOL_DOMAIN (newsym) = VAR_DOMAIN;
SYMBOL_LINE (newsym) = 0;
SYMBOL_VALUE (newsym) = 0;
SYMBOL_CLASS (newsym) = LOC_TYPEDEF;
case DNTT_TYPE_COMMON:
/* FORTRAN common. Not yet handled. */
- complain (&hpread_unhandled_common_complaint);
+ complaint (&symfile_complaints,
+ _("unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON."));
break;
/* DNTT_TYPE_COBSTRUCT is not handled by GDB. */
/* Not sure what this is - part of FORTRAN support maybe?
* Anyway, not yet handled.
*/
- complain (&hpread_unhandled_blockdata_complaint);
+ complaint (&symfile_complaints,
+ _("unhandled symbol in hp-symtab-read.c: DNTT_TYPE_BLOCKDATA."));
break;
case DNTT_TYPE_CLASS_SCOPE:
hpread_get_scope_depth (union dnttentry *dn_bufp, struct objfile *objfile,
int report_nested)
{
- register int index;
- register union dnttentry *dn_tmp;
- register short depth = 0;
+ int index;
+ union dnttentry *dn_tmp;
+ short depth = 0;
/****************************/
return 0;
/****************************/
static void
hpread_adjust_bitoffsets (struct type *type, int bits)
{
- register int i;
+ int i;
/* This is done only for unions; caller had better check that
it is an anonymous one. */
TYPE_FIELD_BITPOS (type, i) -= bits;
}
+/* Return the adjustment necessary to make for addresses on the stack
+ as presented by hpread.c.
+
+ This is necessary because of the stack direction on the PA and the
+ bizarre way in which someone (?) decided they wanted to handle
+ frame pointerless code in GDB. */
+int
+hpread_adjust_stack_address (CORE_ADDR func_addr)
+{
+ struct unwind_table_entry *u;
+
+ u = find_unwind_entry (func_addr);
+ if (!u)
+ return 0;
+ else
+ return u->Total_frame_size << 3;
+}
+
/* Because of quirks in HP compilers' treatment of anonymous unions inside
classes, we have to chase through a chain of threaded FIELD entries.
If we encounter an anonymous union in the chain, we must recursively skip over
struct objfile *objfile)
{
struct type *anon_type;
- register int i;
+ int i;
int bitoffset;
char *name;
/* Do we have another anonymous union? If so, adjust the bitoffsets
of its members and skip over its members. */
if ((TYPE_CODE (anon_type) == TYPE_CODE_UNION) &&
- (!name || STREQ (name, "")))
+ (!name || DEPRECATED_STREQ (name, "")))
{
hpread_adjust_bitoffsets (anon_type, bitoffset);
field = hpread_get_next_skip_over_anon_unions (TYPE_NFIELDS (anon_type), field, fieldp, objfile);