From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26806 invoked by alias); 16 Sep 2013 13:38: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 26796 invoked by uid 89); 16 Sep 2013 13:38:28 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Sep 2013 13:38:28 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8GDcLGc008099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Sep 2013 09:38:21 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r8GDcJE3010621; Mon, 16 Sep 2013 09:38:20 -0400 Message-ID: <523709CB.2050205@redhat.com> Date: Mon, 16 Sep 2013 13:38:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Will Newton CC: Andrew Pinski , Andreas Schwab , "gdb-patches@sourceware.org" Subject: Re: [PATCH/AARCH64] Fix hardware break points References: <87k3kbbsbz.fsf@igel.home> <5236FD06.9070807@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-09/txt/msg00445.txt.bz2 On 09/16/2013 01:53 PM, Will Newton wrote: > On 16 September 2013 13:43, Pedro Alves wrote: >> On 09/12/2013 08:15 AM, Andrew Pinski wrote: >>> On Tue, Sep 10, 2013 at 7:37 AM, Will Newton wrote: >>>> On 27 July 2013 23:42, Andrew Pinski wrote: >>>> >>>> Hi Andrew, >>>> >>>>> On Sat, Jul 27, 2013 at 2:34 PM, Andreas Schwab wrote: >>>>>> Andrew Pinski writes: >>>>>> >>>>>>> OK? Built and tested on aarch64-linux-gnu with no regressions. >>>>>> >>>>>> Did you? >>>>>> >>>>>>> + memset (®s, 0, size(regs)); >>>>> >>>>> This is what I get for copying and pasting from one source file to another. >>>>> >>>>> Here is the fixed one which was definitely tested. >>>> >>>> What's the status of this patch? It seems like it fixes real problems >>>> people are seeing in the field. >> >>> After not much thought, I decided this was an obvious patch as regs is >>> used uninitialized otherwise when passed to ptrace. >> >> Leaves me wondering what field of regs other than regs.dbg_regs is >> the kernel actually looking at then for NT_ARM_HW_WATCH/NT_ARM_HW_BREAK, >> given regs.dbg_regs _is_ initialized: > > The dbg_info field is probably the important one, Thanks. That's plausible: struct user_hwdebug_state { __u32 dbg_info; __u32 pad; struct { __u64 addr; __u32 ctrl; __u32 pad; } dbg_regs[16]; }; Made me wonder whether we shouldn't actually be writing to dbg_info the number of slots we're actually putting in dbg_regs ored with AARCH64_DEBUG_ARCH_V8, but it sounds like the kernel might now be checking for '0' explicitly, which could be equivalent to assuming AARCH64_DEBUG_ARCH_V8 in the future. (I encourage you to think about this a little, if you haven't yet.) > >> for (i = 0; i < count; i++) >> { >> regs.dbg_regs[i].addr = addr[i]; >> regs.dbg_regs[i].ctrl = ctrl[i]; >> } >> >> if (ptrace (PTRACE_SETREGSET, tid, >> watchpoint ? NT_ARM_HW_WATCH : NT_ARM_HW_BREAK, >> (void *) &iov)) >> >> Makes me wonder whether the issue is that "count" isn't right for >> the running kernel. >> >> Was a patch for gdbserver ever posted/committed? AFAICS, >> gdbserver's aarch64_linux_set_debug_regs is an exact copy of gdb's. > > I posted a patch for that here: > > https://sourceware.org/ml/gdb-patches/2013-09/msg00381.html Thanks. I replied to that thread. -- Pedro Alves