[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH V1 12/32] vl: pause option
From: |
Steven Sistare |
Subject: |
Re: [PATCH V1 12/32] vl: pause option |
Date: |
Fri, 31 Jul 2020 11:18:35 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 7/31/2020 6:07 AM, Daniel P. Berrangé wrote:
> On Thu, Jul 30, 2020 at 02:11:19PM -0400, Steven Sistare wrote:
>> 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.
>
> A "sleep" is a pretty crude & unreliable way to get into debugging
> though. It is racy for a start, but also QEMU has a bunch of stuff
> that runs via ELF constructors before main() even starts.
>
> So I feel like the thing that starts QEMU is better placed to provide
> a way in for debugging.
>
> eg the service launcher can send SIGSTOP to the child process immediately
> before the execve(qemu) call.
>
> Now user can attach with the debugger, allow execution to continue,
> and has ability to debug *everything* right from the ELF constructors
> onwards into main() and all that follows.
>
> Regards,
> Daniel
That is a nice solution for the launchers we can modify.
We could use your idea in place of the sleep in main,
kill(getpid(), SIGSTOP);
Not quite as good as being able to debug the elf constructors, but still
helpful.
- Steve
- Re: [PATCH V1 03/32] savevm: QMP command for cprsave, (continued)
- [PATCH V1 10/32] kvmclock: restore paused KVM clock, Steve Sistare, 2020/07/30
- [PATCH V1 01/32] savevm: add vmstate handler iterators, Steve Sistare, 2020/07/30
- [PATCH V1 08/32] savevm: HMP command for cprinfo, Steve Sistare, 2020/07/30
- [PATCH V1 06/32] savevm: HMP Command for cprload, Steve Sistare, 2020/07/30
- [PATCH V1 11/32] cpu: disable ticks when suspended, Steve Sistare, 2020/07/30
- [PATCH V1 12/32] vl: pause option, Steve Sistare, 2020/07/30
- [PATCH V1 14/32] savevm: VMS_RESTART and cprsave restart, Steve Sistare, 2020/07/30
- [PATCH V1 15/32] vl: QEMU_START_FREEZE env var, Steve Sistare, 2020/07/30
- [PATCH V1 16/32] oslib: add qemu_clr_cloexec, Steve Sistare, 2020/07/30
- [PATCH V1 17/32] util: env var helpers, Steve Sistare, 2020/07/30
- [PATCH V1 20/32] vl: add helper to request re-exec, Steve Sistare, 2020/07/30