From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11237 invoked by alias); 10 Mar 2009 09:48:42 -0000 Received: (qmail 11228 invoked by uid 22791); 10 Mar 2009 09:48:41 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Mar 2009 09:48:35 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n2A9mXju015327 for ; Tue, 10 Mar 2009 05:48:33 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n2A9mc6v032389 for ; Tue, 10 Mar 2009 05:48:38 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n2A9mWxB020527; Tue, 10 Mar 2009 05:48:33 -0400 Received: from localhost.localdomain (frit.oliva.athome.lsd.ic.unicamp.br [172.31.160.7]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.3/8.14.3) with ESMTP id n2A9mVNI010620; Tue, 10 Mar 2009 06:48:31 -0300 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3) with ESMTP id n2A9mUxK023024; Tue, 10 Mar 2009 06:48:30 -0300 Received: (from aoliva@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id n2A9mTed023023; Tue, 10 Mar 2009 06:48:29 -0300 To: gdb@sources.redhat.com Subject: any expression to tell whether a variable was optimized out? From: Alexandre Oliva Date: Tue, 10 Mar 2009 09:48:00 -0000 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-03/txt/msg00074.txt.bz2 Hi, I'm working on a debug info quality testsuite for GCC, and I've been having some trouble telling, in gdb macros, a variable for which no location expression is available at a certain point in the program (but for which we do have locations at other points), from one that evaluates to zero (lifetime constant, or stored in register or memory). Consider: (gdb) p x $1 = (gdb) p y $2 = 0 (gdb) p x == y 1 (gdb) p &x Can't take address of "x" which isn't an lvalue. (gdb) p &y Address requested for identifier "y" which is in register $r12 (gdb) set $temp1 = x (gdb) set $temp2 = y (gdb) set z = $temp1 == $temp2 (gdb) p z 1 (gdb) set $temp1 = x + 1 (gdb) set $temp2 = y + 1 (gdb) set z = $temp1 == $temp2 (gdb) p z 1 Is there really no way to set a gdb variable to something equivalent to the boolean result of valprint.c:value_optimized_out()? Any reason for that, other than that nobody needed it before? Thanks in advance, -- Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist Red Hat Brazil Compiler Engineer