* dbxread.c: Don't swap symbols in place, since internal and

external forms may have different sizes.  Don't assume that an
	internal_nlist has the same layout as an external_nlist.  Create
	symbol for n_strx element so to hide specifics of nlist from
	partial-stab.h.
	* partial-stab.h:  Don't reference dbxread symbols directly.  Use
	CUR_SYMBOL_STRX instead.
	* config/i386/xm-windows.h:  Define SIGQUIT and SIGTRAP.

	* config/v850/tm-v850.h:  Define PS_REGNUM and TARGET_V850 for
	MSVC builds.
	* mswin/gdbwin.c (reg_order):  Define register order for V850.
	* mswin/gui.cpp (CGuiApp::InitInstance):  Define target name for
	V850.
	* mswin/regdoc.h:  Define MAXREGS for V850.
This commit is contained in:
Stu Grossman
1996-10-24 17:31:45 +00:00
parent b9dfd325cd
commit 139e2c0f92
5 changed files with 69 additions and 24 deletions

View File

@ -1,3 +1,22 @@
Thu Oct 24 10:06:58 1996 Stu Grossman (grossman@critters.cygnus.com)
* dbxread.c: Don't swap symbols in place, since internal and
external forms may have different sizes. Don't assume that an
internal_nlist has the same layout as an external_nlist. Create
symbol for n_strx element so to hide specifics of nlist from
partial-stab.h.
* partial-stab.h: Don't reference dbxread symbols directly. Use
CUR_SYMBOL_STRX instead.
* config/i386/xm-windows.h: Define SIGQUIT and SIGTRAP.
start-sanitize-v850
* config/v850/tm-v850.h: Define PS_REGNUM and TARGET_V850 for
MSVC builds.
* mswin/gdbwin.c (reg_order): Define register order for V850.
* mswin/gui.cpp (CGuiApp::InitInstance): Define target name for
V850.
* mswin/regdoc.h: Define MAXREGS for V850.
end-sanitize-v850
start-sanitize-v850 start-sanitize-v850
Tue Oct 22 16:28:20 1996 Stu Grossman (grossman@critters.cygnus.com) Tue Oct 22 16:28:20 1996 Stu Grossman (grossman@critters.cygnus.com)

View File

@ -32,3 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define NO_MMCHECK #define NO_MMCHECK
#include <malloc.h> #include <malloc.h>
#define SIGQUIT 3
#define SIGTRAP 5

View File

@ -46,6 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define V1_REGNUM 11 #define V1_REGNUM 11
#define FP_REGNUM 29 #define FP_REGNUM 29
#define RP_REGNUM 31 #define RP_REGNUM 31
#define PS_REGNUM 37
#define PC_REGNUM 64 #define PC_REGNUM 64
#define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int #define REGISTER_VIRTUAL_TYPE(REG) builtin_type_int
@ -141,3 +142,7 @@ extern int v850_pc_in_call_dummy PARAMS ((CORE_ADDR pc));
#define USE_STRUCT_CONVENTION(GCC_P, TYPE) \ #define USE_STRUCT_CONVENTION(GCC_P, TYPE) \
(TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4) (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4)
/* Define this for Wingdb */
#define TARGET_V850

View File

