From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31516 invoked by alias); 13 May 2013 06:29:02 -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 31506 invoked by uid 89); 13 May 2013 06:29:02 -0000 X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from e24smtp05.br.ibm.com (HELO e24smtp05.br.ibm.com) (32.104.18.26) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 13 May 2013 06:29:01 +0000 Received: from /spool/local by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 May 2013 03:28:57 -0300 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 13 May 2013 03:28:54 -0300 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.13.184.26]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 705C21DC004E for ; Mon, 13 May 2013 02:28:53 -0400 (EDT) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay02.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4D6Rk9K42336390 for ; Mon, 13 May 2013 03:27:46 -0300 Received: from d24av05.br.ibm.com (loopback [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4D6SqxA021197 for ; Mon, 13 May 2013 03:28:52 -0300 Received: from grandaddy.ibm.com ([9.8.0.182]) by d24av05.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r4D6SqhC021015; Mon, 13 May 2013 03:28:52 -0300 From: Edjunior Barbosa Machado To: gdb-patches@sourceware.org Cc: Ulrich Weigand Subject: [PATCH] Fix hardware watchpoints on PowerPC servers Date: Mon, 13 May 2013 06:29:00 -0000 Message-Id: <1368426484-32623-1-git-send-email-emachado@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13051306-2362-0000-0000-00000A923492 X-SW-Source: 2013-05/txt/msg00422.txt.bz2 Hi, initially developed only for bookE (embedded processors), the new ptrace interface is now available for Power server processors too [1]. This patch fixes the insertion of hardware watchpoints on Power servers using this new interface available on kernel 3.7 and newer (currently, the region should be aligned to 8 bytes, which is also the max length). It reduces the number of unexpected failures in gdb testsuite in 40 failures (ppc64 running kernel 3.8). Thanks and regards, -- Edjunior. [1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/powerpc/kernel/ptrace.c?id=6c7a2856ade6a58c20038024247d16a12a8d2323 gdb/ChangeLog 2013-05-12 Edjunior Machado * ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): Check if the region is ok for a hardware watchpoint using the new ptrace interface on Power servers. --- gdb/ppc-linux-nat.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 280dcbe..1ff00a6 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -1503,16 +1503,19 @@ ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) to determine the hardcoded watchable region for watchpoints. */ if (have_ptrace_booke_interface ()) { - /* DAC-based processors (i.e., embedded processors), like the PowerPC 440 - have ranged watchpoints and can watch any access within an arbitrary - memory region. This is useful to watch arrays and structs, for - instance. It takes two hardware watchpoints though. */ + /* Embedded DAC-based processors, like the PowerPC 440 have ranged + watchpoints and can watch any access within an arbitrary memory + region. This is useful to watch arrays and structs, for instance. It + takes two hardware watchpoints though. */ if (len > 1 - && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE) + && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE + && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE) return 2; - else if (booke_debug_info.data_bp_alignment - && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1)) - + booke_debug_info.data_bp_alignment)) + /* Server processors provide one hardware watchpoint and addr+len should + fall in the watchable region provided by the ptrace interface. */ + if (booke_debug_info.data_bp_alignment + && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1)) + + booke_debug_info.data_bp_alignment)) return 0; } /* addr+len must fall in the 8 byte watchable region for DABR-based -- 1.7.1