All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaliy <deathsoft@yandex.ru>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [Bug 597362] [NEW] qemu-system-sparc singlestep not work in gdbstub
Date: Tue, 22 Jun 2010 17:31:59 -0000	[thread overview]
Message-ID: <20100622173200.15537.61592.malonedeb@gandwana.canonical.com> (raw)
In-Reply-To: 20100622173200.15537.61592.malonedeb@gandwana.canonical.com

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:

========================
    if ((pc & TARGET_PAGE_MASK) == (tb->pc & TARGET_PAGE_MASK) &&
        (npc & TARGET_PAGE_MASK) == (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);
    }
=========================

========================
        /* if single step mode, we generate only one instruction and
           generate an exception */
        if (dc->singlestep) {
            break;
        }
========================

If we look similar code at target-sh4/translate.c we can see that is
called in this cases:

========================
    if ((tb->pc & TARGET_PAGE_MASK) == (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);
    }
========================

========================
    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 {
==========================

** 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:

========================
    if ((pc & TARGET_PAGE_MASK) == (tb->pc & TARGET_PAGE_MASK) &&
        (npc & TARGET_PAGE_MASK) == (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);
    }
=========================

========================
        /* if single step mode, we generate only one instruction and
           generate an exception */
        if (dc->singlestep) {
            break;
        }
========================

If we look similar code at target-sh4/translate.c we can see that is
called in this cases:

========================
    if ((tb->pc & TARGET_PAGE_MASK) == (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);
    }
========================

========================
    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 {
==========================

       reply	other threads:[~2010-06-22 17:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22 17:31 Vitaliy [this message]
2017-01-10  8:57 ` [Qemu-devel] [Bug 597362] Re: qemu-system-sparc singlestep not work in gdbstub Thomas Huth
2017-03-12  4:17 ` Launchpad Bug Tracker
2017-03-12 11:03 ` Mark Cave-Ayland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100622173200.15537.61592.malonedeb@gandwana.canonical.com \
    --to=deathsoft@yandex.ru \
    --cc=597362@bugs.launchpad.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.