From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25058 invoked by alias); 12 Apr 2011 13:44:47 -0000 Received: (qmail 24934 invoked by uid 22791); 12 Apr 2011 13:44:46 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e24smtp02.br.ibm.com (HELO e24smtp02.br.ibm.com) (32.104.18.86) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Apr 2011 13:44:39 +0000 Received: from /spool/local by e24smtp02.br.ibm.com with XMail ESMTP for from ; Tue, 12 Apr 2011 10:44:37 -0300 Received: from d24relay01.br.ibm.com ([9.8.31.16]) by e24smtp02.br.ibm.com ([10.172.0.142]) with XMail ESMTP; Tue, 12 Apr 2011 10:44:35 -0300 Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p3CDfudB1425636 for ; Tue, 12 Apr 2011 10:41:56 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p3CBiXu9016244 for ; Tue, 12 Apr 2011 08:44:33 -0300 Received: from [9.12.224.102] ([9.12.224.102]) by d24av01.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p3CBiVrF016150; Tue, 12 Apr 2011 08:44:32 -0300 Message-ID: <4DA4573D.1040101@linux.vnet.ibm.com> Date: Tue, 12 Apr 2011 13:44:00 -0000 From: Edjunior Barbosa Machado User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20110303 Lightning/1.0b1 Icedove/3.0.11 MIME-Version: 1.0 To: Yao Qi CC: "gdb@sourceware.org" Subject: Re: "optimized out" on gdb.base/gdb1090.exp References: <4DA3A7D0.2000701@linux.vnet.ibm.com> <4DA3B701.3060902@codesourcery.com> In-Reply-To: <4DA3B701.3060902@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit x-cbid: 11041213-5054-0000-0000-00000118DF1C 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: 2011-04/txt/msg00037.txt.bz2 On 04/11/2011 11:20 PM, Yao Qi wrote: > On 04/12/2011 09:16 AM, Edjunior Barbosa Machado wrote: >> Hi, >> >> running the testcase gdb.base/gdb1090.exp on ppc64 using gcc 4.3.4, >> noticed an unexpected error in the second test: >> >> #1 0x00000000100005dc in foo () at >> ../../../gdb.git/gdb/testsuite/gdb.base/gdb1090.c:39^M >> 39 marker (s24);^M >> (gdb) PASS: gdb.base/gdb1090.exp: up from marker >> print s24^M >> $1 =^M >> (gdb) FAIL: gdb.base/gdb1090.exp: print s24 >> >> According to readelf output, s24 uses r9, which is a volatile register. >> However, the content is properly printed when using gcc 4.4.5 (var s24 >> goes to r30, which is not volatile on power) >> >> Just wondering, can we consider this last test as untested (or even >> pass) when print returns "optimized out", since it does not print >> garbage (which was the original issue from gdb/1090)? >> > > If we set breakpoint directly on a certain line of main(), and check the > value of `s24' in main(). Can we get the value of `s24'? If we can, we > may modify test case a little bit, instead of marking this case as > untested (or even pass). > It works fine if I set a breakpoint in the end of foo() (which is the function where 's24' is declared). My only concern is if this check in the same frame will not affect the main purpose of the testcase. If there is no problem with this, please consider the patch below. Thanks, -- Edjunior 2011-04-12 Edjunior Machado * testsuite/gdb.base/gdb1090.exp: change breakpoint location to read the content of 's24' correctly (avoiding "optimized out"). * testsuite/gdb.base/gdb1090.c: add comment in order to set breakpoint. diff --git a/gdb/testsuite/gdb.base/gdb1090.c b/gdb/testsuite/gdb.base/gdb1090.c index 22f2cec..72ebd2e 100644 --- a/gdb/testsuite/gdb.base/gdb1090.c +++ b/gdb/testsuite/gdb.base/gdb1090.c @@ -37,7 +37,7 @@ void foo () s24.field_0 = 1170; s24.field_1 = 64701; marker (s24); - return; + return; /* break-here */ } int main () diff --git a/gdb/testsuite/gdb.base/gdb1090.exp b/gdb/testsuite/gdb.base/gdb1090.exp index a15fd04..0ff5c73 100644 --- a/gdb/testsuite/gdb.base/gdb1090.exp +++ b/gdb/testsuite/gdb.base/gdb1090.exp @@ -40,12 +40,9 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -if ![runto marker] then { - perror "couldn't run to breakpoint" - continue -} -gdb_test "up" ".*foo.*" "up from marker" +gdb_breakpoint [gdb_get_line_number "break-here"] +gdb_run_cmd gdb_test_multiple "print s24" "print s24" { -re "\\\$\[0-9\]* = \\{field_0 = 1170, field_1 = 64701\\}\r\n$gdb_prompt $" { pass "print s24"