🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #797

gdb enum printing.

#797
From: Glenn Engel
Date: Fri, 09 Jun 1989 19:07
40 lines
1302 bytes
When enums are printed with gdb, gdb will show the string which represents
the enum.  If two enums have the same value, the last one defined will
be printed.  I think it would be more useful to default to the first
string rather than the last string.  Here's an example:


typedef enum {

   ABLOB,
   BBLOB,
   CBLOB,
   DBLOB,

   FIRST_BLOB = ABLOB,
   LAST_BLOB  = DBLOB,
   NUM_BLOBS  = LAST_BLOB - FIRST_BLOB +1,

} Blobs;

main()
{
  Blobs  blob,aBlob;

  blob = DBLOB;

  for (aBlob = FIRST_BLOB; blob <= LAST_BLOB; blob++)
  {
     /* do something interesting */
  }
}

If blob is printed with gdb, it will say it is equal to LAST_BLOB instead
of DBLOB.  Also, when aBlob is printed during the for loop, it will
come up with values of FIRST_BLOB and LAST_BLOB instead of ABLOB and DBLOB.

--
 |  Glenn R. Engel
 |  Hewlett-Packard 
 |  (206) 335-2066
 |  glenne%hplsla@hplabs.hp.com
Technical Details
Message-ID: <8906091907.AA13444@labgre.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!HPLSLA.HP.COM!glenne

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!HPLSLA.HP.COM!glenne
From: glenne@HPLSLA.HP.COM (Glenn Engel)
Newsgroups: gnu.gdb.bug
Subject: gdb enum printing.
Message-ID: <8906091907.AA13444@labgre.HP.COM>
Date: 9 Jun 89 19:07:09 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 40