From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuJcN-0005OP-NN for qemu-devel@nongnu.org; Thu, 05 Nov 2015 07:26:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuJcI-0006Es-LJ for qemu-devel@nongnu.org; Thu, 05 Nov 2015 07:26:15 -0500 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:36636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuJcI-0006Ef-Eu for qemu-devel@nongnu.org; Thu, 05 Nov 2015 07:26:10 -0500 Received: by lfs39 with SMTP id 39so26788134lfs.3 for ; Thu, 05 Nov 2015 04:26:09 -0800 (PST) From: Sergey Fedorov Date: Thu, 5 Nov 2015 15:26:01 +0300 Message-Id: <1446726361-18328-1-git-send-email-serge.fdrv@gmail.com> Subject: [Qemu-devel] [PATCH v2] target-arm: Fix non-CPU breakpoint handling in arm_debug_excp_handler() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Sergey Fedorov , Peter Maydell Do not raise a CPU exception if no CPU breakpoint has fired, since singlestep is also done by generating a debug internal exception. This fixes a bug with singlestepping in gdbstub. Signed-off-by: Sergey Fedorov --- This is a v2 of 'target-arm: Fix arm_debug_excp_handler() for singlestep enabled.' Changes in v2: * Commit subject and body changed * Instead of checking for singlestep enabled, CPU breakpoint match checked target-arm/op_helper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index b5db345..6cd54c8 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -917,7 +917,13 @@ 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)) { + /* (1) GDB breakpoints should be handled first. + * (2) Do not raise a CPU exception if no CPU breakpoint has fired, + * since singlestep is also done by generating a debug internal + * exception. + */ + if (cpu_breakpoint_test(cs, pc, BP_GDB) + || !cpu_breakpoint_test(cs, pc, BP_CPU)) { return; } -- 1.9.1