On 7/30/2020 12:20 PM, Eric Blake wrote: > On 7/30/20 10:14 AM, Steve Sistare wrote: >> Provide the -pause command-line parameter and the QEMU_PAUSE environment >> variable to briefly pause QEMU in main and allow a developer to attach gdb. >> Useful when the developer does not invoke QEMU directly, such as when using >> libvirt. > > How would you set this option with libvirt?
Add -pause in the qemu args in the xml. > It feels like you are trying to reinvent something that is already > well-documented: > > https://www.berrange.com/posts/2011/10/12/debugging-early-startup-of-kvm-with-gdb-when-launched-by-libvirtd/ Too many steps to reach BINGO for my taste. Easier is better. Also, in our shop we start qemu in other ways, such as via services. These new hooks helped me and my colleagues, and I hope others may also find them useful, but if not then we drop them. >> Usage: >> qemu -pause <seconds> >> or >> export QEMU_PAUSE=<seconds> >> >> Signed-off-by: Steve Sistare <steven.sist...@oracle.com> >> --- >> qemu-options.hx | 9 +++++++++ >> softmmu/vl.c | 15 ++++++++++++++- >> 2 files changed, 23 insertions(+), 1 deletion(-) > >> @@ -3204,6 +3211,12 @@ void qemu_init(int argc, char **argv, char **envp) >> case QEMU_OPTION_gdb: >> add_device_config(DEV_GDB, optarg); >> break; >> + case QEMU_OPTION_pause: >> + seconds = atoi(optarg); > > atoi() cannot detect overflow. You should never use it in robust parsing of > untrusted input. OK. - Steve