[PATCH v3 2/2] qemu: enable debug threads

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

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ee06479..96be9e1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5333,6 +5333,36 @@ qemuAppendKeyWrapMachineParms(virBuffer *buf, virQEMUCapsPtr qemuCaps,
 }
 
 static int
+qemuBuildNameCommandLine(virCommandPtr cmd,
+                         virQEMUDriverConfigPtr cfg,
+                         const virDomainDef *def,
+                         virQEMUCapsPtr qemuCaps)
+{
+    virBuffer buf = VIR_BUFFER_INITIALIZER;
+    char *name_args;
+
+    virCommandAddArg(cmd, "-name");
+
+    virBufferAsprintf(&buf, "%s", def->name);
+
+    if (cfg->setProcessName &&
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_PROCESS))
+        virBufferAsprintf(&buf, ",process=qemu:%s", def->name);
+
+    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_DEBUG_THREADS))
+        virBufferAddLit(&buf, ",debug-threads=on");
+
+    if (virBufferCheckError(&buf) < 0)
+        return -1;
+
+    name_args = virBufferContentAndReset(&buf);
+    virCommandAddArg(cmd, name_args);
+    VIR_FREE(name_args);
+
+    return 0;
+}
+
+static int
 qemuBuildMachineCommandLine(virCommandPtr cmd,
                             const virDomainDef *def,
                             virQEMUCapsPtr qemuCaps)
@@ -7192,14 +7222,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     virCommandAddEnvPassCommon(cmd);
 
-    virCommandAddArg(cmd, "-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);
-    }
+    if (qemuBuildNameCommandLine(cmd, cfg, def, qemuCaps) < 0)
+        goto error;
 
     if (!standalone)
         virCommandAddArg(cmd, "-S"); /* freeze CPU */
-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]