Article View: gnu.gdb.bug
Article #8778Re: Type Declaration/Printing Bug
From: John M. Farrell
Date: Mon, 07 Dec 1992 17:04
Date: Mon, 07 Dec 1992 17:04
92 lines
4028 bytes
4028 bytes
This is a repost of a fix I posted for this bug some time ago. There are a
number of other 4.6 DECstation fixes which I posted and which didn't appear in
4.7. Is there anything more constructive I can do to get them included in the
next official release?
In-reply-to: svkakkad@cs.utexas.edu's message of Sun, 2 Aug 1992 10:26:01 GMT
Newsgroups: gnu.gdb.bug
Subject: Re: Bugs in GDB 4.6
References: <9208022026.AA21394@boogie.cs.utexas.edu>
Distribution: gnu
--text follows this line--
>>>>> 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
Technical Details
Message-ID:
<FARRELL.92Dec7170448@fjord.reo.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!fjord.reo.dec.com!farrellReferences:
farrell@fjord.reo.dec.com (John M. Farrell)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:13:27 PST Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!fjord.reo.dec.com!farrell From: farrell@fjord.reo.dec.com (John M. Farrell) Subject: Re: Type Declaration/Printing Bug Message-ID: <FARRELL.92Dec7170448@fjord.reo.dec.com> Sender: gnulists@ai.mit.edu Organization: Digital Equipment Corporation - UK Engineering References: farrell@fjord.reo.dec.com (John M. Farrell) Distribution: gnu Date: Mon, 7 Dec 1992 17:04:48 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 93