Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Eric Gorr <mailist@ericgorr.net>
To: gdb@sourceware.org
Subject: Re: printing static const variables
Date: Thu, 16 Jul 2009 16:35:00 -0000	[thread overview]
Message-ID: <97A121F2-C4CB-4244-9F71-1D0B9BA60638@ericgorr.net> (raw)
In-Reply-To: <m3vdls8uqb.fsf@fleche.redhat.com>

 > You didn't say how you compiled this, or what platform you're on.
 >
 > Probably the compiler optimized this variable away.  If so, there's  
no
 > way to print it.

Hello Mr. Tromey.

Thank you for your comments.

I still see the same problem if change the test function to:

Boolean TestFunction( int val )
{
	static const int doubleByteDegreeMark = 42;
	static int anotherVar = 12;
	
	
	return ( val == doubleByteDegreeMark || val == anotherVar );
}

Now, I suppose it is still possible that the compiler will have simply  
optimized this to:

Boolean TestFunction( int val )
{
	static int anotherVar = 12;
	
	return ( val == 42 || val == anotherVar );
}

or something.

In any case, I am using Xcode 3.1 under Mac OS X 10.5

This is the debug build with all optimizations turned off.


Under other circumstances, should 'info locals' display  
doubleByteDegreeMark? Should I be able to print doubleByteDegreeMark?


  reply	other threads:[~2009-07-16 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-16 16:16 Eric Gorr
2009-07-16 16:21 ` Tom Tromey
2009-07-16 16:35   ` Eric Gorr [this message]
2009-07-16 16:56     ` Tom Tromey
2009-07-16 17:28     ` Grant Edwards

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=97A121F2-C4CB-4244-9F71-1D0B9BA60638@ericgorr.net \
    --to=mailist@ericgorr.net \
    --cc=gdb@sourceware.org \
    /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