[evolution-data-server] [camel-debug] Add thread-safety around dwarf address resolution code



commit 3a717b7becd3b05b058cf527a95209201e291cef
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 28 18:29:38 2016 +0100

    [camel-debug] Add thread-safety around dwarf address resolution code

 camel/camel-debug.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-debug.c b/camel/camel-debug.c
index aa03190..ddce44e 100644
--- a/camel/camel-debug.c
+++ b/camel/camel-debug.c
@@ -487,6 +487,7 @@ addr_lookup (gpointer addr,
 #ifdef HAVE_ELFUTILS_LIBDWFL
        Dwfl *dwfl = dwfl_get (FALSE);
        struct getmodules_callback_arg arg;
+       static GMutex mutex;
 
        if (!dwfl)
                return NULL;
@@ -496,6 +497,8 @@ addr_lookup (gpointer addr,
        arg.file_path = NULL;
        arg.lineno = -1;
 
+       g_mutex_lock (&mutex);
+
        dwfl_getmodules (dwfl, getmodules_callback, &arg, 0);
 
        if (!arg.func_name && fallback && strstr (fallback, "/lib") != fallback && strstr (fallback, 
"/usr/lib") != fallback) {
@@ -504,6 +507,8 @@ addr_lookup (gpointer addr,
                        dwfl_getmodules (dwfl, getmodules_callback, &arg, 0);
        }
 
+       g_mutex_unlock (&mutex);
+
        *file_path = arg.file_path;
        *lineno = arg.lineno;
 


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