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)
#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;
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];
} 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);