#include "complaints.h"
#include "target.h"
-extern void _initialize_coffread PARAMS ((void));
+extern void _initialize_coffread (void);
struct coff_symfile_info
{
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, 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
}
/* 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)
{
asection *sect = NULL;
struct find_targ_sec_arg args;
- int off = SECT_OFF_TEXT;
+ int off = SECT_OFF_TEXT (objfile);
args.targ_index = cs->c_secnum;
args.resultp = §
{
/* This is the section. Figure out what SECT_OFF_* code it is. */
if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
- off = SECT_OFF_TEXT;
+ off = SECT_OFF_TEXT (objfile);
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
- off = SECT_OFF_DATA;
+ off = SECT_OFF_DATA (objfile);
else
- off = SECT_OFF_BSS;
+ off = SECT_OFF_BSS (objfile);
}
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)
coff_data_type *cdata = coff_data (abfd);
char *name = bfd_get_filename (abfd);
register int val;
- int num_symbols;
+ unsigned int num_symbols;
int symtab_offset;
int stringtab_offset;
struct cleanup *back_to;
temp_sym = (char *) xmalloc
(cdata->local_symesz + cdata->local_auxesz);
temp_aux = temp_sym + cdata->local_symesz;
- back_to = make_cleanup ((make_cleanup_func) free_current_contents, &temp_sym);
+ back_to = make_cleanup (free_current_contents, &temp_sym);
/* We need to know whether this is a PE file, because in PE files,
unlike standard COFF files, symbol values are stored as offsets
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);
init_minimal_symbol_collection ();
- make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
+ make_cleanup_discard_minimal_symbols ();
/* Now that the executable file is positioned at symbol table,
process it and define symbols accordingly. */
static void
coff_symtab_read (symtab_offset, nsyms, objfile)
long symtab_offset;
- int nsyms;
+ unsigned int nsyms;
struct objfile *objfile;
{
register struct context_stack *new;
if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
{
/* Record all functions -- external and static -- in minsyms. */
- tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
record_minimal_symbol (cs->c_name, tmpaddr, mst_text, objfile);
fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
followed by a later file with no symbols. */
if (in_source_file)
complete_symtab (filestring,
- cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+ cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
main_aux.x_scn.x_scnlen);
in_source_file = 0;
}
|| cs->c_sclass == C_THUMBEXT)
tmpaddr += ANOFFSET (objfile->section_offsets, sec);
- switch (sec)
+ if (sec == SECT_OFF_TEXT (objfile))
{
- case SECT_OFF_TEXT:
- case SECT_OFF_RODATA:
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
|| cs->c_sclass == C_THUMBEXT ?
if (tmpaddr & 1) /* FIXME: delete this line */
SMASH_TEXT_ADDRESS (tmpaddr);
#endif
- break;
- case SECT_OFF_DATA:
+ }
+ else if (sec == SECT_OFF_DATA (objfile))
+ {
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
- break;
- case SECT_OFF_BSS:
+ }
+ else if (sec == SECT_OFF_BSS (objfile))
+ {
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
- break;
- default:
- ms_type = mst_unknown;
- break;
}
+ else
+ ms_type = mst_unknown;
}
if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
of the epilogue. */
cs->c_value
+ FUNCTION_EPILOGUE_SIZE
- + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
#else
fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize
- + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
#endif
objfile
);
if (STREQ (cs->c_name, ".bb"))
{
tmpaddr = cs->c_value;
- tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
push_context (++depth, tmpaddr);
}
else if (STREQ (cs->c_name, ".eb"))
if (local_symbols && context_stack_depth > 0)
{
tmpaddr =
- cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
/* Make a block for the local symbols within. */
finish_block (0, &local_symbols, new->old_blocks,
new->start_addr, tmpaddr, objfile);
stringtab = NULL;
}
+static void
+free_stringtab_cleanup (void *ignore)
+{
+ free_stringtab ();
+}
+
static char *
getsymname (symbol_entry)
struct internal_syment *symbol_entry;
linetab = NULL;
}
+static void
+free_linetab_cleanup (void *ignore)
+{
+ free_linetab ();
+}
+
#if !defined (L_LNNO32)
#define L_LNNO32(lp) ((lp)->l_lnno)
#endif
if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
record_line (current_subfile, first_line + L_LNNO32 (&lptr),
lptr.l_addr.l_paddr
- + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT));
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)));
else
break;
}
if (ISFCN (cs->c_type))
{
- SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
SYMBOL_TYPE (sym) =
lookup_function_type (decode_function_type (cs, cs->c_type, aux));
case C_EXT:
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
- SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
add_symbol_to_list (sym, &global_symbols);
break;
case C_STAT:
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
- SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
if (within_function)
{
/* Static symbol of local scope */