From ba59fb778ec68b072196cff9af11c7612a6e52f2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Jun 2018 14:23:08 +0200 Subject: QemuMutex: support --enable-debug-mutex We have had some tracing tools for mutex but it's not easy to use them for e.g. dead locks. Let's provide "--enable-debug-mutex" parameter when configure to allow QemuMutex to store the last owner that took specific lock. It will be easy to use this tool to debug deadlocks since we can directly know who took the lock then as long as we can have a debugger attached to the process. Reviewed-by: Emilio G. Cota Signed-off-by: Peter Xu Message-Id: <20180425025459.5258-4-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/thread-posix.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/qemu/thread-posix.h') diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index f3f47e426f..fd27b34128 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -12,6 +12,10 @@ typedef QemuMutex QemuRecMutex; struct QemuMutex { pthread_mutex_t lock; +#ifdef CONFIG_DEBUG_MUTEX + const char *file; + int line; +#endif bool initialized; }; -- cgit 1.4.1