/* 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
Free Software Foundation, Inc.
Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
#include "stabsread.h"
#include "complaints.h"
#include "target.h"
+#include "gdb_assert.h"
extern void _initialize_coffread (void);
#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. */
/* 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 (xfree, n);
}
}
}
asection **resultp;
};
-static void find_targ_sec (bfd *, asection *, void *);
+static void find_targ_sec (bfd *, asection *, PTR);
static void
find_targ_sec (bfd *abfd, asection *sect, PTR obj)
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;
}
complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size)
{
if (last_source_file != NULL)
- free (last_source_file);
+ xfree (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_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);
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;
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 *));
{
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
- (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);
}
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
free_stringtab (void)
{
if (stringtab)
- free (stringtab);
+ xfree (stringtab);
stringtab = NULL;
}
free_linetab (void)
{
if (linetab)
- free (linetab);
+ xfree (linetab);
linetab = NULL;
}
if (TYPE_NAME (real_target))
{
if (TYPE_NAME (target))
- free (TYPE_NAME (target));
+ xfree (TYPE_NAME (target));
TYPE_NAME (target) = concat (TYPE_NAME (real_target), NULL);
}
}