From: Stu Grossman Date: Thu, 24 Oct 1996 17:31:45 +0000 (+0000) Subject: * dbxread.c: Don't swap symbols in place, since internal and X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=139e2c0f92e06fcca01a815614c46a53e93a2f55;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a1df1812aa8..07974d7d239 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 Tue Oct 22 16:28:20 1996 Stu Grossman (grossman@critters.cygnus.com) diff --git a/gdb/config/i386/xm-windows.h b/gdb/config/i386/xm-windows.h index 523a2fab853..08f9c7f619d 100644 --- a/gdb/config/i386/xm-windows.h +++ b/gdb/config/i386/xm-windows.h @@ -32,3 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NO_MMCHECK #include + +#define SIGQUIT 3 +#define SIGTRAP 5 diff --git a/gdb/config/v850/tm-v850.h b/gdb/config/v850/tm-v850.h index 6820ba58874..eec09119946 100644 --- a/gdb/config/v850/tm-v850.h +++ b/gdb/config/v850/tm-v850.h @@ -46,6 +46,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define V1_REGNUM 11 #define FP_REGNUM 29 #define RP_REGNUM 31 +#define PS_REGNUM 37 #define PC_REGNUM 64 #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) \ (TYPE_NFIELDS (TYPE) > 1 || TYPE_LENGTH (TYPE) > 4) + +/* Define this for Wingdb */ + +#define TARGET_V850 diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 38c8b4eefc9..ecd638e80c1 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -737,7 +737,7 @@ dbx_symfile_finish (objfile) /* 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_end; @@ -876,6 +876,14 @@ fill_symbuf (sym_bfd) (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 that hasn't been swapped. Swap the symbol at the same time that symbuf_idx is incremented. */ @@ -889,13 +897,18 @@ static char * dbx_next_symbol_text (objfile) struct objfile *objfile; { + struct internal_nlist nlist; + if (symbuf_idx == symbuf_end) fill_symbuf (symfile_bfd); + symnum++; - SWAP_SYMBOL(&symbuf[symbuf_idx], symfile_bfd); + INTERNALIZE_SYMBOL(nlist, &symbuf[symbuf_idx], symfile_bfd); 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 @@ -1121,7 +1134,9 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size) CORE_ADDR text_addr; 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; int nsl; 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. */ - 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++); /* 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. */ -/* 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, rather than abort the symbol reading or flood the user with messages. */ /*FIXME: Too many adds and indirections in here for the inner loop. */ #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)) { \ complain (&string_table_offset_complaint, symnum); \ namestring = ""; \ } else \ - namestring = bufp->n_strx + file_string_table_offset + \ + namestring = CUR_SYMBOL_STRX + file_string_table_offset + \ DBX_STRINGTAB (objfile) -#define CUR_SYMBOL_TYPE bufp->n_type -#define CUR_SYMBOL_VALUE bufp->n_value +#define CUR_SYMBOL_TYPE nlist.n_type +#define CUR_SYMBOL_VALUE nlist.n_value +#define CUR_SYMBOL_STRX nlist.n_strx #define DBXREAD_ONLY #define 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 */ /*FIXME, does this have a bug at start address 0? */ && 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_file_lowpc = last_o_file_start; - objfile -> ei.entry_file_highpc = bufp->n_value; + objfile -> ei.entry_file_highpc = nlist.n_value; } if (pst) @@ -1587,7 +1604,8 @@ read_ofile_symtab (pst) struct partial_symtab *pst; { register char *namestring; - register struct internal_nlist *bufp; + register struct external_nlist *bufp; + struct internal_nlist nlist; unsigned char type; unsigned max_symnum; register bfd *abfd; @@ -1626,13 +1644,13 @@ read_ofile_symtab (pst) bfd_seek (symfile_bfd, sym_offset - symbol_size, SEEK_CUR); fill_symbuf (abfd); bufp = &symbuf[symbuf_idx++]; - SWAP_SYMBOL (bufp, abfd); + INTERNALIZE_SYMBOL (nlist, bufp, abfd); OBJSTAT (objfile, n_stabs++); SET_NAMESTRING (); processing_gcc_compilation = 0; - if (bufp->n_type == N_TEXT) + if (nlist.n_type == N_TEXT) { const char *tempstring = namestring; @@ -1669,7 +1687,7 @@ read_ofile_symtab (pst) if (symbuf_idx == symbuf_end) fill_symbuf (abfd); 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"); max_symnum = sym_size / symbol_size; @@ -1682,15 +1700,15 @@ read_ofile_symtab (pst) if (symbuf_idx == symbuf_end) fill_symbuf(abfd); bufp = &symbuf[symbuf_idx++]; - SWAP_SYMBOL (bufp, abfd); + INTERNALIZE_SYMBOL (nlist, bufp, abfd); OBJSTAT (objfile, n_stabs++); - type = bufp->n_type; + type = bfd_h_get_8 (abfd, bufp->e_type); SET_NAMESTRING (); 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); } /* 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_FNAME: - if (! strcmp (name, "")) + if (*name == '\000') { /* This N_FUN marks the end of a function. This closes off the current block. */ diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 551ee7149ea..24ff492167a 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -145,7 +145,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ case N_UNDF: #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 used in ELF+STAB under Solaris. If we want to use the 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; 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) error ("string table offset backs up at %d", symnum); /* FIXME -- replace error() with complaint. */