From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52398 invoked by alias); 13 Jun 2017 20:33:29 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 52385 invoked by uid 89); 13 Jun 2017 20:33:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=Hx-languages-length:2310 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 13 Jun 2017 20:33:27 +0000 Received: by simark.ca (Postfix, from userid 33) id 52B2F1E4E8; Tue, 13 Jun 2017 16:33:30 -0400 (EDT) To: Andreas Arnez Subject: Re: [PATCH] Fix register selection in var-access.exp X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 13 Jun 2017 20:33:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: References: Message-ID: <0dc97ea8ffe3b55b2a114ba1102f23c0@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.5 X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00406.txt.bz2 On 2017-06-13 20:34, Andreas Arnez wrote: > The new test var-access.exp causes FAILs on i686. This is because the > test chooses the wrong name for DWARF register number 1: It uses > "edx" (which corresponds to DWARF register number 2), but should have > used > "ecx" instead. > > Also, the current logic in var-access.exp does not correctly > distinguish > between a 64-bit and a 32-bit program on an x86-64 target. It uses the > 64-bit register names for both. > > These problems are fixed. In order to address the latter, the > convenience > macros is_*_target are exploited where appropriate. > > gdb/testsuite/ChangeLog: > > * gdb.dwarf2/var-access.exp: Use register name ecx instead of edx > on 32-bit x86 targets. Exploit is_*_target macros where > appropriate. > --- > gdb/testsuite/gdb.dwarf2/var-access.exp | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/gdb/testsuite/gdb.dwarf2/var-access.exp > b/gdb/testsuite/gdb.dwarf2/var-access.exp > index 157a96c..96c54e7 100644 > --- a/gdb/testsuite/gdb.dwarf2/var-access.exp > +++ b/gdb/testsuite/gdb.dwarf2/var-access.exp > @@ -28,16 +28,16 @@ if {![dwarf2_support]} { > > set dwarf_regnum {0 1} > > -if { [istarget "aarch64*-*-*"] } { > +if { [is_aarch64_target] } { > set regname {x0 x1} > -} elseif { [istarget "arm*-*-*"] > +} elseif { [is_aarch32_target] > || [istarget "s390*-*-*" ] > || [istarget "powerpc*-*-*"] > || [istarget "rs6000*-*-aix*"] } { > set regname {r0 r1} > -} elseif { [istarget "i?86-*-*"] } { > - set regname {eax edx} > -} elseif { [istarget "x86_64-*-*"] } { > +} elseif { [is_x86_like_target] } { > + set regname {eax ecx} > +} elseif { [is_amd64_regs_target] } { > set regname {rax rdx} > } else { > verbose "Skipping tests for accessing DWARF-described variables." The patch LGTM. However could you (or somebody else) explain this to me? The doc of is_amd64_regs_target says: 2465 # Return 1 if target has x86_64 registers - either amd64 or x32. 2466 # x32 target identifies as x86_64-*-linux*, therefore it cannot be determined 2467 # just from the target string. If x32 identifies as x86_64-something and that procedure should return true when testing with x32 and x86_64/amd64, why can't we test the target string for x86_64-*?