void qemu_thread_get_self(QemuThread *thread);
bool qemu_thread_is_self(QemuThread *thread);
void qemu_thread_exit(void *retval);
+void qemu_thread_naming(bool enable);
#endif
ETEXI
DEF("name", HAS_ARG, QEMU_OPTION_name,
- "-name string1[,process=string2]\n"
+ "-name string1[,process=string2][,debug-threads=on|off]\n"
" set the name of the guest\n"
- " string1 sets the window title and string2 the process name (on Linux)\n",
+ " string1 sets the window title and string2 the process name (on Linux)\n"
+ " When debug-threads is enabled, individual threads are given a separate name (on Linux)\n"
+ " NOTE: The thread names are for debugging and not a stable API.\n",
QEMU_ARCH_ALL)
STEXI
@item -name @var{name}
This name will be displayed in the SDL window caption.
The @var{name} will also be used for the VNC server.
Also optionally set the top visible process name in Linux.
+Naming of individual threads can also be enabled on Linux to aid debugging.
ETEXI
DEF("uuid", HAS_ARG, QEMU_OPTION_uuid,
#include "qemu/thread.h"
#include "qemu/atomic.h"
+static bool name_threads;
+
+void qemu_thread_naming(bool enable)
+{
+ name_threads = enable;
+}
+
static void error_exit(int err, const char *msg)
{
fprintf(stderr, "qemu: %s: %s\n", msg, strerror(err));
#include <assert.h>
#include <limits.h>
+static bool name_threads;
+
+void qemu_thread_naming(bool enable)
+{
+ /* But note we don't actually name them on Windows yet */
+ name_threads = enable;
+}
+
static void error_exit(int err, const char *msg)
{
char *pstr;
.name = "process",
.type = QEMU_OPT_STRING,
.help = "Sets the name of the QEMU process, as shown in top etc",
+ }, {
+ .name = "debug-threads",
+ .type = QEMU_OPT_BOOL,
+ .help = "When enabled, name the individual threads; defaults off.\n"
+ "NOTE: The thread names are for debugging and not a\n"
+ "stable API.",
},
{ /* End of list */ }
},
{
const char *proc_name;
+ if (qemu_opt_get(opts, "debug-threads")) {
+ qemu_thread_naming(qemu_opt_get_bool(opts, "debug-threads", false));
+ }
qemu_name = qemu_opt_get(opts, "guest");
proc_name = qemu_opt_get(opts, "process");