From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13082 invoked by alias); 6 Feb 2013 18:56:00 -0000 Received: (qmail 13034 invoked by uid 22791); 6 Feb 2013 18:55:59 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Feb 2013 18:55:53 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r16Itokd001105 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 6 Feb 2013 13:55:50 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r16Itn39026787; Wed, 6 Feb 2013 13:55:50 -0500 Message-ID: <5112A735.9020603@redhat.com> Date: Wed, 06 Feb 2013 18:56:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Marcus Shawcroft CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] gdbserver switch ps_get_thread_area to PTRACE_GETREGSET References: <51129511.7070601@arm.com> In-Reply-To: <51129511.7070601@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2013-02/txt/msg00155.txt.bz2 On 02/06/2013 05:38 PM, Marcus Shawcroft wrote: > > diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c > index 7f99887..e56ea80 100644 > --- a/gdb/gdbserver/linux-aarch64-low.c > +++ b/gdb/gdbserver/linux-aarch64-low.c > @@ -1089,16 +1089,22 @@ aarch64_stopped_by_watchpoint (void) > /* Fetch the thread-local storage pointer for libthread_db. */ > > ps_err_e > -ps_get_thread_area (const struct ps_prochandle * ph, > +ps_get_thread_area (const struct ps_prochandle *ph, > lwpid_t lwpid, int idx, void **base) > { > - if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0) > + struct iovec iovec; > + CORE_ADDR reg; > + > + iovec.iov_base = ® > + iovec.iov_len = sizeof (reg); Something like 'uint64_t reg' would be better than assuming gdb's own CORE_ADDR type is exactly 64-bit (although it actually will be in practice). OK with that change. > + > + if (ptrace (PTRACE_GETREGSET, lwpid, NT_ARM_TLS, &iovec) != 0) > return PS_ERR; > > /* IDX is the bias from the thread pointer to the beginning of the > thread descriptor. It has to be subtracted due to implementation > quirks in libthread_db. */ > - *base = (void *) ((char *) *base - idx); > + *base = (void *) (reg - idx); > > return PS_OK; > } -- Pedro Alves