@ -737,7 +737,7 @@ dbx_symfile_finish (objfile)
/* Buffer for reading the symbol table entries. */ /* Buffer for reading the symbol table entries. */
static struct internal_nlist symbuf[4096]; static struct external_nlist symbuf[4096];
static int symbuf_idx; static int symbuf_idx;
static int symbuf_end; static int symbuf_end;
@ -876,6 +876,14 @@ fill_symbuf (sym_bfd)
(unsigned char *)&(symp)->n_value); \ (unsigned char *)&(symp)->n_value); \
} }
#define INTERNALIZE_SYMBOL(intern, extern, abfd) \
{ \
(intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type); \
(intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx); \
(intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc); \
(intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value); \
}
/* Invariant: The symbol pointed to by symbuf_idx is the first one /* Invariant: The symbol pointed to by symbuf_idx is the first one
that hasn't been swapped. Swap the symbol at the same time that hasn't been swapped. Swap the symbol at the same time
that symbuf_idx is incremented. */ that symbuf_idx is incremented. */
@ -889,13 +897,18 @@ static char *
dbx_next_symbol_text (objfile) dbx_next_symbol_text (objfile)
struct objfile *objfile; struct objfile *objfile;
{ {
struct internal_nlist nlist;
if (symbuf_idx == symbuf_end) if (symbuf_idx == symbuf_end)
fill_symbuf (symfile_bfd); fill_symbuf (symfile_bfd);
symnum++; symnum++;
SWAP_SYMBOL(&symbuf[symbuf_idx], symfile_bfd); INTERNALIZE_SYMBOL(nlist, &symbuf[symbuf_idx], symfile_bfd);
OBJSTAT (objfile, n_stabs++); OBJSTAT (objfile, n_stabs++);
return symbuf[symbuf_idx++].n_strx + stringtab_global
+ file_string_table_offset; symbuf_idx++;
return nlist.n_strx + stringtab_global + file_string_table_offset;
} }
/* Initialize the list of bincls to contain none and have some /* Initialize the list of bincls to contain none and have some
@ -1121,7 +1134,9 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
CORE_ADDR text_addr; CORE_ADDR text_addr;
int text_size; int text_size;
{ {
register struct internal_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch */ register struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch */
struct internal_nlist nlist;
register char *namestring; register char *namestring;
int nsl; int nsl;
int past_first_source_file = 0; int past_first_source_file = 0;
@ -1188,9 +1203,10 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
/* /*
* Special case to speed up readin. * Special case to speed up readin.
*/ */
if (bufp->n_type == (unsigned char)N_SLINE) continue; if (bfd_h_get_8 (abfd, bufp->e_type) == N_SLINE)
continue;
SWAP_SYMBOL (bufp, abfd); INTERNALIZE_SYMBOL (nlist, bufp, abfd);
OBJSTAT (objfile, n_stabs++); OBJSTAT (objfile, n_stabs++);
/* Ok. There is a lot of code duplicated in the rest of this /* Ok. There is a lot of code duplicated in the rest of this
@ -1205,22 +1221,23 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
I've imbedded it in the following macro. I've imbedded it in the following macro.
*/ */
/* Set namestring based on bufp. If the string table index is invalid, /* Set namestring based on nlist. If the string table index is invalid,
give a fake name, and print a single error message per symbol file read, give a fake name, and print a single error message per symbol file read,
rather than abort the symbol reading or flood the user with messages. */ rather than abort the symbol reading or flood the user with messages. */
/*FIXME: Too many adds and indirections in here for the inner loop. */ /*FIXME: Too many adds and indirections in here for the inner loop. */
#define SET_NAMESTRING()\ #define SET_NAMESTRING()\
if (((unsigned)bufp->n_strx + file_string_table_offset) >= \ if (((unsigned)CUR_SYMBOL_STRX + file_string_table_offset) >= \
DBX_STRINGTAB_SIZE (objfile)) { \ DBX_STRINGTAB_SIZE (objfile)) { \
complain (&string_table_offset_complaint, symnum); \ complain (&string_table_offset_complaint, symnum); \
namestring = "<bad string table offset>"; \ namestring = "<bad string table offset>"; \
} else \ } else \
namestring = bufp->n_strx + file_string_table_offset + \ namestring = CUR_SYMBOL_STRX + file_string_table_offset + \
DBX_STRINGTAB (objfile) DBX_STRINGTAB (objfile)
#define CUR_SYMBOL_TYPE bufp->n_type #define CUR_SYMBOL_TYPE nlist.n_type
#define CUR_SYMBOL_VALUE bufp->n_value #define CUR_SYMBOL_VALUE nlist.n_value
#define CUR_SYMBOL_STRX nlist.n_strx
#define DBXREAD_ONLY #define DBXREAD_ONLY
#define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\ #define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
start_psymtab(ofile, secoff, fname, low, symoff, global_syms, static_syms) start_psymtab(ofile, secoff, fname, low, symoff, global_syms, static_syms)
@ -1234,11 +1251,11 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
if (DBX_SYMCOUNT (objfile) > 0 /* We have some syms */ if (DBX_SYMCOUNT (objfile) > 0 /* We have some syms */
/*FIXME, does this have a bug at start address 0? */ /*FIXME, does this have a bug at start address 0? */
&& last_o_file_start && last_o_file_start
&& objfile -> ei.entry_point < bufp->n_value && objfile -> ei.entry_point < nlist.n_value
&& objfile -> ei.entry_point >= last_o_file_start) && objfile -> ei.entry_point >= last_o_file_start)
{ {
objfile -> ei.entry_file_lowpc = last_o_file_start; objfile -> ei.entry_file_lowpc = last_o_file_start;
objfile -> ei.entry_file_highpc = bufp->n_value; objfile -> ei.entry_file_highpc = nlist.n_value;
} }
if (pst) if (pst)
@ -1587,7 +1604,8 @@ read_ofile_symtab (pst)
struct partial_symtab *pst; struct partial_symtab *pst;
{ {
register char *namestring; register char *namestring;
register struct internal_nlist *bufp; register struct external_nlist *bufp;
struct internal_nlist nlist;
unsigned char type; unsigned char type;
unsigned max_symnum; unsigned max_symnum;
register bfd *abfd; register bfd *abfd;
@ -1626,13 +1644,13 @@ read_ofile_symtab (pst)
bfd_seek (symfile_bfd, sym_offset - symbol_size, SEEK_CUR); bfd_seek (symfile_bfd, sym_offset - symbol_size, SEEK_CUR);
fill_symbuf (abfd); fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx++]; bufp = &symbuf[symbuf_idx++];
SWAP_SYMBOL (bufp, abfd); INTERNALIZE_SYMBOL (nlist, bufp, abfd);
OBJSTAT (objfile, n_stabs++); OBJSTAT (objfile, n_stabs++);
SET_NAMESTRING (); SET_NAMESTRING ();
processing_gcc_compilation = 0; processing_gcc_compilation = 0;
if (bufp->n_type == N_TEXT) if (nlist.n_type == N_TEXT)
{ {
const char *tempstring = namestring; const char *tempstring = namestring;
@ -1669,7 +1687,7 @@ read_ofile_symtab (pst)
if (symbuf_idx == symbuf_end) if (symbuf_idx == symbuf_end)
fill_symbuf (abfd); fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx]; bufp = &symbuf[symbuf_idx];
if (bufp->n_type != (unsigned char)N_SO) if (bfd_h_get_8 (abfd, bufp->e_type) != N_SO)
error("First symbol in segment of executable not a source symbol"); error("First symbol in segment of executable not a source symbol");
max_symnum = sym_size / symbol_size; max_symnum = sym_size / symbol_size;
@ -1682,15 +1700,15 @@ read_ofile_symtab (pst)
if (symbuf_idx == symbuf_end) if (symbuf_idx == symbuf_end)
fill_symbuf(abfd); fill_symbuf(abfd);
bufp = &symbuf[symbuf_idx++]; bufp = &symbuf[symbuf_idx++];
SWAP_SYMBOL (bufp, abfd); INTERNALIZE_SYMBOL (nlist, bufp, abfd);
OBJSTAT (objfile, n_stabs++); OBJSTAT (objfile, n_stabs++);
type = bufp->n_type; type = bfd_h_get_8 (abfd, bufp->e_type);
SET_NAMESTRING (); SET_NAMESTRING ();
if (type & N_STAB) { if (type & N_STAB) {
process_one_symbol (type, bufp->n_desc, bufp->n_value, process_one_symbol (type, nlist.n_desc, nlist.n_value,
namestring, section_offsets, objfile); namestring, section_offsets, objfile);
} }
/* We skip checking for a new .o or -l file; that should never /* We skip checking for a new .o or -l file; that should never
@ -1823,7 +1841,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
case N_FUN: case N_FUN:
case N_FNAME: case N_FNAME:
if (! strcmp (name, "")) if (*name == '\000')
{ {
/* This N_FUN marks the end of a function. This closes off the /* This N_FUN marks the end of a function. This closes off the
current block. */ current block. */

View File

@ -145,7 +145,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
case N_UNDF: case N_UNDF:
#ifdef DBXREAD_ONLY #ifdef DBXREAD_ONLY
if (processing_acc_compilation && bufp->n_strx == 1) { if (processing_acc_compilation && CUR_SYMBOL_STRX == 1) {
/* Deal with relative offsets in the string table /* Deal with relative offsets in the string table
used in ELF+STAB under Solaris. If we want to use the used in ELF+STAB under Solaris. If we want to use the
n_strx field, which contains the name of the file, n_strx field, which contains the name of the file,
@ -154,7 +154,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
past_first_source_file = 1; past_first_source_file = 1;
file_string_table_offset = next_file_string_table_offset; file_string_table_offset = next_file_string_table_offset;
next_file_string_table_offset = next_file_string_table_offset =
file_string_table_offset + bufp->n_value; file_string_table_offset + CUR_SYMBOL_VALUE;
if (next_file_string_table_offset < file_string_table_offset) if (next_file_string_table_offset < file_string_table_offset)
error ("string table offset backs up at %d", symnum); error ("string table offset backs up at %d", symnum);
/* FIXME -- replace error() with complaint. */ /* FIXME -- replace error() with complaint. */