seer icon indicating copy to clipboard operation
seer copied to clipboard

Time travel debugging with QEMU record/replay

Open jeras opened this issue 4 months ago • 3 comments

I am working on a simulator which would have a similar interface to QEMU record/replay functionality. Since the interfaces are similar, if I get a GUI working with QEMU, I can get my project to work too. I tried a bunch of DAP extensions for VSCode and none of them worked (and I could not get the maintainers to help). I have identified 3 major approaches to record/replay:

  • hardware trace in x86 and ARM architectures (this are supported withing GDB, so not a good fit for my project),
  • QEMU record/replay (does not rely on record/replay functionality withing GDB, instead it implements it independently),
  • RR. Now I am investigating one by one each GUI with support for RR.

QEMU interfaces with GDB over the GDB Remote Serial Protocol. When running QEMU in replay mode, the reverse step/continue is advertised by answering to the qSupported packet with ReverseStep+;ReverseContinue+;. My tool would do the same.

I did not check yet, whether GDB connected to QEMU would also advertise reverse debug functionality over the MI interface, which seems the interfaces used to connect SEER to RR.

If you wish to support QEMU record/replay functionality with SEER, I can help with working QEMU examples (Zephyr OS running on ARM/...). I also have a very good understanding of GDB RSP, but I think the MI protocol is more relevant for a GUI.

jeras avatar Aug 25 '25 11:08 jeras

I wasn't aware that QEMU has a record/replay. I'll check your link.

If you play around with Seer's RR support, please use the official 2.5 release. My "main" has RR support broken. I'm looking into that.

I did not check yet, whether GDB connected to QEMU would also advertise reverse debug functionality over the MI interface,

Over all, if you can get gdb to work with what you want, I can get Seer to work. Seer relies on gdb's mi commands. However, when gdb is missing a mi command I would like, I've written my own mi command using gdb's python framework.

If you wish to support QEMU record/replay functionality with SEER.

I do.

This all sounds interesting!

epasveer avatar Aug 25 '25 15:08 epasveer

I created a repo with instructions for compiling, running and debugging Zephyr OS with QEMU ARM simulator. You can use Zephyr or run your own application in QEMU. If you have trouble with any of the steps, ask, if I already encountered the same issue, I might be able to give you a quick solution.

https://github.com/jeras/zephyr-qemu-test-app

ARM is chosen, since it is closer to my target platform (RISC-V record/replay might not work yet in QEMU, it is not tested). Zephyr OS is chosen, since it is a good non trivial baremetal application example. Source files used in the Zephyr ELF file are also nicely displayed in GDB/Seer.

The instructions for setting up Zephyr are linked. I had not trouble with the procedure on Ubuntu 2024.04, but it does take some time and storage space.

jeras avatar Aug 25 '25 18:08 jeras

My "main" has RR support broken. I'm looking into that.

My "main" is now working with RR.

epasveer avatar Nov 17 '25 22:11 epasveer