Article View: gnu.gdb.bug
Article #161Re: Bugs in GDB 4.6
From: John M. Farrell
Date: Wed, 05 Aug 1992 17:42
Date: Wed, 05 Aug 1992 17:42
80 lines
3414 bytes
3414 bytes
>>>>> 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.92Aug5174257@fjord.reo.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!fjord.reo.dec.com!farrellReferences:
farrell@fjord.reo.dec.com (John M. Farrell)Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!fjord.reo.dec.com!farrell From: farrell@fjord.reo.dec.com (John M. Farrell) Subject: Re: Bugs in GDB 4.6 Message-ID: <FARRELL.92Aug5174257@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: Wed, 5 Aug 1992 17:42:57 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 81