projects
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* coffread.c: Replace all occurrences of bfd_read with bfd_bread.
[binutils-gdb.git]
/
gdb
/
coffread.c
diff --git
a/gdb/coffread.c
b/gdb/coffread.c
index 010b36aea2ce455bf55a7d80801fbd761de783a0..7b93f3d4d88eba3074030470473cb0c489dc7c47 100644
(file)
--- a/
gdb/coffread.c
+++ b/
gdb/coffread.c
@@
-1,5
+1,6
@@
/* Read coff symbol tables and convert to internal format, for GDB.
/* Read coff symbol tables and convert to internal format, for GDB.
- Copyright 1987, 88, 89, 90, 91, 92, 93, 94, 96, 97, 1998
+ Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
Free Software Foundation, Inc.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
@@
-42,8
+43,9
@@
#include "stabsread.h"
#include "complaints.h"
#include "target.h"
#include "stabsread.h"
#include "complaints.h"
#include "target.h"
+#include "gdb_assert.h"
-extern void _initialize_coffread
PARAMS ((void)
);
+extern void _initialize_coffread
(void
);
struct coff_symfile_info
{
struct coff_symfile_info
{
@@
-68,14
+70,6
@@
struct coff_symfile_info
#define SDB_TYPE(type) (BTYPE(type) | (type & N_TMASK))
#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. */
/* Core address of start and end of text of current source file.
This comes from a ".text" symbol where x_nlinno > 0. */
@@
-176,76
+170,78
@@
struct coff_symbol
unsigned int c_type;
};
unsigned int c_type;
};
-extern void stabsread_clear_cache PARAMS ((void));
+extern void stabsread_clear_cache (void);
+
+static struct type *coff_read_struct_type (int, int, int);
-static struct type *coff_read_struct_type PARAMS ((int, int, int));
+static struct type *decode_base_type (struct coff_symbol *,
+ unsigned int, union internal_auxent *);
-static struct type *decode_base_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_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 *decode_function_type PARAMS ((struct coff_symbol *,
- unsigned int,
- union internal_auxent *));
+static struct type *coff_read_enum_type (int, int, int);
-static struct type *coff_read_enum_type PARAMS ((int, int, int));
+static struct symbol *process_coff_symbol (struct coff_symbol *,
+ union internal_auxent *,
+ struct objfile *);
-static struct symbol *process_coff_symbol PARAMS ((struct coff_symbol *,
- union internal_auxent *,
- struct objfile *));
+static void patch_opaque_types (struct symtab *);
-static void patch_
opaque_types PARAMS ((struct symtab *)
);
+static void patch_
type (struct type *, struct type *
);
-static void
patch_type PARAMS ((struct type *, struct type *)
);
+static void
enter_linenos (long, int, int, struct objfile *
);
-static void
enter_linenos PARAMS ((long, int, int, struct objfile *)
);
+static void
free_linetab (void
);
-static void free_linetab
PARAMS ((void)
);
+static void free_linetab
_cleanup (void *ignore
);
-static int init_lineno
PARAMS ((bfd *, long, int)
);
+static int init_lineno
(bfd *, long, int
);
-static char *getsymname
PARAMS ((struct internal_syment *)
);
+static char *getsymname
(struct internal_syment *
);
-static char *coff_getfilename
PARAMS ((union internal_auxent *)
);
+static char *coff_getfilename
(union internal_auxent *
);
-static void free_stringtab
PARAMS ((void)
);
+static void free_stringtab
(void
);
-static
int init_stringtab PARAMS ((bfd *, long)
);
+static
void free_stringtab_cleanup (void *ignore
);
-static void read_one_sym PARAMS ((struct coff_symbol *,
- struct internal_syment *,
- union internal_auxent *));
+static int init_stringtab (bfd *, long);
-static void coff_symtab_read PARAMS ((long, unsigned int, struct objfile *));
+static void read_one_sym (struct coff_symbol *,
+ struct internal_syment *, union internal_auxent *);
-static void
find_linenos PARAMS ((bfd *, sec_ptr, PTR)
);
+static void
coff_symtab_read (long, unsigned int, struct objfile *
);
-static void
coff_symfile_init PARAMS ((struct objfile *)
);
+static void
find_linenos (bfd *, sec_ptr, PTR
);
-static void coff_
new_init PARAMS ((struct objfile *)
);
+static void coff_
symfile_init (struct objfile *
);
-static void coff_
symfile_read PARAMS ((struct objfile *, int)
);
+static void coff_
new_init (struct objfile *
);
-static void coff_symfile_
finish PARAMS ((struct objfile *)
);
+static void coff_symfile_
read (struct objfile *, int
);
-static void record_minimal_symbol PARAMS ((char *, CORE_ADDR,
- enum minimal_symbol_type,
- struct objfile *));
+static void coff_symfile_finish (struct objfile *);
-static void coff_end_symtab PARAMS ((struct objfile *));
+static void record_minimal_symbol (char *, CORE_ADDR,
+ enum minimal_symbol_type,
+ struct objfile *);
-static void co
mplete_symtab PARAMS ((char *, CORE_ADDR, unsigned int)
);
+static void co
ff_end_symtab (struct objfile *
);
-static void co
ff_start_symtab PARAMS ((char *)
);
+static void co
mplete_symtab (char *, CORE_ADDR, unsigned int
);
-static
struct type *coff_alloc_type PARAMS ((int)
);
+static
void coff_start_symtab (char *
);
-static struct type *
*coff_lookup_type PARAMS ((int)
);
+static struct type *
coff_alloc_type (int
);
-static void coff_locate_sections PARAMS ((bfd *, asection *, PTR));
+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
\f
/* We are called once per section from coff_symfile_read. We
need to examine each section we are passed, check to see
@@
-258,10
+254,7
@@
static void coff_locate_sections PARAMS ((bfd *, asection *, PTR));
-kingdon). */
static void
-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;
{
register struct coff_symfile_info *csi;
const char *name;
@@
-305,13
+298,13
@@
coff_locate_sections (abfd, sectp, csip)
/* This will be run after coffstab_build_psymtabs is called
in coff_symfile_read, at which point we no longer need
the information. */
/* This will be run after coffstab_build_psymtabs is called
in coff_symfile_read, at which point we no longer need
the information. */
- make_cleanup (free, n);
+ make_cleanup (
x
free, n);
}
}
}
/* Return the section_offsets* that CS points to. */
}
}
}
/* 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
{
struct find_targ_sec_arg
{
@@
-319,13
+312,10
@@
struct find_targ_sec_arg
asection **resultp;
};
asection **resultp;
};
-static void find_targ_sec
PARAMS ((bfd *, asection *, void *)
);
+static void find_targ_sec
(bfd *, asection *, PTR
);
static 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)
{
struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
if (sect->target_index == args->targ_index)
@@
-334,9
+324,7
@@
find_targ_sec (abfd, sect, obj)
/* Return the section number (SECT_OFF_*) that CS points to. */
static int
/* 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;
{
asection *sect = NULL;
struct find_targ_sec_arg args;
@@
-353,19
+341,18
@@
cs_to_section (cs, objfile)
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
off = SECT_OFF_DATA (objfile);
else
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. */
}
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
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;
{
asection *sect = NULL;
struct find_targ_sec_arg args;
@@
-387,8
+374,7
@@
cs_section_address (cs, abfd)
or for associating a new type with the index. */
static struct type **
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)
{
{
if (index >= type_vector_length)
{
@@
-412,8
+398,7
@@
coff_lookup_type (index)
This can create an empty (zeroed) type object. */
static struct type *
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;
{
register struct type **type_addr = coff_lookup_type (index);
register struct type *type = *type_addr;
@@
-434,8
+419,7
@@
coff_alloc_type (index)
it indicates the start of data for one original source file. */
static void
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
{
start_symtab (
/* We fill in the filename later. start_symtab puts
@@
-457,13
+441,10
@@
coff_start_symtab (name)
text address for the file, and SIZE is the number of bytes of text. */
static void
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)
{
if (last_source_file != NULL)
- free (last_source_file);
+
x
free (last_source_file);
last_source_file = savestring (name, strlen (name));
current_source_start_addr = start_addr;
current_source_end_addr = start_addr + size;
last_source_file = savestring (name, strlen (name));
current_source_start_addr = start_addr;
current_source_end_addr = start_addr + size;
@@
-482,14
+463,13
@@
complete_symtab (name, start_addr, size)
struct symtab for that file and put it in the list of all such. */
static void
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;
{
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);
if (symtab != NULL)
free_named_symtabs (symtab->filename);
@@
-499,11
+479,8
@@
coff_end_symtab (objfile)
}
\f
static void
}
\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] == '@')
{
/* We don't want TDESC entry points in the minimal symbol table */
if (name[0] == '@')
@@
-526,8
+503,7
@@
record_minimal_symbol (name, address, type, objfile)
The ultimate result is a new symtab (or, FIXME, eventually a psymtab). */
static void
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 *)
{
/* Allocate struct to keep track of stab reading. */
objfile->sym_stab_info = (struct dbx_symfile_info *)
@@
-555,10
+531,7
@@
coff_symfile_init (objfile)
/* ARGSUSED */
static void
/* 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;
{
struct coff_symfile_info *info;
int size, count;
@@
-595,9
+568,7
@@
static bfd *symfile_bfd;
/* ARGSUSED */
static void
/* 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;
{
struct coff_symfile_info *info;
struct dbx_symfile_info *dbxinfo;
@@
-656,7
+627,7
@@
coff_symfile_read (objfile, mainline)
info->max_lineno_offset = 0;
bfd_map_over_sections (abfd, find_linenos, (PTR) info);
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)
val = init_lineno (abfd, info->min_lineno_offset,
info->max_lineno_offset - info->min_lineno_offset);
if (val < 0)
@@
-664,7
+635,7
@@
coff_symfile_read (objfile, mainline)
/* Now read the string table, all at once. */
/* 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);
val = init_stringtab (abfd, stringtab_offset);
if (val < 0)
error ("\"%s\": can't get string table", name);
@@
-718,13
+689,17
@@
coff_symfile_read (objfile, mainline)
info->stabsects,
info->stabstrsect->filepos, stabstrsize);
}
info->stabsects,
info->stabstrsect->filepos, stabstrsize);
}
+ if (dwarf2_has_info (abfd))
+ {
+ /* DWARF2 sections. */
+ dwarf2_build_psymtabs (objfile, mainline);
+ }
do_cleanups (back_to);
}
static void
do_cleanups (back_to);
}
static void
-coff_new_init (ignore)
- struct objfile *ignore;
+coff_new_init (struct objfile *ignore)
{
}
{
}
@@
-734,8
+709,7
@@
coff_new_init (ignore)
objfile struct from the global list of known objfiles. */
static void
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)
{
{
if (objfile->sym_private != NULL)
{
@@
-753,10
+727,8
@@
coff_symfile_finish (objfile)
We read them one at a time using read_one_sym (). */
static void
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;
{
register struct context_stack *new;
struct coff_symbol coff_symbol;
@@
-774,7
+746,7
@@
coff_symtab_read (symtab_offset, nsyms, objfile)
char *filestring = "";
int depth = 0;
int fcn_first_line = 0;
char *filestring = "";
int depth = 0;
int fcn_first_line = 0;
- CORE_ADDR fcn_first_line_addr;
+ CORE_ADDR fcn_first_line_addr
= 0
;
int fcn_last_line = 0;
int fcn_start_addr = 0;
long fcn_line_ptr = 0;
int fcn_last_line = 0;
int fcn_start_addr = 0;
long fcn_line_ptr = 0;
@@
-809,7
+781,7
@@
coff_symtab_read (symtab_offset, nsyms, objfile)
memset (opaque_type_chain, 0, sizeof opaque_type_chain);
if (type_vector) /* Get rid of previous one */
memset (opaque_type_chain, 0, sizeof opaque_type_chain);
if (type_vector) /* Get rid of previous one */
-
free ((PTR)
type_vector);
+
xfree (
type_vector);
type_vector_length = 160;
type_vector = (struct type **)
xmalloc (type_vector_length * sizeof (struct type *));
type_vector_length = 160;
type_vector = (struct type **)
xmalloc (type_vector_length * sizeof (struct type *));
@@
-980,31
+952,35
@@
coff_symtab_read (symtab_offset, nsyms, objfile)
SMASH_TEXT_ADDRESS (tmpaddr);
#endif
}
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;
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;
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 */ )
{
struct minimal_symbol *msym;
}
if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
{
struct minimal_symbol *msym;
+ /* FIXME: cagney/2001-02-01: The nasty (int) -> (long)
+ -> (void*) cast is to ensure that that the value of
+ cs->c_sclass can be correctly stored in a void
+ pointer in MSYMBOL_INFO. Better solutions
+ welcome. */
+ gdb_assert (sizeof (void *) >= sizeof (cs->c_sclass));
msym = prim_record_minimal_symbol_and_info
msym = prim_record_minimal_symbol_and_info
- (cs->c_name, tmpaddr, ms_type, (
char *) cs->c_sclass, sec
,
- NULL, objfile);
+ (cs->c_name, tmpaddr, ms_type, (
void *) (long) cs->c_sclass
,
+
sec,
NULL, objfile);
#ifdef COFF_MAKE_MSYMBOL_SPECIAL
if (msym)
COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
#ifdef COFF_MAKE_MSYMBOL_SPECIAL
if (msym)
COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
@@
-1045,6
+1021,8
@@
coff_symtab_read (symtab_offset, nsyms, objfile)
}
else if (STREQ (cs->c_name, ".ef"))
{
}
else if (STREQ (cs->c_name, ".ef"))
{
+ if (!within_function)
+ error ("Bad coff function information\n");
/* the value of .ef is the address of epilogue code;
not useful for gdb. */
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
/* the value of .ef is the address of epilogue code;
not useful for gdb. */
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
@@
-1169,26
+1147,25
@@
coff_symtab_read (symtab_offset, nsyms, objfile)
in internal_auxent form, and skip any other auxents. */
static void
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;
cs->c_symnum = symnum;
{
int i;
cs->c_symnum = symnum;
- bfd_
read (temp_sym, local_symesz, 1
, nlist_bfd_global);
+ bfd_
bread (temp_sym, local_symesz
, nlist_bfd_global);
bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym);
cs->c_naux = sym->n_numaux & 0xff;
if (cs->c_naux >= 1)
{
bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym);
cs->c_naux = sym->n_numaux & 0xff;
if (cs->c_naux >= 1)
{
- bfd_
read (temp_aux, local_auxesz, 1
, nlist_bfd_global);
+ bfd_
bread (temp_aux, local_auxesz
, nlist_bfd_global);
bfd_coff_swap_aux_in (symfile_bfd, temp_aux, sym->n_type, sym->n_sclass,
0, cs->c_naux, (char *) aux);
/* If more than one aux entry, read past it (only the first aux
is important). */
for (i = 1; i < cs->c_naux; i++)
bfd_coff_swap_aux_in (symfile_bfd, temp_aux, sym->n_type, sym->n_sclass,
0, cs->c_naux, (char *) aux);
/* If more than one aux entry, read past it (only the first aux
is important). */
for (i = 1; i < cs->c_naux; i++)
- bfd_
read (temp_aux, local_auxesz, 1
, nlist_bfd_global);
+ bfd_
bread (temp_aux, local_auxesz
, nlist_bfd_global);
}
cs->c_name = getsymname (sym);
cs->c_value = sym->n_value;
}
cs->c_name = getsymname (sym);
cs->c_value = sym->n_value;
@@
-1239,9
+1216,7
@@
read_one_sym (cs, sym, aux)
static char *stringtab = NULL;
static int
static char *stringtab = NULL;
static int
-init_stringtab (abfd, offset)
- bfd *abfd;
- long offset;
+init_stringtab (bfd *abfd, long offset)
{
long length;
int val;
{
long length;
int val;
@@
-1257,7
+1232,7
@@
init_stringtab (abfd, offset)
if (bfd_seek (abfd, offset, 0) < 0)
return -1;
if (bfd_seek (abfd, offset, 0) < 0)
return -1;
- val = bfd_
read ((char *) lengthbuf, sizeof lengthbuf, 1
, abfd);
+ val = bfd_
bread ((char *) lengthbuf, sizeof lengthbuf
, abfd);
length = bfd_h_get_32 (symfile_bfd, lengthbuf);
/* If no string table is needed, then the file may end immediately
length = bfd_h_get_32 (symfile_bfd, lengthbuf);
/* If no string table is needed, then the file may end immediately
@@
-1272,7
+1247,8
@@
init_stringtab (abfd, offset)
if (length == sizeof length) /* Empty table -- just the count */
return 0;
if (length == sizeof length) /* Empty table -- just the count */
return 0;
- val = bfd_read (stringtab + sizeof lengthbuf, length - sizeof lengthbuf, 1, abfd);
+ val = bfd_bread (stringtab + sizeof lengthbuf, length - sizeof lengthbuf,
+ abfd);
if (val != length - sizeof lengthbuf || stringtab[length - 1] != '\0')
return -1;
if (val != length - sizeof lengthbuf || stringtab[length - 1] != '\0')
return -1;
@@
-1280,16
+1256,21
@@
init_stringtab (abfd, offset)
}
static void
}
static void
-free_stringtab ()
+free_stringtab (
void
)
{
if (stringtab)
{
if (stringtab)
- free (stringtab);
+
x
free (stringtab);
stringtab = NULL;
}
stringtab = NULL;
}
+static void
+free_stringtab_cleanup (void *ignore)
+{
+ free_stringtab ();
+}
+
static char *
static char *
-getsymname (symbol_entry)
- struct internal_syment *symbol_entry;
+getsymname (struct internal_syment *symbol_entry)
{
static char buffer[SYMNMLEN + 1];
char *result;
{
static char buffer[SYMNMLEN + 1];
char *result;
@@
-1314,8
+1295,7
@@
getsymname (symbol_entry)
is only good for temporary use. */
static char *
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;
{
static char buffer[BUFSIZ];
register char *temp;
@@
-1349,10
+1329,7
@@
static unsigned long linetab_size;
them into GDB's data structures. */
static int
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;
{
int val;
@@
-1370,7
+1347,7
@@
init_lineno (abfd, offset, size)
/* Allocate the desired table, plus a sentinel */
linetab = (char *) xmalloc (size + local_linesz);
/* Allocate the desired table, plus a sentinel */
linetab = (char *) xmalloc (size + local_linesz);
- val = bfd_
read (linetab, size, 1
, abfd);
+ val = bfd_
bread (linetab, size
, abfd);
if (val != size)
return -1;
if (val != size)
return -1;
@@
-1381,23
+1358,26
@@
init_lineno (abfd, offset, size)
}
static void
}
static void
-free_linetab ()
+free_linetab (
void
)
{
if (linetab)
{
if (linetab)
- free (linetab);
+
x
free (linetab);
linetab = NULL;
}
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
#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;
{
register char *rawptr;
struct internal_lineno lptr;
@@
-1434,9
+1414,7
@@
enter_linenos (file_offset, first_line, last_line, objfile)
}
\f
static void
}
\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);
{
register struct type *target = TYPE_TARGET_TYPE (type);
register struct type *real_target = TYPE_TARGET_TYPE (real_type);
@@
-1451,7
+1429,7
@@
patch_type (type, real_type)
if (TYPE_NAME (real_target))
{
if (TYPE_NAME (target))
if (TYPE_NAME (real_target))
{
if (TYPE_NAME (target))
- free (TYPE_NAME (target));
+
x
free (TYPE_NAME (target));
TYPE_NAME (target) = concat (TYPE_NAME (real_target), NULL);
}
}
TYPE_NAME (target) = concat (TYPE_NAME (real_target), NULL);
}
}
@@
-1460,8
+1438,7
@@
patch_type (type, real_type)
so that they can be used to print out opaque data structures properly. */
static void
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;
{
register struct block *b;
register int i;
@@
-1522,10
+1499,9
@@
patch_opaque_types (s)
}
\f
static struct symbol *
}
\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,
{
register struct symbol *sym
= (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
@@
-1749,10
+1725,8
@@
process_coff_symbol (cs, aux, objfile)
/* Decode a coff type specifier; return the type that is meant. */
static struct type *
/* 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;
{
register struct type *type = 0;
unsigned int new_c_type;
@@
-1830,10
+1804,8
@@
decode_type (cs, c_type, aux)
return the type that the function returns. */
static struct 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 */
{
if (aux->x_sym.x_tagndx.l == 0)
cs->c_naux = 0; /* auxent refers to function, not base type */
@@
-1844,10
+1816,8
@@
decode_function_type (cs, c_type, aux)
/* basic C types */
static struct 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;
{
struct type *type;
@@
-1998,10
+1968,7
@@
decode_base_type (cs, c_type, aux)
object describing the type. */
static struct 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
{
{
struct nextfield
{
@@
-2096,10
+2063,7
@@
coff_read_struct_type (index, length, lastsym)
/* ARGSUSED */
static struct type *
/* 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;
{
register struct symbol *sym;
register struct type *type;
@@
-2216,7
+2180,7
@@
static struct sym_fns coff_sym_fns =
};
void
};
void
-_initialize_coffread ()
+_initialize_coffread (
void
)
{
add_symtab_fns (&coff_sym_fns);
}
{
add_symtab_fns (&coff_sym_fns);
}