[FIX] MSG_PROCESS_INFO: zero low_address and high_address
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 4 Sep 2013 12:22:20 +0000 (16:22 +0400)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 5 Sep 2013 10:55:54 +0000 (10:55 +0000)
- derefence symbolic link for exec path
- try to derefence <path>.exe then try <path>

Change-Id: If16490f743cec05083ec827aa3b797d7b39abeda
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
daemon/process_info.c
daemon/utils.c
daemon/utils.h

index cacd22d..c007e77 100644 (file)
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include "da_protocol.h"
 #include "da_data.h"
+#include "utils.h"
 #include "elf.h"
 #include "debug.h"
 
@@ -59,12 +60,13 @@ void write_process_info(int pid, uint64_t starttime)
        int fields;
        FILE *f;
 
+       // TODO need check this result and return error
+       dereference_tizen_exe_path(prof_session.app_info.exe_path, path);
        get_build_dir(binary_path, prof_session.app_info.exe_path);
 
        fill_data_msg_head(msg, NMSG_PROCESS_INFO, 0, 0);
 
-       sprintf(buf, "%s%d%s%s", AWK_START, pid, AWK_END_PROCESS,
-               prof_session.app_info.exe_path);
+       sprintf(buf, "%s%d%s%s", AWK_START, pid, AWK_END_PROCESS,path);
 
        f = popen(buf, "r");
        if (!f) {
@@ -77,6 +79,7 @@ void write_process_info(int pid, uint64_t starttime)
        if (fields != 3) {
                start = 0;
                end = 0;
+               LOGW("cannot find start-end values. fields=%d\n", fields);
        }
        pclose(f);
 
index c52ad6e..107458a 100644 (file)
@@ -714,3 +714,18 @@ int is_same_app_process(char* appPath, int pid)
        return ret;
 }
 
+char *dereference_tizen_exe_path(const char *path, char *resolved)
+{
+       char *res = NULL;
+       char tmp_path[PATH_MAX];
+
+       resolved[0] = 0;
+       //try resolve <path>.exe
+       sprintf(tmp_path, "%s.exe", path);
+       if ((res = realpath(tmp_path, resolved)) == NULL) {
+               //try to resolve path <path>
+               res = realpath(path, resolved);
+       }
+
+       return res;
+}
index eb0a371..ce4a9da 100644 (file)
@@ -74,6 +74,7 @@ int is_same_app_process(char* appPath, int pid);
 
 int exec_app_tizen(const char *app_id, const char *exec_path);
 int exec_app_common(const char* exec_path);
+char *dereference_tizen_exe_path(const char *path, char *resolved);
 #ifdef __cplusplus
 }
 #endif