Skip to contentSkip to conversation

m68k gdb has stopped single stepping correctly

Qemu-devel Lucien Anti-Spam 5 participants 7 messages Jan 23, 2019 – Feb 21, 2019 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi folks,
I noticed that with 3.x release that the GDB options (-S -s) for certain CPU results in very weird stepping.Usually stops afer a few steps, whilst the stub continues responding the PC doesnt update, however, I have only deeply looked at the m68k. In the case of the m68K the SR gets the trace bit set (T=10b), and the PC doesnt update.The m68k gdbstub, and main gdbstub seem mostly unchanged.But it seems the INSN handling has changed greatly for the m68k. Does anyone have any ideas what happened?
Cheers,Luc

#2 lore raw
Quoted 4 lines · Lucien Anti-Spam via Qemu-devel

Hi folks,
I noticed that with 3.x release that the GDB options (-S -s) for certain CPU results in very weird stepping.Usually stops afer a few steps, whilst the stub continues responding the PC doesnt update, however, I have only deeply looked at the m68k. In the case of the m68K the SR gets the trace bit set (T=10b), and the PC doesnt update.The m68k gdbstub, and main gdbstub seem mostly unchanged.But it seems the INSN handling has changed greatly for the m68k. Does anyone have any ideas what happened?

Can you please bisect to find at which point things start misbehaving?

Thanks,

Emilio

#3 lore raw
Quoted 9 lines

On Thursday, January 24, 2019, 3:08:07 AM GMT+9, Emilio G. Cota <[email protected]> wrote: > > On Wed, Jan 23, 2019 at 15:58:27 +0000, Lucien Anti-Spam via Qemu-devel wrote:> > Hi folks,

Quoted 3 lines

I noticed that with 3.x release that the GDB options (-S -s) for certain CPU results in very weird stepping.Usually stops afer a few steps, whilst the stub continues responding the PC doesnt update, however, I have only deeply looked at the m68k. In the case of the m68K the SR gets the trace bit set (T=10b), and the PC doesnt update.The m68k gdbstub, and main gdbstub seem mostly unchanged.But it seems the INSN handling has changed greatly for the m68k. Does anyone have any ideas what happened?>> Can you please bisect to find at which point things start misbehaving?


Thanks,
  Emilio

Understood, I was hoping my original post might jog someone's memory about the issue.
Apparently not, so after some digging I found that it was introduced with the refactor to TranslatorOps, specifically two lines got dropped that update the PC if single-stepping is being performed ( commit 11ab74b01e0a8ea4973eed89c6b90fa6e4fb9fb6 ) Since its not valid to revert, shall I go ahead and submit a patch for these two lines?
Also I noticed a lack of gdb-stub tests, but there are cpu tests (eg. check-qtest-m68k).  I was considering it might be interesting to write some basic network code to send / receive gdb packets to re-use these cpu tests for step, break-point, register update, and so on. I saw a gdb-python test but I felt this would need specific kernel \ gdb for each cpu with is likely to end in a lot of problems getting right gdbs - simple packet send/receive/check would be better?
What do people think, what would be the right approach to this?

Cheers,Luc

#4 lore raw
Quoted 7 lines · Lucien Anti-Spam via Qemu-devel
Quoted 7 lines

On Thursday, January 24, 2019, 3:08:07 AM GMT+9, Emilio G. Cota <[email protected]> wrote: > > On Wed, Jan 23, 2019 at 15:58:27 +0000, Lucien Anti-Spam via Qemu-devel wrote:> > Hi folks,

Quoted 3 lines

I noticed that with 3.x release that the GDB options (-S -s) for certain CPU results in very weird stepping.Usually stops afer a few steps, whilst the stub continues responding the PC doesnt update, however, I have only deeply looked at the m68k. In the case of the m68K the SR gets the trace bit set (T=10b), and the PC doesnt update.The m68k gdbstub, and main gdbstub seem mostly unchanged.But it seems the INSN handling has changed greatly for the m68k. Does anyone have any ideas what happened?>> Can you please bisect to find at which point things start misbehaving?

Quoted 6 lines
Quoted 2 lines

Thanks,
Emilio

Understood, I was hoping my original post might jog someone's memory about the issue.
Apparently not, so after some digging I found that it was introduced with the refactor to TranslatorOps, specifically two lines got dropped that update the PC if single-stepping is being performed ( commit 11ab74b01e0a8ea4973eed89c6b90fa6e4fb9fb6 ) Since its not valid to revert, shall I go ahead and submit a patch for
these two lines?

Yes please!

Quoted 4 lines

Also I noticed a lack of gdb-stub tests, but there are cpu tests (eg. check-qtest-m68k). I was considering it might be interesting to write some basic network code to send / receive gdb packets to re-use these cpu tests for step, break-point, register update, and so on. I saw a gdb-python test but I felt this would need specific kernel \
gdb for each cpu with is likely to end in a lot of problems getting
right gdbs - simple packet send/receive/check would be better?

The gdb-python test works should work with pretty much any kernel image but is currently only run manually. It only really sets breakpoints at common points in the kernel and doesn't need a rootfs to complete.

So it's useful for bisecting but it would be nice to have proper integrated tests. I basically submitted it so it wouldn't just languish in my own magic directory of random tests.

Quoted 1 line

What do people think, what would be the right approach to this?

Once thing we have now is tests/tcg and the infrastructure for building foreign binaries on most developer systems. We can certainly leverage those to have a nice test binary which we can use to exercise gdbstub for linux-user debugging with the appropriate wrapping of gdb and launching a guest.

There is also a WIP series I posted:

