From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtXoR-0007Ue-Mf for qemu-devel@nongnu.org; Tue, 03 Nov 2015 04:23:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtXoQ-0003Gj-KC for qemu-devel@nongnu.org; Tue, 03 Nov 2015 04:23:31 -0500 Received: from mail-vk0-x22d.google.com ([2607:f8b0:400c:c05::22d]:35407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtXoQ-0003Ge-DZ for qemu-devel@nongnu.org; Tue, 03 Nov 2015 04:23:30 -0500 Received: by vkfw189 with SMTP id w189so5694351vkf.2 for ; Tue, 03 Nov 2015 01:23:30 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <5638781E.6040309@gmail.com> References: <1446486668-2133-1-git-send-email-serge.fdrv@gmail.com> <5638781E.6040309@gmail.com> From: Peter Maydell Date: Tue, 3 Nov 2015 09:23:10 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH] target-arm: Fix arm_debug_excp_handler() for singlestep enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov Cc: QEMU Developers On 3 November 2015 at 09:02, Sergey Fedorov wrote: > On 02.11.2015 21:28, Peter Maydell wrote: >> On 2 November 2015 at 17:51, Sergey Fedorov wrote: >>> CPU singlestep is done by generating a debug internal exception. Do not >>> raise a real CPU exception in case of singlestepping. >>> >>> Signed-off-by: Sergey Fedorov >>> --- >>> target-arm/op_helper.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c >>> index 7929c71..67d9ffb 100644 >>> --- a/target-arm/op_helper.c >>> +++ b/target-arm/op_helper.c >>> @@ -909,7 +909,7 @@ void arm_debug_excp_handler(CPUState *cs) >>> uint64_t pc = is_a64(env) ? env->pc : env->regs[15]; >>> bool same_el = (arm_debug_target_el(env) == arm_current_el(env)); >>> >>> - if (cpu_breakpoint_test(cs, pc, BP_GDB)) { >>> + if (cs->singlestep_enabled || cpu_breakpoint_test(cs, pc, BP_GDB)) { >>> return; >>> } >> So I think this will mean that if we're gdbstub-single-stepping then >> an architectural breakpoint on the insn we're stepping won't fire. >> >> Does using a test >> >> if (!cpu_breakpoint_test(cs, pc, BP_CPU)) { >> return; >> } >> >> fix the singlestep bug too? If so I think it would probably be >> preferable. > > Actually, it is supposed that gdbstub breakpoints should be handled > before CPU breakpoints. So I think we should rather do this way: > > if (cpu_breakpoint_test(cs, pc, BP_GDB) || !cpu_breakpoint_test(cs, pc, BP_CPU)) { > return; > } Yes, that sounds like the right logic. I think a comment will be helpful to explain what's going on for future readers :-) thanks -- PMM