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

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



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 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");
     }
+    if (virBufferCheckError(&name_opts) < 0)
+        goto error;
+    virCommandAddArg(cmd, virBufferContentAndReset(&name_opts));
 
     if (!standalone)
         virCommandAddArg(cmd, "-S"); /* freeze CPU */
-- 
2.5.0


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