/* Read hp debug symbols and convert to internal format, for GDB.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GDB.
#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 deprecated_complaint string_table_offset_complaint;
-extern struct deprecated_complaint lbrac_unmatched_complaint;
-extern struct deprecated_complaint lbrac_mismatch_complaint;
-\f
-static struct deprecated_complaint hpread_unhandled_end_common_complaint =
-{
- "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n", 0, 0
-};
-
-static struct deprecated_complaint hpread_unhandled_type_complaint =
-{
- "hpread_type_translate: unhandled type code.", 0, 0
-};
-
-static struct deprecated_complaint hpread_struct_complaint =
-{
- "hpread_read_struct_type: expected SVAR type...", 0, 0
-};
-
-static struct deprecated_complaint hpread_array_complaint =
-{
- "error in hpread_array_type.", 0, 0
-};
-
-static struct deprecated_complaint hpread_type_lookup_complaint =
-{
- "error in hpread_type_lookup().", 0, 0
-};
-
-
-static struct deprecated_complaint hpread_unexpected_end_complaint =
-{
- "internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind.", 0, 0
-};
-
-static struct deprecated_complaint hpread_tagdef_complaint =
-{
- "error processing class tagdef", 0, 0
-};
-
-static struct deprecated_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 deprecated_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 */
+static void set_namestring (union dnttentry *sym, char **namep,
+ struct objfile *objfile);
+
void hpread_symfile_init (struct objfile *);
void do_pxdb (bfd *);
static CORE_ADDR hpread_get_location (sltpointer, struct objfile *);
+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 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
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
/* 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. */
}
/* 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,
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,
else
storage = LOC_UNDEF;
- SET_NAMESTRING (dn_bufp, &namestring, objfile);
+ set_namestring (dn_bufp, &namestring, objfile);
if (!pst)
{
pst = hpread_start_psymtab (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->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,
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;
}
/* 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);
+ /* 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 "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.
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
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;
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 ||
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: