Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Shaun Jackman <shaunj@gray-interfaces.com>
To: gdb@sources.redhat.com
Subject: printing enumerated values
Date: Fri, 06 Oct 2000 10:52:00 -0000	[thread overview]
Message-ID: <00100611524000.07740@ed> (raw)

I have an enum that looks something like...

enum {
  A = 512,
  B = 513
};

It's not really an enumerated list, more like constant integers. I don't want
to use defines though because I can't work with them in GDB. And, 'const int's
have performance issues in -O0 (where I'll be staying until we leave the
touchy development phase).

In GDB I get this...
(gdb) p A
$1 = 0
(gdb) p B
$2 = 1
(gdb)

This should be 512, and 513 respectively (clearly).

Cheers,
Shaun
From dberlin@redhat.com Fri Oct 06 11:02:00 2000
From: Daniel Berlin <dberlin@redhat.com>
To: shaunj@gray-interfaces.com
Cc: gdb@sources.redhat.com
Subject: Re: printing enumerated values
Date: Fri, 06 Oct 2000 11:02:00 -0000
Message-id: <m366n5g861.fsf@dan2.cygnus.com>
References: <00100611524000.07740@ed>
X-SW-Source: 2000-10/msg00022.html
Content-length: 738

Shaun Jackman <shaunj@gray-interfaces.com> writes:

> I have an enum that looks something like...
> 
> enum {
>   A = 512,
>   B = 513
> };
> 
> It's not really an enumerated list, more like constant integers. I don't want
> to use defines though because I can't work with them in GDB. And, 'const int's
> have performance issues in -O0 (where I'll be staying until we leave the
> touchy development phase).
> 
> In GDB I get this...
> (gdb) p A
> $1 = 0
> (gdb) p B
> $2 = 1
> (gdb)
> 
> This should be 512, and 513 respectively (clearly).
> 

Clearly, this is a GCC problem.
At least with all the versions of GCC on my computer, unless the enum
has a real name (ie isn't anonymous), it doesn't generate the debug
info properly for it.


             reply	other threads:[~2000-10-06 10:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-06 10:52 Shaun Jackman [this message]
2000-10-06 11:04 ` J.T. Conklin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00100611524000.07740@ed \
    --to=shaunj@gray-interfaces.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox