Skip to contentSkip to conversation

qemu-system-sparc singlestep not work in gdbstub

Qemu-devel Vitaliy 3 participants 4 messages Jun 22, 2010 – Mar 12, 2017

lore
Share & tools
lore

Vitaliy

author
#0 lore raw

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

Signature · 76 lines
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 {
==========================
#1 lore raw

Triaging old bug reports ... Can you still reproduce this problem with the latest version of QEMU?

** Changed in: qemu
Status: New => Incomplete

Signature · 82 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/597362

Title:
  qemu-system-sparc singlestep not work in gdbstub

Status in QEMU:
  Incomplete

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/597362/+subscriptions
#2 lore raw
In reply to Vitaliy

[Expired for QEMU because there has been no activity for 60 days.]

** Changed in: qemu
Status: Incomplete => Expired

Signature · 82 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/597362

Title:
  qemu-system-sparc singlestep not work in gdbstub

Status in QEMU:
  Expired

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/597362/+subscriptions
#3 lore raw
In reply to Vitaliy

I'm sure this has been fixed years ago (and qemu-system-sparc single- step seems fine in local tests) so I'm marking this as "Fix released".

** Changed in: qemu
Status: Expired => Fix Released

Signature · 82 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/597362

Title:
  qemu-system-sparc singlestep not work in gdbstub

Status in QEMU:
  Fix Released

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/597362/+subscriptions