From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40207 invoked by alias); 25 Aug 2017 17:43:17 -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 38251 invoked by uid 89); 25 Aug 2017 17:43:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Entering, EXPECT, ect X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 Aug 2017 17:43:14 +0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v7PHhBjP019835 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Aug 2017 17:43:11 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v7PHhAdD002674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Aug 2017 17:43:10 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v7PHh94D028109; Fri, 25 Aug 2017 17:43:10 GMT Received: from [10.159.246.105] (/10.159.246.105) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 25 Aug 2017 10:43:09 -0700 Subject: Re: [PATCH v2] break gdb build on 32-bit host with ADI support To: Pedro Alves , gdb-patches@sourceware.org References: <1503624784-124602-1-git-send-email-weimin.pan@oracle.com> From: Wei-min Pan Message-ID: <67a84500-3183-07dd-68e1-2c10345725af@oracle.com> Date: Fri, 25 Aug 2017 17:43:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2017-08/txt/msg00490.txt.bz2 On 8/25/2017 3:18 AM, Pedro Alves wrote: > $subject should be "unbreak", I hope. :-) > > On 08/25/2017 02:33 AM, Weimin Pan wrote: > >> @@ -240,7 +242,7 @@ adi_normalize_address (CORE_ADDR addr) >> adi_stat_t ast = get_adi_info (ptid_get_pid (inferior_ptid)); >> >> if (ast.nbits) >> - return ((CORE_ADDR)(((long)addr << ast.nbits) >> ast.nbits)); >> + return (addr & ((1 << ast.nbits) - 1)) ^ (addr & (-1 >> ast.nbits)); > How did you test this? Doesn't look right to me. > Also, "-1 >>" is still an implementation-defined signed > right shift. > > I _think_ this is what you want: > > /* Clear upper bits. */ > addr &= ((uint64_t) -1) >> ast.nbits; > > /* Sign extend. */ > CORE_ADDR signbit = (uint64_t) 1 << (64 - ast.nbits - 1); > return (addr ^ signbit) - signbit; > > I.e., with ast.nbits == 4: > > before: ffffffffffffffff > after: ffffffffffffffff > > before: f7ffffffffffffff > after: 07ffffffffffffff > > Thanks, > Pedro Alves > Yes, below is running the ADI test case, which Yao requested in one of these patches, with your code: % make check TESTS="gdb.arch/sparc64-adi.exp" make[1]: Entering directory `/home/wepan/work/new3/binutils-gdb/gdb/testsuite' Nothing to be done for all... make check-single make[2]: Entering directory `/home/wepan/work/new3/binutils-gdb/gdb/testsuite' rootme=`pwd`; export rootme; srcdir=. ; export srcdir ; EXPECT=`if [ "${READ1}" != "" ] ; then echo ${rootme}/expect-read1; elif [ -f ${rootme}/../../expect/exp ect ] ; then echo ${rootme}/../../expect/expect ; else echo expect ; fi` ; expor t EXPECT ; EXEEXT= ; export EXEEXT ; LD_LIBRARY_PATH=$rootme/../../expect:$rootm e/../../libstdc++:$rootme/../../tk/unix:$rootme/../../tcl/unix:$rootme/../../bfd :$rootme/../../opcodes:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; if [ -f ${rootm e}/../../expect/expect ] ; then TCL_LIBRARY=${srcdir}/../../tcl/library ; export  TCL_LIBRARY ; fi ; runtest --status  gdb.arch/sparc64-adi.exp WARNING: Couldn't find the global config file. Test Run By wepan on Fri Aug 25 12:21:07 2017 Native configuration is sparc64-unknown-linux-gnu                 === gdb tests === Schedule of variations:     unix Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using /home/wepan/work/new3/binutils-gdb/gdb/testsuite/config/unix.exp as tool-a nd-target-specific interface file. Running /home/wepan/work/new3/binutils-gdb/gdb/testsuite/gdb.arch/sparc64-adi.exp ...                 === gdb Summary === # of expected passes            7 /home/wepan/work/new3/binutils-gdb/gdb/testsuite/../../gdb/gdb version  8.0.50.2 0170823-git -nw -nx -data-directory /home/wepan/work/new3/binutils-gdb/gdb/tests uite/../data-directory Thanks much.