🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #8779

Re: Type Declaration/Printing Bug

#8779
From: Michael Joosten
Date: Tue, 08 Dec 1992 01:57
103 lines
5561 bytes
I was just going to install gdb-4.7 and went through my gnu.gdb.bugs folder,
and behold! there are quite a lot of bugs reported for gdb-4.6 but
(apparently) not yet fixed in gdb-4.7. Not only a few ones or the ones "this
works for me, dunno if it breaks other configurations..", but even quite solid
fixes. This one is an excellent example. Now, may I ask if the poor GDB
maintainer is plainly overloaded or are there sound reasons behind this
"conservative" fix politic? (No, I'm not upset, so don't misunderstand me !
This is *not* a flame!!!) 8-)

Anywhere, here is the patch from Aug, 5th:
>>From farrell@fjord.reo.dec.com Sat Aug  8 20:57:26 1992
>>Newsgroups: gnu.gdb.bug

>>>>> On Sun, 2 Aug 1992 10:26:01 GMT, svkakkad@cs.utexas.edu (Sheetal V. Kakkad
) said:

Sheetal> Bugs: =====

Sheetal> 1. Printing (void *) pointer in a struct if the pointer is the first
Sheetal> element in the struct 

Sheetal> (gdb) print *z
Sheetal> $1 = {x = {x = {x = {x = {x = {x = {x = {x = {x = {x = {x = {x = {x =

Sheetal> ...... [continues scrolling] .......^C


I've been seeing this problem for a long time, but hadn't identified the
situation in which it happens. With the information Sheetal supplied, I've
located the bug.

The problem is that the MIPS symbol table code tries to tell the difference
between an enum and a structure (which look the same in regular -g debug
information) by looking at the type of the first member/tag. If it is
undefined or void, the code assumes it is dealing with an enum. 

The member type information consists of a base type and 0 or more type
qualifiers - for example "void *" is represented as a base type of btVoid with
the tqPtr qualifier. The struct/enum heuristic code only looks at the base
type, so it thinks the first member has type "void" and assumes it is looking
at an enum.

The following patch fixes the problem:

-- start cut --

*** 4.6p1-mipsread.c    Mon Aug  3 15:09:16 1992
--- mipsread.c  Mon Aug  3 15:25:22 1992
***************
*** 1105,1112 ****
                  {
                    if (tsym->st == stMember) {
                        if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
!                           /* If the type of the member is Nil (or Void),
!                              assume the tag is an enumeration. */
                            if (tsym->index == indexNil)
                                type_code = TYPE_CODE_ENUM;
                            else {
--- 1105,1113 ----
                  {
                    if (tsym->st == stMember) {
                        if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
!                           /* If the base type of the member is Nil (or
!                                Void) and has no qualifiers (pointer, volatile,
!                                etc.), assume the tag is an enumeration. */
                            if (tsym->index == indexNil)
                                type_code = TYPE_CODE_ENUM;
                            else {
***************
*** 1113,1119 ****
                                ecoff_swap_tir_in (bigend,
                                                   &ax[tsym->index].a_ti,
                                                   &tir);
!                               if (tir.bt == btNil || tir.bt == btVoid)
                                    type_code = TYPE_CODE_ENUM;
                            }
                        nfields++;
--- 1114,1121 ----
                                ecoff_swap_tir_in (bigend,
                                                   &ax[tsym->index].a_ti,
                                                   &tir);
!                               if ((tir.bt == btNil || tir.bt == btVoid) 
!                                     && tir.tq0 == tqNil)
                                    type_code = TYPE_CODE_ENUM;
                            }
                        nfields++;

-- end cut --

John M. Farrell                 | Internet: farrell@fjord.reo.dec.com
Digital Equipment Corporation   | 
P.O. Box 121                    | "One foot in the grave, 
Reading, RG1 0TU, UK.           |  and one foot on the pedal", TP     
--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Michael Joosten   |       Tel.  : (+49) (+) 5251-284 120                 |
| CADLAB            |       Fax   : (+49) (+) 5251-284 140                 |
| Bahnhofstr. 32    |       E-Mail: joost@cadlab.de                        |
| D-4790 Paderborn  |        	    ...!uunet!unido!cadlab!joost           | 
| FRG               | Mass mail to: joost@pbinfo.uni-paderborn.de          |
|--------------------------------------------------------------------------|
| CADLAB is a cooperation between Uni-GH Paderborn & SNI AG                |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <JOOST.92Dec7205729@ori.cadlab.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cadlab.DE!joost
References: <21976.723676364@PDS.MACH.CS.CMU.EDU>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,ca5e0008cd0a365
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 1992-12-07 20:30:24 PST
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cadlab.DE!joost
From: joost@cadlab.DE (Michael Joosten)
Subject: Re: Type Declaration/Printing Bug
Message-ID: <JOOST.92Dec7205729@ori.cadlab.de>
Sender: gnulists@ai.mit.edu
Reply-To: joost@cadlab.de
Organization: CADLAB, Paderborn, FRG
References: <21976.723676364@PDS.MACH.CS.CMU.EDU>
Distribution: gnu
Date: Tue, 8 Dec 1992 01:57:29 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 104