From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id B1ZrGIrkEmDIdgAAWB0awg (envelope-from ) for ; Thu, 28 Jan 2021 11:21:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 540511EF80; Thu, 28 Jan 2021 11:21:30 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B692B1E945 for ; Thu, 28 Jan 2021 11:21:29 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C36B4385800F; Thu, 28 Jan 2021 16:21:28 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id ADCA5385800F for ; Thu, 28 Jan 2021 16:21:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ADCA5385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7AC74ACB7; Thu, 28 Jan 2021 16:21:24 +0000 (UTC) Subject: Re: [PATCH][gdb/testsuite] Fix g0 search in gdb.arch/i386-sse-stack-align.exp To: Simon Marchi , gdb-patches@sourceware.org References: <20210126180330.GA7889@delia> <9ebc1864-3bd3-cc10-b327-e8f3d37e8c15@polymtl.ca> From: Tom de Vries Message-ID: Date: Thu, 28 Jan 2021 17:21:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <9ebc1864-3bd3-cc10-b327-e8f3d37e8c15@polymtl.ca> Content-Type: multipart/mixed; boundary="------------2135DC262DE2A66D9A948EB4" Content-Language: en-US X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------2135DC262DE2A66D9A948EB4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 1/28/21 4:04 PM, Simon Marchi wrote: > > > On 2021-01-26 1:03 p.m., Tom de Vries wrote: >> Hi, >> >> When running test-case gdb.arch/i386-sse-stack-align.exp on target board >> unix/-m32, I run into: >> ... >> (gdb) print (int) g0 ()^M >> Invalid data type for function to be called.^M >> (gdb) FAIL: gdb.arch/i386-sse-stack-align.exp: print (int) g0 () >> ... >> >> Gdb is supposed to use minimal symbol g0: >> ... >> $ nm i386-sse-stack-align | grep g0 >> 08049194 t g0 >> ... >> but instead it finds a g0 symbol in the debug info of libm, specifically in >> ./sysdeps/ieee754/ldbl-96/e_lgammal_r.c. >> >> Fix this by disabling reading symbols for shared libs. >> >> Tested on x86_64-linux. >> >> Any comments? >> >> Thanks, >> - Tom >> >> [gdb/testsuite] Fix g0 search in gdb.arch/i386-sse-stack-align.exp >> >> gdb/testsuite/ChangeLog: >> >> 2021-01-26 Tom de Vries >> >> * gdb.arch/i386-sse-stack-align.exp: Set auto-solib-add to off. >> >> --- >> gdb/testsuite/gdb.arch/i386-sse-stack-align.exp | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp >> index 2c1cdd89c70..57dd12f9830 100644 >> --- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp >> +++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp >> @@ -37,6 +37,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $opts >> >> clean_restart $executable >> >> +# With libm debug info installed, I get a g0 from >> +# ./sysdeps/ieee754/ldbl-96/e_lgammal_r.c instead of the local g0. >> +# Fix this by disabling reading symbols for shared libs. >> +gdb_test_no_output "set auto-solib-add off" >> + >> if ![runto_main] then { >> return -1 >> } >> > > Couldn't we simply use some less common, more scoped name? > Yep, that also works. How about this? Thanks, - Tom --------------2135DC262DE2A66D9A948EB4 Content-Type: text/x-patch; charset=UTF-8; name="0001-gdb-testsuite-Fix-g0-search-in-gdb.arch-i386-sse-stack-align.exp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-gdb-testsuite-Fix-g0-search-in-gdb.arch-i386-sse-stack-"; filename*1="align.exp.patch" [gdb/testsuite] Fix g0 search in gdb.arch/i386-sse-stack-align.exp When running test-case gdb.arch/i386-sse-stack-align.exp on target board unix/-m32, I run into: ... (gdb) print (int) g0 ()^M Invalid data type for function to be called.^M (gdb) FAIL: gdb.arch/i386-sse-stack-align.exp: print (int) g0 () ... Gdb is supposed to use minimal symbol g0: ... $ nm i386-sse-stack-align | grep g0 08049194 t g0 ... but instead it finds a g0 symbol in the debug info of libm, specifically in ./sysdeps/ieee754/ldbl-96/e_lgammal_r.c. Fix this by renaming g[0-4] to test_g[0-4]. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-01-28 Tom de Vries * gdb.arch/i386-sse-stack-align.S: Rename g[0-4] to test_g[0-4]. * gdb.arch/i386-sse-stack-align.c: Same. * gdb.arch/i386-sse-stack-align.exp: Same. --- gdb/testsuite/gdb.arch/i386-sse-stack-align.S | 40 ++++++++++++------------- gdb/testsuite/gdb.arch/i386-sse-stack-align.c | 13 ++++---- gdb/testsuite/gdb.arch/i386-sse-stack-align.exp | 2 +- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.S b/gdb/testsuite/gdb.arch/i386-sse-stack-align.S index cd3b49ed829..2e9d54a8190 100644 --- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.S +++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.S @@ -70,8 +70,8 @@ f: .cfi_endproc .LFE1: .size f, .-f - .type g0, @function -g0: + .type test_g0, @function +test_g0: .LFB2: .cfi_startproc pushl %ebp @@ -87,9 +87,9 @@ g0: ret .cfi_endproc .LFE2: - .size g0, .-g0 - .type g1, @function -g1: + .size test_g0, .-test_g0 + .type test_g1, @function +test_g1: .LFB3: .cfi_startproc pushl %ebp @@ -105,9 +105,9 @@ g1: ret .cfi_endproc .LFE3: - .size g1, .-g1 - .type g2, @function -g2: + .size test_g1, .-test_g1 + .type test_g2, @function +test_g2: .LFB4: .cfi_startproc pushl %ebp @@ -123,9 +123,9 @@ g2: ret .cfi_endproc .LFE4: - .size g2, .-g2 - .type g3, @function -g3: + .size test_g2, .-test_g2 + .type test_g3, @function +test_g3: .LFB5: .cfi_startproc pushl %ebp @@ -141,9 +141,9 @@ g3: ret .cfi_endproc .LFE5: - .size g3, .-g3 - .type g4, @function -g4: + .size test_g3, .-test_g3 + .type test_g4, @function +test_g4: .LFB6: .cfi_startproc pushl %ebp @@ -159,7 +159,7 @@ g4: ret .cfi_endproc .LFE6: - .size g4, .-g4 + .size test_g4, .-test_g4 .globl main .type main, @function main: @@ -174,25 +174,25 @@ main: andl $-16, %esp subl $16, %esp .cfi_offset 3, -12 - call g0 + call test_g0 movl %eax, %ebx movl $1, (%esp) - call g1 + call test_g1 addl %eax, %ebx movl $2, 4(%esp) movl $1, (%esp) - call g2 + call test_g2 addl %eax, %ebx movl $3, 8(%esp) movl $2, 4(%esp) movl $1, (%esp) - call g3 + call test_g3 addl %eax, %ebx movl $4, 12(%esp) movl $3, 8(%esp) movl $2, 4(%esp) movl $1, (%esp) - call g4 + call test_g4 addl %ebx, %eax movl -4(%ebp), %ebx leave diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.c b/gdb/testsuite/gdb.arch/i386-sse-stack-align.c index adae6b75fb1..4fd1fda3500 100644 --- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.c +++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.c @@ -34,31 +34,31 @@ f (void) } static __attribute__((noinline, noclone)) int -g0 (void) +test_g0 (void) { return f (); } static __attribute__((noinline, noclone)) int -g1 (int p1) +test_g1 (int p1) { return f (); } static __attribute__((noinline, noclone)) int -g2 (int p1, int p2) +test_g2 (int p1, int p2) { return f (); } static __attribute__((noinline, noclone)) int -g3 (int p1, int p2, int p3) +test_g3 (int p1, int p2, int p3) { return f (); } static __attribute__((noinline, noclone)) int -g4 (int p1, int p2, int p3, int p4) +test_g4 (int p1, int p2, int p3, int p4) { return f (); } @@ -66,5 +66,6 @@ g4 (int p1, int p2, int p3, int p4) int main (void) { - return g0 () + g1 (1) + g2 (1, 2) + g3 (1, 2, 3) + g4 (1, 2, 3, 4); + return (test_g0 () + test_g1 (1) + test_g2 (1, 2) + test_g3 (1, 2, 3) + + test_g4 (1, 2, 3, 4); } diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp index 2c1cdd89c70..8cda3b49fac 100644 --- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp +++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp @@ -43,7 +43,7 @@ if ![runto_main] then { set args "" foreach i {0 1 2 3 4} { - set test "print (int) g$i ($args)" + set test "print (int) test_g$i ($args)" gdb_test_multiple $test $test { -re " = 2\r\n$gdb_prompt $" { pass $test --------------2135DC262DE2A66D9A948EB4--