[libvirt] [PATCH v2 2/2] qemu: enable debug threads

Jiri Denemark jdenemar at redhat.com
Thu Mar 10 18:17:47 UTC 2016


On Thu, Mar 10, 2016 at 17:12:24 +0100, Marc-André Lureau wrote:
> When debug-threads is enabled, individual threads are given a separate
> name (on Linux)
> 
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=1140121
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  src/qemu/qemu_command.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 000c29d..c730a01 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7081,6 +7081,7 @@ qemuBuildCommandLine(virConnectPtr conn,
>      virBuffer boot_buf = VIR_BUFFER_INITIALIZER;
>      char *boot_order_str = NULL, *boot_opts_str = NULL;
>      virBuffer fdc_opts = VIR_BUFFER_INITIALIZER;
> +    virBuffer name_opts = VIR_BUFFER_INITIALIZER;
>      char *fdc_opts_str = NULL;
>      int bootCD = 0, bootFloppy = 0, bootDisk = 0, bootHostdevNet = 0;
>  
> @@ -7106,13 +7107,17 @@ qemuBuildCommandLine(virConnectPtr conn,
>      virCommandAddEnvPassCommon(cmd);
>  
>      virCommandAddArg(cmd, "-name");
> +    virBufferAsprintf(&name_opts, "%s", def->name);
>      if (cfg->setProcessName &&
>          virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_PROCESS)) {
> -        virCommandAddArgFormat(cmd, "%s,process=qemu:%s",
> -                               def->name, def->name);
> -    } else {
> -        virCommandAddArg(cmd, def->name);
> +        virBufferAsprintf(&name_opts, ",process=qemu:%s", def->name);
> +    }
> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_DEBUG_THREADS)) {
> +        virBufferAddLit(&name_opts, ",debug-threads=on");
>      }

Drop {} from the if statement above; make syntax-check should have told
you so.

> +    if (virBufferCheckError(&name_opts) < 0)
> +        goto error;
> +    virCommandAddArg(cmd, virBufferContentAndReset(&name_opts));

Anyway, I think it would be nice to move all the -name ... construction
code into a dedicated qemuBuildNameCommandLine function.

Jirka




More information about the libvir-list mailing list