From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfRP4-0003F5-5T for qemu-devel@nongnu.org; Fri, 25 Sep 2015 07:43:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfROz-0006fp-2u for qemu-devel@nongnu.org; Fri, 25 Sep 2015 07:43:02 -0400 Received: from mail-la0-x233.google.com ([2a00:1450:4010:c03::233]:36620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfROy-0006ey-RZ for qemu-devel@nongnu.org; Fri, 25 Sep 2015 07:42:57 -0400 Received: by laclj5 with SMTP id lj5so113659lac.3 for ; Fri, 25 Sep 2015 04:42:56 -0700 (PDT) References: <1442227888-11467-1-git-send-email-serge.fdrv@gmail.com> <55FC1A8E.1070401@gmail.com> <5605312E.5020908@gmail.com> From: Sergey Fedorov Message-ID: <5605333E.80900@gmail.com> Date: Fri, 25 Sep 2015 14:42:54 +0300 MIME-Version: 1.0 In-Reply-To: <5605312E.5020908@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-arm: fix CPU breakpoint handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers On 25.09.2015 14:34, Sergey Fedorov wrote: > On 18.09.2015 17:07, Sergey Fedorov wrote: >> On 18.09.2015 16:50, Peter Maydell wrote: >>> On 14 September 2015 at 11:51, Sergey Fedorov wrote: >>> @@ -904,7 +913,16 @@ void arm_debug_excp_handler(CPUState *cs) >>> arm_debug_target_el(env)); >>> } >>> } else { >>> - if (check_breakpoints(cpu)) { >>> + CPUBreakpoint *bp; >>> + uint64_t pc = is_a64(env) ? env->pc : env->regs[15]; >>> + >>> + QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { >>> + if (bp->pc == pc && !(bp->flags & BP_CPU)) { >>> + return; >>> + } >>> + } >>> This extra code looks right, but isn't it fixing a different bug? >> You are right, it would better come to separate patch. > Actually, I can't think of it as a separate patch. This change is really > required only if we remove check_breakpoints() here. Otherwise > check_breakpoints() calls bp_wp_matches() which do the necessary check. > ...but considering the order of breakpoint enumeration it is not so simple. The difference is when we have GDB and CPU breakpoint to the same address. In this case check_breakpoints() returns true, but we should handle GDB breakpoints first. Sorry for my misunderstanding, I will split this patch as you suggested. Best regards, Sergey