Subject: [RFC PATCH 00/13] Enabling tcg/tests for xtensa, mips and cris
Date: Mon, 10 Dec 2018 15:28:16 +0000
Message-Id: <[email protected]>

Which makes the tests/tcg infrastructure aware of softmmu targets (used for system emulation). We could certainly build a mini-stub of an OS using this to exercise the system gdbstub. You could just use the existing binaries we use for migration testing although it would be nice to have them in source form as well.

You might want to look at the avocado tests - they may be better suited for coordinating several binaries talking to each other (although the existing qtest tests do do something similar).

Quoted 4 lines

Cheers,Luc

--
Alex Bennée

#7 lore raw
In reply to Lucien Anti-Spam
Quoted 24 lines · Lucien Anti-Spam
Quoted 3 lines

On Thursday, January 24, 2019, 3:08:07 AM GMT+9, Emilio G. Cota

Quoted 1 line · <[email protected]> wrote:
Quoted 1 line

On Wed, Jan 23, 2019 at 15:58:27 +0000, Lucien Anti-Spam via

Quoted 2 lines · Qemu-devel
Quoted 2 lines

Hi folks,
I noticed that with 3.x release that the GDB options (-S -s) for

certain CPU results in very weird stepping.Usually stops afer a few steps, whilst the stub continues responding the PC doesnt update, however, I have only deeply looked at the m68k.

Quoted 1 line
Quoted 1 line

In the case of the m68K the SR gets the trace bit set (T=10b), and

the PC doesnt update.The m68k gdbstub, and main gdbstub seem mostly unchanged.But it seems the INSN handling has changed greatly for the m68k.

Quoted 6 lines
Quoted 1 line

Does anyone have any ideas what happened?

Can you please bisect to find at which point things start misbehaving?
Thanks,
  Emilio

Understood, I was hoping my original post might jog someone's memory about the issue.

Quoted 7 lines

Apparently not, so after some digging I found that it was introduced with the refactor to TranslatorOps, specifically two lines got dropped that update the PC if single-stepping is being performed ( commit 11ab74b01e0a8ea4973eed89c6b90fa6e4fb9fb6 )

Since its not valid to revert, shall I go ahead and submit a patch for these two lines?

It seems to me to be a good solution, but CC'ing Richard for that.

Thanks,
Laurent

#5 lore raw
In reply to Alex Bennée
Quoted 8 lines · Alex Bennée
Quoted 5 lines · Lucien Anti-Spam via Qemu-devel
Quoted 5 lines

On Thursday, January 24, 2019, 3:08:07 AM GMT+9, Emilio G. Cota <[email protected]> wrote: > > On Wed, Jan 23, 2019 at 15:58:27 +0000, Lucien Anti-Spam via Qemu-devel wrote:> > Hi folks,

Quoted 3 lines

I noticed that with 3.x release that the GDB options (-S -s) for certain CPU results in very weird stepping.Usually stops afer a few steps, whilst the stub continues responding the PC doesnt update, however, I have only deeply looked at the m68k. In the case of the m68K the SR gets the trace bit set (T=10b), and the PC doesnt update.The m68k gdbstub, and main gdbstub seem mostly unchanged.But it seems the INSN handling has changed greatly for the m68k. Does anyone have any ideas what happened?>> Can you please bisect to find at which point things start misbehaving?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Thanks,
Emilio

Understood, I was hoping my original post might jog someone's memory about the issue.
Apparently not, so after some digging I found that it was introduced with the refactor to TranslatorOps, specifically two lines got dropped that update the PC if single-stepping is being performed ( commit 11ab74b01e0a8ea4973eed89c6b90fa6e4fb9fb6 ) Since its not valid to revert, shall I go ahead and submit a patch for
these two lines?

Yes please!

Hi Lucien,

did you ever sent the patch? I can't find it on the mailing list, and I think this bug is still pending?

Thomas

#6 lore raw

Hi Thomas,

Quoted 1 line

 did you ever sent the patch? I can't find it on the mailing list, and I think this bug is still pending?Yes, I have patches but was waiting for my first one to be successful in order to make sure I got the process down.  I will finish that shortly.

CheersLuc

Quoted 8 lines · Alex Bennée
Quoted 5 lines · Lucien Anti-Spam via Qemu-devel

    > On Thursday, January 24, 2019, 3:08:07 AM GMT+9, Emilio G. Cota <[email protected]> wrote: > > On Wed, Jan 23, 2019 at 15:58:27 +0000, Lucien Anti-Spam via Qemu-devel wrote:> > Hi folks,

Quoted 4 lines
Quoted 3 lines

I noticed that with 3.x release that the GDB options (-S -s) for certain CPU results in very weird stepping.Usually stops afer a few steps, whilst the stub continues responding the PC doesnt update, however, I have only deeply looked at the m68k. In the case of the m68K the SR gets the trace bit set (T=10b), and the PC doesnt update.The m68k gdbstub, and main gdbstub seem mostly unchanged.But it seems the INSN handling has changed greatly for the m68k. Does anyone have any ideas what happened?>> Can you please bisect to find at which point things start misbehaving?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Thanks,
  Emilio

Understood, I was hoping my original post might jog someone's memory about the issue.
Apparently not, so after some digging I found that it was introduced with the refactor to TranslatorOps, specifically two lines got dropped that update the PC if single-stepping is being performed ( commit 11ab74b01e0a8ea4973eed89c6b90fa6e4fb9fb6 ) Since its not valid to revert, shall I go ahead and submit a patch for
these two lines?

Yes please!

Hi Lucien,

did you ever sent the patch? I can't find it on the mailing list, and I think this bug is still pending?

Thomas