R. Diez <[email protected]> writes:
> Hi all: > > I want to press a key and have my editor automatically launch Qemu and > GDB. Like you do from within an IDE when writing PC software. How do I > synchronise Qemu and GDB? > > In case the question is not clear enough, here are the steps: > > 1) Start Qemu. > 2) Wait until Qemu is ready to accept a GDB connection. > 3) Start GDB in a new window. > > The problem is step (2). I can launch Qemu in the background, pause > for some time, and then launch GDB. However, if I make the pause too > short, GDB will fail to connect, and if I make the pause too long, I > will waste the user's time. If you launch linux-user with -g 1234 or system emulation with the -S flag the guest starts suspended until gdb attaches and continues the target. > Besides, depending on the current system load, Qemu will sometimes need a > longer time to start. For example, the first time, when the disk cache is > cold. > > I had a similar issue with OpenOCD and GDB. But OpenOCD accepts > scripting commands, so I told it to write to a FIFO after > initialising. The top-level script just needs to wait on the FIFO. > > Alas, I have not seen a way to do that with Qemu yet. Can I somehow > tell Qemu to run a command when the virtual machine is ready to accept > a GDB connection? The gdbstub should be ready pretty early on in start-up. We now have a script in tests/guest-debug/run-test.py which we use to run our own test cases. > > Thanks in advance, > rdiez -- Alex Bennée
