🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Glenn Engel Fri, 09 Jun 1989 19:07
gdb enum printing.
#797
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads