From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55384 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OR7Sm-00042Z-H9 for qemu-devel@nongnu.org; Tue, 22 Jun 2010 13:40:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OR7Sk-0000VE-PN for qemu-devel@nongnu.org; Tue, 22 Jun 2010 13:40:44 -0400 Received: from adelie.canonical.com ([91.189.90.139]:39213) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OR7Sk-0000Uo-HM for qemu-devel@nongnu.org; Tue, 22 Jun 2010 13:40:42 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1OR7Sj-0004qd-4N for ; Tue, 22 Jun 2010 18:40:41 +0100 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 1CA5F2E8070 for ; Tue, 22 Jun 2010 18:40:41 +0100 (BST) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 22 Jun 2010 17:31:59 -0000 From: Vitaliy Sender: bounces@canonical.com References: <20100622173200.15537.61592.malonedeb@gandwana.canonical.com> Message-Id: <20100622173200.15537.61592.malonedeb@gandwana.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 597362] [NEW] qemu-system-sparc singlestep not work in gdbstub Reply-To: Bug 597362 <597362@bugs.launchpad.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Public bug reported: Debugging with gdb-stub does not work with qemu-system-sparc target Qemu compiled from current git tree. execution string: qemu-system-sparc.exe -s -S -m 256 -L Bios -hda sparc.img -boot c connect with telnet localhost 1234 enter '$s#73' (without quotes, this is single step command to gdb stub) gdb stub reply '+' (without quotes, as it accept command) After this qemu continuously execute instructions in single step mode and does not exit to gdb stub after each executed instruction with interrupt signal ("T%02xthread:%02x;" /gdb_vm_state_change in gdbstub.c/ ); If we look at target-sparc/translate.c, we can see that gen_helper_debug() is not called in single step mode: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if ((pc & TARGET_PAGE_MASK) =3D=3D (tb->pc & TARGET_PAGE_MASK) && (npc & TARGET_PAGE_MASK) =3D=3D (tb->pc & TARGET_PAGE_MASK) && !s->singlestep) { /* jump to same page: we can use a direct jump */ tcg_gen_goto_tb(tb_num); tcg_gen_movi_tl(cpu_pc, pc); tcg_gen_movi_tl(cpu_npc, npc); tcg_gen_exit_tb((long)tb + tb_num); } else { /* jump to another page: currently not optimized */ tcg_gen_movi_tl(cpu_pc, pc); tcg_gen_movi_tl(cpu_npc, npc); tcg_gen_exit_tb(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D /* if single step mode, we generate only one instruction and generate an exception */ if (dc->singlestep) { break; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D If we look similar code at target-sh4/translate.c we can see that is called in this cases: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if ((tb->pc & TARGET_PAGE_MASK) =3D=3D (dest & TARGET_PAGE_MASK) && !ctx->singlestep_enabled) { /* Use a direct jump if in same page and singlestep not enabled */ tcg_gen_goto_tb(n); tcg_gen_movi_i32(cpu_pc, dest); tcg_gen_exit_tb((long) tb + n); } else { tcg_gen_movi_i32(cpu_pc, dest); if (ctx->singlestep_enabled) gen_helper_debug(); tcg_gen_exit_tb(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if (tb->cflags & CF_LAST_IO) gen_io_end(); if (env->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(); } else { =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D ** Affects: qemu Importance: Undecided Status: New -- = qemu-system-sparc singlestep not work in gdbstub https://bugs.launchpad.net/bugs/597362 You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. Status in QEMU: New Bug description: Debugging with gdb-stub does not work with qemu-system-sparc target Qemu compiled from current git tree. execution string: qemu-system-sparc.exe -s -S -m 256 -L Bios -hda sparc.img -boot c connect with telnet localhost 1234 enter '$s#73' (without quotes, this is single step command to gdb stub) gdb stub reply '+' (without quotes, as it accept command) After this qemu continuously execute instructions in single step mode and does not exit to gdb stub after each executed instruction with interrupt signal ("T%02xthread:%02x;" /gdb_vm_state_change in gdbstub.c/ ); If we look at target-sparc/translate.c, we can see that gen_helper_debug() is not called in single step mode: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if ((pc & TARGET_PAGE_MASK) =3D=3D (tb->pc & TARGET_PAGE_MASK) && (npc & TARGET_PAGE_MASK) =3D=3D (tb->pc & TARGET_PAGE_MASK) && !s->singlestep) { /* jump to same page: we can use a direct jump */ tcg_gen_goto_tb(tb_num); tcg_gen_movi_tl(cpu_pc, pc); tcg_gen_movi_tl(cpu_npc, npc); tcg_gen_exit_tb((long)tb + tb_num); } else { /* jump to another page: currently not optimized */ tcg_gen_movi_tl(cpu_pc, pc); tcg_gen_movi_tl(cpu_npc, npc); tcg_gen_exit_tb(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D /* if single step mode, we generate only one instruction and generate an exception */ if (dc->singlestep) { break; } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D If we look similar code at target-sh4/translate.c we can see that is called in this cases: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if ((tb->pc & TARGET_PAGE_MASK) =3D=3D (dest & TARGET_PAGE_MASK) && !ctx->singlestep_enabled) { /* Use a direct jump if in same page and singlestep not enabled */ tcg_gen_goto_tb(n); tcg_gen_movi_i32(cpu_pc, dest); tcg_gen_exit_tb((long) tb + n); } else { tcg_gen_movi_i32(cpu_pc, dest); if (ctx->singlestep_enabled) gen_helper_debug(); tcg_gen_exit_tb(0); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D if (tb->cflags & CF_LAST_IO) gen_io_end(); if (env->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(); } else { =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D