/* Read hp debug symbols and convert to internal format, for GDB.
- Copyright 1993, 1996 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GDB.
extern struct complaint lbrac_mismatch_complaint;
\f
-void hpread_symfile_init PARAMS ((struct objfile *));
+void hpread_symfile_init (struct objfile *);
-static struct type *
- hpread_read_array_type PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+static struct type *hpread_read_array_type (dnttpointer, union dnttentry *,
+ struct objfile *);
-static struct type *hpread_alloc_type
- PARAMS ((dnttpointer, struct objfile *));
+static struct type *hpread_alloc_type (dnttpointer, struct objfile *);
-static struct type **hpread_lookup_type
- PARAMS ((dnttpointer, struct objfile *));
+static struct type **hpread_lookup_type (dnttpointer, struct objfile *);
static struct type *hpread_read_enum_type
- PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+ (dnttpointer, union dnttentry *, struct objfile *);
static struct type *hpread_read_set_type
- PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+ (dnttpointer, union dnttentry *, struct objfile *);
static struct type *hpread_read_subrange_type
- PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+ (dnttpointer, union dnttentry *, struct objfile *);
static struct type *hpread_read_struct_type
- PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+ (dnttpointer, union dnttentry *, struct objfile *);
-void hpread_build_psymtabs
- PARAMS ((struct objfile *, int));
+void hpread_build_psymtabs (struct objfile *, int);
-void hpread_symfile_finish PARAMS ((struct objfile *));
+void hpread_symfile_finish (struct objfile *);
static struct partial_symtab *hpread_start_psymtab
- PARAMS ((struct objfile *, char *, CORE_ADDR, int,
- struct partial_symbol **, struct partial_symbol **));
+ (struct objfile *, char *, CORE_ADDR, int,
+ struct partial_symbol **, struct partial_symbol **);
static struct partial_symtab *hpread_end_psymtab
- PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
- struct partial_symtab **, int));
+ (struct partial_symtab *, char **, int, int, CORE_ADDR,
+ struct partial_symtab **, int);
static struct symtab *hpread_expand_symtab
- PARAMS ((struct objfile *, int, int, CORE_ADDR, int,
- struct section_offsets *, char *));
+ (struct objfile *, int, int, CORE_ADDR, int,
+ struct section_offsets *, char *);
static void hpread_process_one_debug_symbol
- PARAMS ((union dnttentry *, char *, struct section_offsets *,
- struct objfile *, CORE_ADDR, int, char *, int));
+ (union dnttentry *, char *, struct section_offsets *,
+ struct objfile *, CORE_ADDR, int, char *, int);
static sltpointer hpread_record_lines
- PARAMS ((struct subfile *, sltpointer, sltpointer,
- struct objfile *, CORE_ADDR));
+ (struct subfile *, sltpointer, sltpointer, struct objfile *, CORE_ADDR);
static struct type *hpread_read_function_type
- PARAMS ((dnttpointer, union dnttentry *, struct objfile *));
+ (dnttpointer, union dnttentry *, struct objfile *);
-static struct type *hpread_type_lookup
- PARAMS ((dnttpointer, struct objfile *));
+static struct type *hpread_type_lookup (dnttpointer, struct objfile *);
-static unsigned long hpread_get_depth
- PARAMS ((sltpointer, struct objfile *));
+static unsigned long hpread_get_depth (sltpointer, struct objfile *);
-static unsigned long hpread_get_line
- PARAMS ((sltpointer, struct objfile *));
+static unsigned long hpread_get_line (sltpointer, struct objfile *);
-static CORE_ADDR hpread_get_location
- PARAMS ((sltpointer, struct objfile *));
+static CORE_ADDR hpread_get_location (sltpointer, struct objfile *);
-static int hpread_type_translate PARAMS ((dnttpointer));
-static unsigned long hpread_get_textlow PARAMS ((int, int, struct objfile *));
-static union dnttentry *hpread_get_gntt PARAMS ((int, struct objfile *));
-static union dnttentry *hpread_get_lntt PARAMS ((int, struct objfile *));
-static union sltentry *hpread_get_slt PARAMS ((int, struct objfile *));
-static void hpread_psymtab_to_symtab PARAMS ((struct partial_symtab *));
-static void hpread_psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
-static int hpread_has_name PARAMS ((enum dntt_entry_type));
+static int hpread_type_translate (dnttpointer);
+static unsigned long hpread_get_textlow (int, int, struct objfile *);
+static union dnttentry *hpread_get_gntt (int, struct objfile *);
+static union dnttentry *hpread_get_lntt (int, struct objfile *);
+static union sltentry *hpread_get_slt (int, struct objfile *);
+static void hpread_psymtab_to_symtab (struct partial_symtab *);
+static void hpread_psymtab_to_symtab_1 (struct partial_symtab *);
+static int hpread_has_name (enum dntt_entry_type);
\f
/* Initialization for reading native HP C debug symbols from OBJFILE.
FIXME, there should be a cleaner peephole into the BFD environment here. */
void
-hpread_symfile_init (objfile)
- struct objfile *objfile;
+hpread_symfile_init (struct objfile *objfile)
{
asection *vt_section, *slt_section, *lntt_section, *gntt_section;
table (as opposed to a shared lib or dynamically loaded file). */
void
-hpread_build_psymtabs (objfile, mainline)
- struct objfile *objfile;
- int mainline;
+hpread_build_psymtabs (struct objfile *objfile, int mainline)
{
char *namestring;
int past_first_source_file = 0;
objfile struct from the global list of known objfiles. */
void
-hpread_symfile_finish (objfile)
- struct objfile *objfile;
+hpread_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
{
/* Various small functions to get entries in the debug symbol sections. */
static union dnttentry *
-hpread_get_lntt (index, objfile)
- int index;
- struct objfile *objfile;
+hpread_get_lntt (int index, struct objfile *objfile)
{
return (union dnttentry *)
&(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
}
static union dnttentry *
-hpread_get_gntt (index, objfile)
- int index;
- struct objfile *objfile;
+hpread_get_gntt (int index, struct objfile *objfile)
{
return (union dnttentry *)
&(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]);
}
static union sltentry *
-hpread_get_slt (index, objfile)
- int index;
- struct objfile *objfile;
+hpread_get_slt (int index, struct objfile *objfile)
{
return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]);
}
/* Get the low address associated with some symbol (typically the start
of a particular source file or module). Since that information is not
- stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we must infer it from
- the existance of DNTT_TYPE_FUNCTION symbols. */
+ stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we
+ must infer it from the existence of DNTT_TYPE_FUNCTION symbols. */
static unsigned long
-hpread_get_textlow (global, index, objfile)
- int global;
- int index;
- struct objfile *objfile;
+hpread_get_textlow (int global, int index, struct objfile *objfile)
{
union dnttentry *dn_bufp;
struct minimal_symbol *msymbol;
/* Get the nesting depth for the source line identified by INDEX. */
static unsigned long
-hpread_get_depth (index, objfile)
- sltpointer index;
- struct objfile *objfile;
+hpread_get_depth (sltpointer index, struct objfile *objfile)
{
union sltentry *sl_bufp;
/* Get the source line number the the line identified by INDEX. */
static unsigned long
-hpread_get_line (index, objfile)
- sltpointer index;
- struct objfile *objfile;
+hpread_get_line (sltpointer index, struct objfile *objfile)
{
union sltentry *sl_bufp;
}
static CORE_ADDR
-hpread_get_location (index, objfile)
- sltpointer index;
- struct objfile *objfile;
+hpread_get_location (sltpointer index, struct objfile *objfile)
{
union sltentry *sl_bufp;
int i;
it, else return 0. */
static int
-hpread_has_name (kind)
- enum dntt_entry_type kind;
+hpread_has_name (enum dntt_entry_type kind)
{
switch (kind)
{
(normal). */
static struct partial_symtab *
-hpread_start_psymtab (objfile, filename, textlow, ldsymoff, global_syms,
- static_syms)
- struct objfile *objfile;
- char *filename;
- CORE_ADDR textlow;
- int ldsymoff;
- struct partial_symbol **global_syms;
- struct partial_symbol **static_syms;
+hpread_start_psymtab (struct objfile *objfile, char *filename,
+ CORE_ADDR textlow, int ldsymoff,
+ struct partial_symbol **global_syms,
+ struct partial_symbol **static_syms)
{
struct partial_symtab *result =
start_psymtab_common (objfile, section_offsets,
FIXME: List variables and peculiarities of same. */
static struct partial_symtab *
-hpread_end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
- capping_text, dependency_list, number_dependencies)
- struct partial_symtab *pst;
- char **include_list;
- int num_includes;
- int capping_symbol_offset;
- CORE_ADDR capping_text;
- struct partial_symtab **dependency_list;
- int number_dependencies;
+hpread_end_psymtab (struct partial_symtab *pst, char **include_list,
+ int num_includes, int capping_symbol_offset,
+ CORE_ADDR capping_text,
+ struct partial_symtab **dependency_list,
+ int number_dependencies)
{
int i;
struct objfile *objfile = pst->objfile;
table. */
static void
-hpread_psymtab_to_symtab_1 (pst)
- struct partial_symtab *pst;
+hpread_psymtab_to_symtab_1 (struct partial_symtab *pst)
{
struct cleanup *old_chain;
int i;
Be verbose about it if the user wants that. */
static void
-hpread_psymtab_to_symtab (pst)
- struct partial_symtab *pst;
+hpread_psymtab_to_symtab (struct partial_symtab *pst)
{
/* Get out quick if given junk. */
if (!pst)
SECTION_OFFSETS are the relocation offsets which get added to each symbol. */
static struct symtab *
-hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
- section_offsets, filename)
- struct objfile *objfile;
- int sym_offset;
- int sym_size;
- CORE_ADDR text_offset;
- int text_size;
- struct section_offsets *section_offsets;
- char *filename;
+hpread_expand_symtab (struct objfile *objfile, int sym_offset, int sym_size,
+ CORE_ADDR text_offset, int text_size,
+ struct section_offsets *section_offsets, char *filename)
{
char *namestring;
union dnttentry *dn_bufp;
current_objfile = NULL;
- return end_symtab (text_offset + text_size, objfile, 0);
+ return end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
}
\f
/* Convert basic types from HP debug format into GDB internal format. */
static int
-hpread_type_translate (typep)
- dnttpointer typep;
+hpread_type_translate (dnttpointer typep)
{
if (!typep.dntti.immediate)
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
switch (typep.dntti.type)
{
case HP_TYPE_FTN_STRING_VAX_COMPAT:
return FT_STRING;
default:
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
}
}
/* Return the type associated with the index found in HP_TYPE. */
static struct type **
-hpread_lookup_type (hp_type, objfile)
- dnttpointer hp_type;
- struct objfile *objfile;
+hpread_lookup_type (dnttpointer hp_type, struct objfile *objfile)
{
unsigned old_len;
int index = hp_type.dnttp.index;
have it lying around. */
static struct type *
-hpread_alloc_type (hp_type, objfile)
- dnttpointer hp_type;
- struct objfile *objfile;
+hpread_alloc_type (dnttpointer hp_type, struct objfile *objfile)
{
struct type **type_addr;
/* Read a native enumerated type and return it in GDB internal form. */
static struct type *
-hpread_read_enum_type (hp_type, dn_bufp, objfile)
- dnttpointer hp_type;
- union dnttentry *dn_bufp;
- struct objfile *objfile;
+hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+ struct objfile *objfile)
{
struct type *type;
struct pending **symlist, *osyms, *syms;
/* Read and internalize a native function debug symbol. */
static struct type *
-hpread_read_function_type (hp_type, dn_bufp, objfile)
- dnttpointer hp_type;
- union dnttentry *dn_bufp;
- struct objfile *objfile;
+hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+ struct objfile *objfile)
{
struct type *type, *type1;
struct pending **symlist, *osyms, *syms;
/* Read in and internalize a structure definition. */
static struct type *
-hpread_read_struct_type (hp_type, dn_bufp, objfile)
- dnttpointer hp_type;
- union dnttentry *dn_bufp;
- struct objfile *objfile;
+hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+ struct objfile *objfile)
{
struct nextfield
{
/* Read in and internalize a set debug symbol. */
static struct type *
-hpread_read_set_type (hp_type, dn_bufp, objfile)
- dnttpointer hp_type;
- union dnttentry *dn_bufp;
- struct objfile *objfile;
+hpread_read_set_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+ struct objfile *objfile)
{
struct type *type;
/* Read in and internalize an array debug symbol. */
static struct type *
-hpread_read_array_type (hp_type, dn_bufp, objfile)
- dnttpointer hp_type;
- union dnttentry *dn_bufp;
- struct objfile *objfile;
+hpread_read_array_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+ struct objfile *objfile)
{
struct type *type;
union dnttentry save;
/* values are not normalized. */
if (!((dn_bufp->darray.arrayisbytes && dn_bufp->darray.elemisbytes)
|| (!dn_bufp->darray.arrayisbytes && !dn_bufp->darray.elemisbytes)))
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
else if (dn_bufp->darray.arraylength == 0x7fffffff)
{
/* The HP debug format represents char foo[]; as an array with
/* Read in and internalize a subrange debug symbol. */
static struct type *
-hpread_read_subrange_type (hp_type, dn_bufp, objfile)
- dnttpointer hp_type;
- union dnttentry *dn_bufp;
- struct objfile *objfile;
+hpread_read_subrange_type (dnttpointer hp_type, union dnttentry *dn_bufp,
+ struct objfile *objfile)
{
struct type *type;
}
static struct type *
-hpread_type_lookup (hp_type, objfile)
- dnttpointer hp_type;
- struct objfile *objfile;
+hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
{
union dnttentry *dn_bufp;
if (dn_bufp->dtype.type.dnttp.index < LNTT_SYMCOUNT (objfile))
dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile);
else
- abort ();
+ internal_error (__FILE__, __LINE__, "failed internal consistency check");
if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT)
prefix = "struct ";
}
static sltpointer
-hpread_record_lines (subfile, s_idx, e_idx, objfile, offset)
- struct subfile *subfile;
- sltpointer s_idx, e_idx;
- struct objfile *objfile;
- CORE_ADDR offset;
+hpread_record_lines (struct subfile *subfile, sltpointer s_idx,
+ sltpointer e_idx, struct objfile *objfile,
+ CORE_ADDR offset)
{
union sltentry *sl_bufp;
/* Internalize one native debug symbol. */
static void
-hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
- text_offset, text_size, filename, index)
- union dnttentry *dn_bufp;
- char *name;
- struct section_offsets *section_offsets;
- struct objfile *objfile;
- CORE_ADDR text_offset;
- int text_size;
- char *filename;
- int index;
+hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name,
+ struct section_offsets *section_offsets,
+ struct objfile *objfile, CORE_ADDR text_offset,
+ int text_size, char *filename, int index)
{
unsigned long desc;
int type;
case DNTT_TYPE_MODULE:
/* Ending a module ends the symbol table for that module. */
valu = text_offset + text_size + offset;
- (void) end_symtab (valu, objfile, 0);
+ (void) end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
break;
case DNTT_TYPE_FUNCTION: