#include "complaints.h"
#include "target.h"
-extern void _initialize_coffread PARAMS ((void));
+extern void _initialize_coffread (void);
struct coff_symfile_info
{
#define SDB_TYPE(type) (BTYPE(type) | (type & N_TMASK))
-/* Convert from an sdb register number to an internal gdb register number.
- This should be defined in tm.h, if REGISTER_NAMES is not set up
- to map one to one onto the sdb register numbers. */
-
-#ifndef SDB_REG_TO_REGNUM
-#define SDB_REG_TO_REGNUM(value) (value)
-#endif
-
/* Core address of start and end of text of current source file.
This comes from a ".text" symbol where x_nlinno > 0. */
unsigned int c_type;
};
-extern void stabsread_clear_cache PARAMS ((void));
+extern void stabsread_clear_cache (void);
-static struct type *coff_read_struct_type PARAMS ((int, int, int));
+static struct type *coff_read_struct_type (int, int, int);
-static struct type *decode_base_type PARAMS ((struct coff_symbol *,
- unsigned int,
- union internal_auxent *));
+static struct type *decode_base_type (struct coff_symbol *,
+ unsigned int, union internal_auxent *);
-static struct type *decode_type PARAMS ((struct coff_symbol *, unsigned int,
- union internal_auxent *));
+static struct type *decode_type (struct coff_symbol *, unsigned int,
+ union internal_auxent *);
-static struct type *decode_function_type PARAMS ((struct coff_symbol *,
- unsigned int,
- union internal_auxent *));
+static struct type *decode_function_type (struct coff_symbol *,
+ unsigned int,
+ union internal_auxent *);
-static struct type *coff_read_enum_type PARAMS ((int, int, int));
+static struct type *coff_read_enum_type (int, int, int);
-static struct symbol *process_coff_symbol PARAMS ((struct coff_symbol *,
- union internal_auxent *,
- struct objfile *));
+static struct symbol *process_coff_symbol (struct coff_symbol *,
+ union internal_auxent *,
+ struct objfile *);
-static void patch_opaque_types PARAMS ((struct symtab *));
+static void patch_opaque_types (struct symtab *);
-static void patch_type PARAMS ((struct type *, struct type *));
+static void patch_type (struct type *, struct type *);
-static void enter_linenos PARAMS ((long, int, int, struct objfile *));
+static void enter_linenos (long, int, int, struct objfile *);
-static void free_linetab PARAMS ((void));
+static void free_linetab (void);
-static int init_lineno PARAMS ((bfd *, long, int));
+static void free_linetab_cleanup (void *ignore);
-static char *getsymname PARAMS ((struct internal_syment *));
+static int init_lineno (bfd *, long, int);
-static char *coff_getfilename PARAMS ((union internal_auxent *));
+static char *getsymname (struct internal_syment *);
-static void free_stringtab PARAMS ((void));
+static char *coff_getfilename (union internal_auxent *);
-static int init_stringtab PARAMS ((bfd *, long));
+static void free_stringtab (void);
-static void read_one_sym PARAMS ((struct coff_symbol *,
- struct internal_syment *,
- union internal_auxent *));
+static void free_stringtab_cleanup (void *ignore);
-static void coff_symtab_read PARAMS ((long, unsigned int, struct objfile *));
+static int init_stringtab (bfd *, long);
-static void find_linenos PARAMS ((bfd *, sec_ptr, PTR));
+static void read_one_sym (struct coff_symbol *,
+ struct internal_syment *, union internal_auxent *);
-static void coff_symfile_init PARAMS ((struct objfile *));
+static void coff_symtab_read (long, unsigned int, struct objfile *);
-static void coff_new_init PARAMS ((struct objfile *));
+static void find_linenos (bfd *, sec_ptr, PTR);
-static void coff_symfile_read PARAMS ((struct objfile *, int));
+static void coff_symfile_init (struct objfile *);
-static void coff_symfile_finish PARAMS ((struct objfile *));
+static void coff_new_init (struct objfile *);
-static void record_minimal_symbol PARAMS ((char *, CORE_ADDR,
- enum minimal_symbol_type,
- struct objfile *));
+static void coff_symfile_read (struct objfile *, int);
-static void coff_end_symtab PARAMS ((struct objfile *));
+static void coff_symfile_finish (struct objfile *);
-static void complete_symtab PARAMS ((char *, CORE_ADDR, unsigned int));
+static void record_minimal_symbol (char *, CORE_ADDR,
+ enum minimal_symbol_type,
+ struct objfile *);
-static void coff_start_symtab PARAMS ((char *));
+static void coff_end_symtab (struct objfile *);
-static struct type *coff_alloc_type PARAMS ((int));
+static void complete_symtab (char *, CORE_ADDR, unsigned int);
-static struct type **coff_lookup_type PARAMS ((int));
+static void coff_start_symtab (char *);
-static void coff_locate_sections PARAMS ((bfd *, asection *, PTR));
+static struct type *coff_alloc_type (int);
+
+static struct type **coff_lookup_type (int);
+
+static void coff_locate_sections (bfd *, asection *, PTR);
\f
/* We are called once per section from coff_symfile_read. We
need to examine each section we are passed, check to see
-kingdon). */
static void
-coff_locate_sections (abfd, sectp, csip)
- bfd *abfd;
- asection *sectp;
- PTR csip;
+coff_locate_sections (bfd *abfd, asection *sectp, PTR csip)
{
register struct coff_symfile_info *csi;
const char *name;
}
/* Return the section_offsets* that CS points to. */
-static int cs_to_section PARAMS ((struct coff_symbol *, struct objfile *));
+static int cs_to_section (struct coff_symbol *, struct objfile *);
struct find_targ_sec_arg
{
asection **resultp;
};
-static void find_targ_sec PARAMS ((bfd *, asection *, void *));
+static void find_targ_sec (bfd *, asection *, void *);
static void
-find_targ_sec (abfd, sect, obj)
- bfd *abfd;
- asection *sect;
- PTR obj;
+find_targ_sec (bfd *abfd, asection *sect, PTR obj)
{
struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
if (sect->target_index == args->targ_index)
/* Return the section number (SECT_OFF_*) that CS points to. */
static int
-cs_to_section (cs, objfile)
- struct coff_symbol *cs;
- struct objfile *objfile;
+cs_to_section (struct coff_symbol *cs, struct objfile *objfile)
{
asection *sect = NULL;
struct find_targ_sec_arg args;
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
off = SECT_OFF_DATA (objfile);
else
- off = SECT_OFF_BSS (objfile);
+ /* Just return the bfd section index. */
+ off = sect->index;
}
return off;
}
/* Return the address of the section of a COFF symbol. */
-static CORE_ADDR cs_section_address PARAMS ((struct coff_symbol *, bfd *));
+static CORE_ADDR cs_section_address (struct coff_symbol *, bfd *);
static CORE_ADDR
-cs_section_address (cs, abfd)
- struct coff_symbol *cs;
- bfd *abfd;
+cs_section_address (struct coff_symbol *cs, bfd *abfd)
{
asection *sect = NULL;
struct find_targ_sec_arg args;
or for associating a new type with the index. */
static struct type **
-coff_lookup_type (index)
- register int index;
+coff_lookup_type (register int index)
{
if (index >= type_vector_length)
{
This can create an empty (zeroed) type object. */
static struct type *
-coff_alloc_type (index)
- int index;
+coff_alloc_type (int index)
{
register struct type **type_addr = coff_lookup_type (index);
register struct type *type = *type_addr;
it indicates the start of data for one original source file. */
static void
-coff_start_symtab (name)
- char *name;
+coff_start_symtab (char *name)
{
start_symtab (
/* We fill in the filename later. start_symtab puts
text address for the file, and SIZE is the number of bytes of text. */
static void
-complete_symtab (name, start_addr, size)
- char *name;
- CORE_ADDR start_addr;
- unsigned int size;
+complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size)
{
if (last_source_file != NULL)
free (last_source_file);
struct symtab for that file and put it in the list of all such. */
static void
-coff_end_symtab (objfile)
- struct objfile *objfile;
+coff_end_symtab (struct objfile *objfile)
{
struct symtab *symtab;
last_source_start_addr = current_source_start_addr;
- symtab = end_symtab (current_source_end_addr, objfile, 0);
+ symtab = end_symtab (current_source_end_addr, objfile, SECT_OFF_TEXT (objfile));
if (symtab != NULL)
free_named_symtabs (symtab->filename);
}
\f
static void
-record_minimal_symbol (name, address, type, objfile)
- char *name;
- CORE_ADDR address;
- enum minimal_symbol_type type;
- struct objfile *objfile;
+record_minimal_symbol (char *name, CORE_ADDR address,
+ enum minimal_symbol_type type, struct objfile *objfile)
{
/* We don't want TDESC entry points in the minimal symbol table */
if (name[0] == '@')
The ultimate result is a new symtab (or, FIXME, eventually a psymtab). */
static void
-coff_symfile_init (objfile)
- struct objfile *objfile;
+coff_symfile_init (struct objfile *objfile)
{
/* Allocate struct to keep track of stab reading. */
objfile->sym_stab_info = (struct dbx_symfile_info *)
/* ARGSUSED */
static void
-find_linenos (abfd, asect, vpinfo)
- bfd *abfd;
- sec_ptr asect;
- PTR vpinfo;
+find_linenos (bfd *abfd, sec_ptr asect, PTR vpinfo)
{
struct coff_symfile_info *info;
int size, count;
/* ARGSUSED */
static void
-coff_symfile_read (objfile, mainline)
- struct objfile *objfile;
- int mainline;
+coff_symfile_read (struct objfile *objfile, int mainline)
{
struct coff_symfile_info *info;
struct dbx_symfile_info *dbxinfo;
info->max_lineno_offset = 0;
bfd_map_over_sections (abfd, find_linenos, (PTR) info);
- make_cleanup ((make_cleanup_func) free_linetab, 0);
+ make_cleanup (free_linetab_cleanup, 0 /*ignore*/);
val = init_lineno (abfd, info->min_lineno_offset,
info->max_lineno_offset - info->min_lineno_offset);
if (val < 0)
/* Now read the string table, all at once. */
- make_cleanup ((make_cleanup_func) free_stringtab, 0);
+ make_cleanup (free_stringtab_cleanup, 0 /*ignore*/);
val = init_stringtab (abfd, stringtab_offset);
if (val < 0)
error ("\"%s\": can't get string table", name);
}
static void
-coff_new_init (ignore)
- struct objfile *ignore;
+coff_new_init (struct objfile *ignore)
{
}
objfile struct from the global list of known objfiles. */
static void
-coff_symfile_finish (objfile)
- struct objfile *objfile;
+coff_symfile_finish (struct objfile *objfile)
{
if (objfile->sym_private != NULL)
{
We read them one at a time using read_one_sym (). */
static void
-coff_symtab_read (symtab_offset, nsyms, objfile)
- long symtab_offset;
- unsigned int nsyms;
- struct objfile *objfile;
+coff_symtab_read (long symtab_offset, unsigned int nsyms,
+ struct objfile *objfile)
{
register struct context_stack *new;
struct coff_symbol coff_symbol;
SMASH_TEXT_ADDRESS (tmpaddr);
#endif
}
- else
- if (sec == SECT_OFF_DATA (objfile))
- {
+ else if (sec == SECT_OFF_DATA (objfile))
+ {
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
- }
- else
- if (sec == SECT_OFF_BSS (objfile))
- {
+ }
+ else if (sec == SECT_OFF_BSS (objfile))
+ {
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
- }
- else
- ms_type = mst_unknown;
+ }
+ else
+ ms_type = mst_unknown;
}
if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
in internal_auxent form, and skip any other auxents. */
static void
-read_one_sym (cs, sym, aux)
- register struct coff_symbol *cs;
- register struct internal_syment *sym;
- register union internal_auxent *aux;
+read_one_sym (register struct coff_symbol *cs,
+ register struct internal_syment *sym,
+ register union internal_auxent *aux)
{
int i;
static char *stringtab = NULL;
static int
-init_stringtab (abfd, offset)
- bfd *abfd;
- long offset;
+init_stringtab (bfd *abfd, long offset)
{
long length;
int val;
}
static void
-free_stringtab ()
+free_stringtab (void)
{
if (stringtab)
free (stringtab);
stringtab = NULL;
}
+static void
+free_stringtab_cleanup (void *ignore)
+{
+ free_stringtab ();
+}
+
static char *
-getsymname (symbol_entry)
- struct internal_syment *symbol_entry;
+getsymname (struct internal_syment *symbol_entry)
{
static char buffer[SYMNMLEN + 1];
char *result;
is only good for temporary use. */
static char *
-coff_getfilename (aux_entry)
- union internal_auxent *aux_entry;
+coff_getfilename (union internal_auxent *aux_entry)
{
static char buffer[BUFSIZ];
register char *temp;
them into GDB's data structures. */
static int
-init_lineno (abfd, offset, size)
- bfd *abfd;
- long offset;
- int size;
+init_lineno (bfd *abfd, long offset, int size)
{
int val;
}
static void
-free_linetab ()
+free_linetab (void)
{
if (linetab)
free (linetab);
linetab = NULL;
}
+static void
+free_linetab_cleanup (void *ignore)
+{
+ free_linetab ();
+}
+
#if !defined (L_LNNO32)
#define L_LNNO32(lp) ((lp)->l_lnno)
#endif
static void
-enter_linenos (file_offset, first_line, last_line, objfile)
- long file_offset;
- register int first_line;
- register int last_line;
- struct objfile *objfile;
+enter_linenos (long file_offset, register int first_line,
+ register int last_line, struct objfile *objfile)
{
register char *rawptr;
struct internal_lineno lptr;
}
\f
static void
-patch_type (type, real_type)
- struct type *type;
- struct type *real_type;
+patch_type (struct type *type, struct type *real_type)
{
register struct type *target = TYPE_TARGET_TYPE (type);
register struct type *real_target = TYPE_TARGET_TYPE (real_type);
so that they can be used to print out opaque data structures properly. */
static void
-patch_opaque_types (s)
- struct symtab *s;
+patch_opaque_types (struct symtab *s)
{
register struct block *b;
register int i;
}
\f
static struct symbol *
-process_coff_symbol (cs, aux, objfile)
- register struct coff_symbol *cs;
- register union internal_auxent *aux;
- struct objfile *objfile;
+process_coff_symbol (register struct coff_symbol *cs,
+ register union internal_auxent *aux,
+ struct objfile *objfile)
{
register struct symbol *sym
= (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
/* Decode a coff type specifier; return the type that is meant. */
static struct type *
-decode_type (cs, c_type, aux)
- register struct coff_symbol *cs;
- unsigned int c_type;
- register union internal_auxent *aux;
+decode_type (register struct coff_symbol *cs, unsigned int c_type,
+ register union internal_auxent *aux)
{
register struct type *type = 0;
unsigned int new_c_type;
return the type that the function returns. */
static struct type *
-decode_function_type (cs, c_type, aux)
- register struct coff_symbol *cs;
- unsigned int c_type;
- register union internal_auxent *aux;
+decode_function_type (register struct coff_symbol *cs, unsigned int c_type,
+ register union internal_auxent *aux)
{
if (aux->x_sym.x_tagndx.l == 0)
cs->c_naux = 0; /* auxent refers to function, not base type */
/* basic C types */
static struct type *
-decode_base_type (cs, c_type, aux)
- register struct coff_symbol *cs;
- unsigned int c_type;
- register union internal_auxent *aux;
+decode_base_type (register struct coff_symbol *cs, unsigned int c_type,
+ register union internal_auxent *aux)
{
struct type *type;
object describing the type. */
static struct type *
-coff_read_struct_type (index, length, lastsym)
- int index;
- int length;
- int lastsym;
+coff_read_struct_type (int index, int length, int lastsym)
{
struct nextfield
{
/* ARGSUSED */
static struct type *
-coff_read_enum_type (index, length, lastsym)
- int index;
- int length;
- int lastsym;
+coff_read_enum_type (int index, int length, int lastsym)
{
register struct symbol *sym;
register struct type *type;
};
void
-_initialize_coffread ()
+_initialize_coffread (void)
{
add_symtab_fns (&coff_sym_fns);
}