🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #10062

sysV coff enum bug in gdb 1.35

#10062
From: Wolfgang Rupprecht
Date: Thu, 28 Jun 1990 21:16
73 lines
2695 bytes
On a gcc v1.36 compiled ansi file: gdb sometimes dumps core reading
the symbol table.  The root of the problem is in coffread.c, when 
an ".eb" is seen before the first ".bb" is seen.

The first clump (872,876c872,876) in the diff shores up a dereference 
of some uninitialized variables if an end-of-block symbol is seen 
before the begin-of-block.

The next clump is just paranoia.  It "should never happen."

The final 3 clumps for "done" are needed to handle a ".eos" symbol.

This is bug was that ".eos" "main" ".bb" were all being read as 
part of an enum definition.  

(if you *really* want the offending execuatable file I can send it.)

Question: Why does aux->x_sym.x_fcnary.x_fcn.x_endndx not point to the
correct end of the enum description?  In this case the x_endndx is 
several symbols past the ".eos" symbol.

-wolfgang

diff -c coffread.c.~1~ coffread.c
872,876c872,876
<   int depth;
<   int fcn_first_line;
<   int fcn_last_line;
<   int fcn_start_addr;
<   long fcn_line_ptr;
---
>   int depth = 0;
>   int fcn_first_line = 0;
>   int fcn_last_line = 0;
>   int fcn_start_addr = 0;
>   long fcn_line_ptr = 0;
1777c1777,1788
< 	return read_enum_type (cs->c_symnum,
---
> 	if (cs->c_nsyms != 2)
> 	  {
> 	    /* bogus enum type */
> 	    type = coff_alloc_type (cs->c_symnum);
> 	    TYPE_NAME (type) = concat ("enum ", "<opaque>", "");
> 	    TYPE_LENGTH (type) = 0;
> 	    TYPE_FIELDS (type) = 0;
> 	    TYPE_NFIELDS (type) = 0;
> 	  }
> 	else
> 	{
> 	    type = read_enum_type (cs->c_symnum,
1780c1791,1794
< 
---
> 	}
> 	TYPE_CODE (type) = TYPE_CODE_ENUM;
> 	return type;
> 	
1916a1931
>   int done = 0;
1931c1946
<   while (symnum < lastsym && symnum < nlist_nsyms_global)
---
>   while (!done && symnum < lastsym && symnum < nlist_nsyms_global)
1951a1967
> 	    done = 1;

diff exited abnormally with code 1 at Thu Jun 28 16:25:57

---
Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
TEL: (703) 768-2640	UUCP:  mit-eddie!mgm.mit.edu!wolfgang
Technical Details
Message-ID: <9006282116.AA15124@gp1.UUCP>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!nancy!gp1!wolfgang

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,9a0653de5b7882cc,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1990-06-28 21:58:53 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!nancy!gp1!wolfgang
From: nancy!gp1!wolfgang@UUNET.UU.NET (Wolfgang Rupprecht)
Newsgroups: gnu.gdb.bug
Subject: sysV coff enum bug in gdb 1.35
Message-ID: <9006282116.AA15124@gp1.UUCP>
Date: 28 Jun 90 21:16:33 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: Freelance Software Consultant, Washington D.C.
Lines: 73
Posted: Thu Jun 28 22:16:33 1990