From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24855 invoked by alias); 16 Jul 2009 16:21:27 -0000 Received: (qmail 24846 invoked by uid 22791); 16 Jul 2009 16:21:26 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jul 2009 16:21:13 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6GGL55c000833; Thu, 16 Jul 2009 12:21:05 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6GGL402011705; Thu, 16 Jul 2009 12:21:04 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6GGL1Vm031633; Thu, 16 Jul 2009 12:21:03 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 40463378096; Thu, 16 Jul 2009 10:21:01 -0600 (MDT) To: Eric Gorr Cc: gdb@sourceware.org Subject: Re: printing static const variables References: <2C11E6EB-A5C0-4A12-8DC3-87E73C7755AC@ericgorr.net> From: Tom Tromey Reply-To: tromey@redhat.com Date: Thu, 16 Jul 2009 16:21:00 -0000 In-Reply-To: <2C11E6EB-A5C0-4A12-8DC3-87E73C7755AC@ericgorr.net> (Eric Gorr's message of "Thu\, 16 Jul 2009 12\:16\:45 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00104.txt.bz2 >>>>> "Eric" == Eric Gorr writes: Eric> static const int doubleByteDegreeMark = 42; Eric> if I try to print out the value of doubleByteDegreeMark, it gives me Eric> the error message: Eric> (gdb) print doubleByteDegreeMark Eric> No symbol "doubleByteDegreeMark" in current context. Eric> So, my (probably really simple) question is how can I print out the Eric> value of doubleByteDegreeMark from GDB? 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. You can try dumping the debuginfo for your program to find out. How to do that is system-dependent, though. Tom