Add the information of symbol name at dying message for debugging 31/149831/5 submit/tizen/20170914.071659
authorYoungHun Kim <yh8004.kim@samsung.com>
Wed, 13 Sep 2017 07:40:57 +0000 (16:40 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Thu, 14 Sep 2017 06:24:12 +0000 (15:24 +0900)
Change-Id: I1590dac97139df69ab6fc5ac278e6e2d2acd051a

packaging/mused.spec
server/src/muse_server_log.c
server/src/muse_server_signal.c

index dee374a..7f687a7 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A multimedia daemon
-Version:    0.3.7
+Version:    0.3.8
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 9a93045..44b4919 100644 (file)
@@ -279,7 +279,7 @@ static int _muse_server_log_fd_set_block(int fd)
 
 static int _muse_server_log_open_work(const char *path)
 {
-       return open(path, O_CREAT | O_APPEND | O_WRONLY | O_NONBLOCK, 0666);
+       return open(path, O_CREAT | O_APPEND | O_WRONLY | O_NONBLOCK, 0644);
 }
 
 static void _muse_server_log_create_fd(void)
index e930049..900f5f4 100644 (file)
@@ -24,6 +24,7 @@
 #include "muse_server_private.h"
 #include "muse_server_signal.h"
 #include <execinfo.h>
+#include <dlfcn.h>
 
 struct sigaction muse_segv_old_action;
 struct sigaction muse_abrt_old_action;
@@ -87,6 +88,10 @@ static void _muse_server_signal_backtrace(void *arg)
        int i;
        char **strings = NULL;
        ucontext_t *uctxt = NULL;
+       Dl_info info;
+       char *str_trace = NULL;
+       char *ptr = NULL;
+       char *sym_addr = NULL;
        char err_msg[MUSE_MAX_MSG_LEN] = {'\0',};
        char client_buf[MUSE_MAX_MSG_LEN];
 
@@ -118,11 +123,25 @@ static void _muse_server_signal_backtrace(void *arg)
        } else {
                /* skip the first stack frame because it just points here. */
                for (i = 1; i < tracesize; i++) {
-                       LOGE("[%u] %s", i - 1, strings[i]);
+                       str_trace = strdup(strings[i]);
+                       if (str_trace) {
+                               sym_addr = strtok_r(str_trace, "[", &ptr);
+                               if (sym_addr)
+                                       sym_addr = strtok_r(NULL, "]", &ptr);
+                       }
+
+                       memset(&info, 0, sizeof(info));
+                       if (sym_addr && dladdr((const void *)strtoul(sym_addr, &ptr, 16), &info) && info.dli_sname)
+                               LOGE("[%u] %s %s", i - 1, strings[i], info.dli_sname);
+                       else
+                               LOGE("[%u] %s", i - 1, strings[i]);
                        if (muse_server_is_log_enabled()) {
                                snprintf(client_buf, sizeof(client_buf), "[%u] %s", i - 1, strings[i]);
                                muse_server_log_get_instance()->log_write(client_buf);
                        }
+
+                       sym_addr = NULL;
+                       MUSE_FREE(str_trace);
                }
 
                MUSE_FREE(strings);