From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zcv5I-0008OM-SP for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:48:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zcv5D-0006ZK-QY for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:48:12 -0400 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:35463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zcv5D-0006X3-IB for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:48:07 -0400 Received: by lbpo4 with SMTP id o4so24626521lbp.2 for ; Fri, 18 Sep 2015 05:48:06 -0700 (PDT) References: <1442552129-19242-1-git-send-email-rth@twiddle.net> <1442552129-19242-5-git-send-email-rth@twiddle.net> From: Sergey Fedorov Message-ID: <55FC0804.8080009@gmail.com> Date: Fri, 18 Sep 2015 15:48:04 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 04/22] target-*: Introduce and use cpu_breakpoint_test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Richard Henderson Cc: =?UTF-8?Q?Alex_Benn=c3=a9e?= , QEMU Developers , Aurelien Jarno On 18.09.2015 13:32, Peter Maydell wrote: >> +/* Return true if PC matches an installed breakpoint. */ >> > +static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask) >> > +{ >> > + CPUBreakpoint *bp; >> > + >> > + if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { >> > + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { >> > + if (bp->pc == pc && (bp->flags & mask)) { >> > + return true; >> > + } >> > + } >> > + } >> > + return false; >> > +} > This won't work with the fix for ARM breakpoints Sergey currently has > on list: http://patchwork.ozlabs.org/patch/517359/ > where we need to behave differently for "there's a GDB breakpoint > here" and "there's a CPU breakpoint here" (because the complex > conditions on the latter require us to call a helper function to > see if we need to actually generate an EXCP_DEBUG exception). > This is actually a good idea to move this boilerplate code into a single function. I think the problem can be solved by simply adding an optional parameter to get a reference to the matched breakpoint back from this function. Best regards, Sergey