[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automating Qemu and GDB together

From: Alex Bennée
Subject: Re: Automating Qemu and GDB together
Date: Wed, 13 May 2020 11:07:20 +0100
User-agent: mu4e 1.4.5; emacs 28.0.50

R. Diez <address@hidden> 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

> 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

> Thanks in advance,
>   rdiez

Alex Bennée

reply via email to

[Prev in Thread] Current Thread [Next in Thread]