Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wei-min Pan <weimin.pan@oracle.com>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] break gdb build on 32-bit host with ADI support
Date: Fri, 25 Aug 2017 17:43:00 -0000	[thread overview]
Message-ID: <67a84500-3183-07dd-68e1-2c10345725af@oracle.com> (raw)
In-Reply-To: <e5172ff5-d369-91b3-c144-a8eabbab39d3@redhat.com>



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.



      parent reply	other threads:[~2017-08-25 17:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25  1:44 Weimin Pan
2017-08-25 10:18 ` Pedro Alves
2017-08-25 10:33   ` Simon Marchi
2017-08-25 10:44     ` Pedro Alves
2017-08-25 17:43   ` Wei-min Pan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67a84500-3183-07dd-68e1-2c10345725af@oracle.com \
    --to=weimin.pan@oracle.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox