From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5509 invoked by alias); 16 Jul 2009 16:35:33 -0000 Received: (qmail 5498 invoked by uid 22791); 16 Jul 2009 16:35:32 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_SORBS_WEB,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ax57.genwebserver.com (HELO ax57.genwebserver.com) (72.18.145.194) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jul 2009 16:35:25 +0000 Received: from hide-inside.nemetschek.net ([207.10.60.100] helo=[192.168.1.222]) by ax57.genwebserver.com with esmtpa (Exim 4.69) (envelope-from ) id 1MRTvX-0004o7-54 for gdb@sourceware.org; Thu, 16 Jul 2009 10:35:23 -0600 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Mime-Version: 1.0 (Apple Message framework v1071.1) Subject: Re: printing static const variables From: Eric Gorr In-Reply-To: Date: Thu, 16 Jul 2009 16:35:00 -0000 Content-Transfer-Encoding: 7bit Message-Id: <97A121F2-C4CB-4244-9F71-1D0B9BA60638@ericgorr.net> References: <2C11E6EB-A5C0-4A12-8DC3-87E73C7755AC@ericgorr.net> To: gdb@sourceware.org X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00105.txt.bz2 > 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?