Article View: gnu.gdb.bug
Article #10155COFF symbol reading problem
From: John R. Levine
Date: Tue, 27 Mar 1990 19:54
Date: Tue, 27 Mar 1990 19:54
63 lines
3005 bytes
3005 bytes
I'm running gdb 3.5 under 386/ix 2.0.2, compiling everything with gcc 3.7
and using the vendor's assembler and linker, not COFF encapsulation.
In an object file, the introductory symbol entry for an enum, which usually
has a name like .2fake, includes an auxiliary entry with the symbol index one
past the end of the .eos entry at the end of the member list. There seems to
be a bug in the 386/ix linker that messes up this index now and then. GDB
believes the index and gets out of sync reading the symbol table, causing
various error reports, usually .bb/.eb mismatch. Since every enum group ends
with a .eos, this patch adds defensivee code to make it stop reading enum
members when it sees the .eos even if the index hasn't been reached.
I note that the routine that reads structure entries, which are arranged the
same way, already has similar defensive code, so I presume that someone ran
into the same bug before in structure symbols.
The bug, by the way, is definitely in the vendor's linker, not the assembler.
I stared at some huge hex object file dumps to be sure. I know that in a
perfect world I'd use gas and gld, maybe later.
*** gdb-3.5/coffread.c Tue Mar 20 17:11:23 1990
--- gdb-watch/coffread.c Tue Mar 27 14:10:56 1990
***************
*** 1907,1912 ****
--- 1907,1913 ----
register struct symbol *sym;
register struct type *type;
int nsyms = 0;
+ int done = 0;
struct pending **symlist;
struct coff_symbol member_sym;
register struct coff_symbol *ms = &member_sym;
***************
*** 1928,1934 ****
symlist = &file_symbols;
osyms = *symlist;
! while (symnum < lastsym && symnum < nlist_nsyms_global)
{
read_one_sym (ms, &sub_sym, &sub_aux);
name = ms->c_name;
--- 1929,1935 ----
symlist = &file_symbols;
osyms = *symlist;
! while (!done && symnum < lastsym && symnum < nlist_nsyms_global)
{
read_one_sym (ms, &sub_sym, &sub_aux);
name = ms->c_name;
***************
*** 1949,1954 ****
--- 1950,1956 ----
break;
case C_EOS:
+ done = 1; /* in case the count was wrong */
break;
}
}
--
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."
Technical Details
Message-ID:
<1990Mar27.195402.5339@esegue.segue.boston.ma.us>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!spdcc!esegue!johnlShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5053,f5315168aca7ec9 X-Google-Attributes: gidf5053,public X-Google-ArrivalTime: 1990-03-28 09:57:11 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!snorkelwacker!spdcc!esegue!johnl From: johnl@esegue.segue.boston.ma.us (John R. Levine) Newsgroups: gnu.gdb.bug Subject: COFF symbol reading problem Message-ID: <1990Mar27.195402.5339@esegue.segue.boston.ma.us> Date: 27 Mar 90 19:54:02 GMT Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine) Distribution: gnu Organization: Segue Software, Cambridge MA Lines: 63 Posted: Tue Mar 27 20:54:02 1990