[FIX] application termination 25/23425/3
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 25 Jun 2014 09:40:42 +0000 (13:40 +0400)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Thu, 26 Jun 2014 06:51:24 +0000 (23:51 -0700)
fixed application termination without ld preloaded lib destructor

Change-Id: Ib52079a73f9ff4944fcc7c40ffaf14e761cfe3fc
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
Makefile
helper/addr-capi.c [deleted file]
helper/addr-tizen.c
helper/appfw-capi.c [deleted file]
helper/libdaprobe.c
include/dahelper.h

index f8277f5..c4e7a0b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -88,8 +88,6 @@ PROBE_SRCS =                                  \
 
 DUMMY_SRCS = ./custom_chart/da_chart_dummy.c
 CAPI_SRCS =    $(COMMON_SRCS)                  \
-               ./helper/appfw-capi.c           \
-               ./helper/addr-capi.c            \
                ./probe_capi/capi_appfw.c       \
                ./probe_ui/capi_capture.c
 
diff --git a/helper/addr-capi.c b/helper/addr-capi.c
deleted file mode 100644 (file)
index 741959e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  DA probe
- *
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- *
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Woojin Jung <woojin2.jung@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- * Anastasia Lyupa <a.lyupa@samsung.com>
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Contributors:
- * - S-Core Co., Ltd
- * - Samsung RnD Institute Russia
- *
- */
-
-#include <dlfcn.h>
-#include "daprobe.h"
-#include "dahelper.h"
-
-int get_map_address(void* sym, void** start, void** end);
-
-int getExecutableMappingAddress()
-{
-       int ret = 0;
-       void* main_symbol;
-
-       probeBlockStart();
-       main_symbol = dlsym(RTLD_NEXT, "main");
-       if(main_symbol != NULL)
-       {
-               ret = get_map_address(main_symbol, &(gTraceInfo.exec_map.map_start),
-                                               &(gTraceInfo.exec_map.map_end));
-       }
-       else
-       {
-               // failed to get address of main
-               ret = 0;
-       }
-       probeBlockEnd();
-
-       return ret;
-}
-
index d791780..dabe6c5 100644 (file)
@@ -38,20 +38,18 @@ int get_map_address(void* sym, void** start, void** end);
 
 int getExecutableMappingAddress()
 {
-       int ret = 0;
-       void* main_symbol;
+       int ret = 0, i = 0;
+       void *main_symbol;
+       static const char *funcs[] = {"OspMain", "main"};
 
        probeBlockStart();
-       main_symbol = dlsym(RTLD_NEXT, "OspMain");
-       if(main_symbol != NULL)
-       {
-               ret = get_map_address(main_symbol, &(gTraceInfo.exec_map.map_start),
-                                               &(gTraceInfo.exec_map.map_end));
-       }
-       else
-       {
-               // failed to get address of OspMain
-               ret = 0;
+       for (i = 0; i < (int)(sizeof(funcs)/sizeof(funcs[0])); i++){
+               main_symbol = dlsym(RTLD_NEXT, funcs[i]);
+               if(main_symbol != NULL) {
+                       ret = get_map_address(main_symbol, &(gTraceInfo.exec_map.map_start),
+                                                       &(gTraceInfo.exec_map.map_end));
+                       break;
+               }
        }
        probeBlockEnd();
 
diff --git a/helper/appfw-capi.c b/helper/appfw-capi.c
deleted file mode 100644 (file)
index 6dfbc4f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  DA probe
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- *
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Woojin Jung <woojin2.jung@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-#include <app.h>
-#include "dahelper.h"
-
-void application_exit()
-{
-       PRINTMSG("EXIT appfw-capi");
-       app_efl_exit();
-}
-
index 412e344..2f401f9 100755 (executable)
@@ -204,6 +204,12 @@ static pid_t _gettid()
        return gTid;
 }
 
+void application_exit()
+{
+       PRINTMSG("EXIT appfw-capi");
+       app_efl_exit();
+}
+
 static void *recvThread(void __unused * data)
 {
        fd_set readfds, workfds;
@@ -283,7 +289,9 @@ static void *recvThread(void __unused * data)
                                }
                                else if(log.type == MSG_STOP)
                                {
+                                       PRINTMSG("MSG_STOP");
                                        application_exit();
+                                       break;
                                }
                                else
                                {
index feceba5..f20835a 100755 (executable)
@@ -212,7 +212,6 @@ int __profil(int mode);
 //wchar_t* -> char*
 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
 char *absolutize_filepath(char buf[PATH_MAX], const char *fname);
-void application_exit();
 
 // screen capture functions
 int initialize_screencapture();