[Title] service app profiling code added
authorjooyoul_lee <jy.exe.lee@samsung.com>
Tue, 19 Nov 2013 04:55:52 +0000 (13:55 +0900)
committerjooyoul_lee <jy.exe.lee@samsung.com>
Tue, 19 Nov 2013 04:55:52 +0000 (13:55 +0900)
[Desc.]
[Issue]

21 files changed:
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/SymbolManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogInserter.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/DeviceInfo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/PackageInfo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/BaseCallstackManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/UserSpaceInst.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/ProcessInfo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/ProfileData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackUnit.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java

index 7ab11d6..3feb167 100755 (executable)
@@ -69,7 +69,7 @@ public class AnalyzerManager {
        private static int imageListSize = 0;
 
        private static HashMap<Long, String> funcNameMap = new HashMap<Long, String>();
-       
+
        private static LeakDetector leakDetector = new LeakDetector();
        private static FailedChecker failedChecker = new FailedChecker();
        private static FailedChecker calledChecker = new FailedChecker();
@@ -87,6 +87,8 @@ public class AnalyzerManager {
        public static final int THREAD_JOIN_WAIT_TIME = 5000;
        public static final int INSERT_JOIN_WAIT_TIME = 30000;
 
+       private static int processCount = 0;
+
        public static boolean isExit() {
                return exit;
        }
@@ -186,7 +188,7 @@ public class AnalyzerManager {
                isHaveSampleThread = false;
                isLogParsingComplete = false;
                StopProcessManager.clear();
-       //      UserFunctionManager.getInstance().clear();
+               // UserFunctionManager.getInstance().clear();
                LogDataFactory.clean();
                FunctionUsageProfiler.clear();
                FunctionUsageProfiler.stopProfiler();
@@ -195,6 +197,7 @@ public class AnalyzerManager {
                endBinaryAddr = -1;
                appInfoArrived = false;
                funcNameMap.clear();
+               processCount = 0;
        }
 
        public static synchronized List<ImageInfo> getImageList() {
@@ -359,4 +362,15 @@ public class AnalyzerManager {
                return funcNameMap;
        }
 
+       public static int getProcessCount() {
+               return processCount;
+       }
+
+       public static synchronized void increseProcessCount() {
+               processCount++;
+       }
+
+       public static synchronized void decreaseProcessCount() {
+               processCount--;
+       }
 }
index e2da2b0..252907a 100644 (file)
@@ -306,7 +306,7 @@ public class SymbolManager {
                try {
                        demangled = unmangler.unmangle(mangled.trim());
                } catch (UnmanglingException e) {
-                       e.printStackTrace();
+//                     e.printStackTrace();
                        demangled = mangled;
                        // for debug log
                        System.out.println("Mangled name :" + mangled); //$NON-NLS-1$
index 111d93e..8fbee36 100755 (executable)
@@ -5,7 +5,7 @@ import java.net.Socket;
 
 import org.tizen.dynamicanalyzer.common.HostResult;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 
 public abstract class BaseCommunicator {
 
@@ -44,6 +44,6 @@ public abstract class BaseCommunicator {
 
        public abstract void closeSock();
 
-       public void setSelectedApp(PackageInfo app) {
+       public void setSelectedApp(AppInfo app) {
        }
 }
index 36042bd..d4bebf8 100755 (executable)
@@ -42,7 +42,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
 import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.common.HostResult;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.swap.channel.control.EventObject;
 import org.tizen.dynamicanalyzer.swap.channel.control.ReplayEvent;
 import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
@@ -186,7 +186,7 @@ public class Communicator22 extends BaseCommunicator {
                                + ConfigureManager.getInstance().getConfiguration(device)
                                + CommonConstants.CMD_SPLIT
                                + DACommunicator.getSelectedApp().getInfo(
-                                               PackageInfo.EXEC_INDEX);
+                                               AppInfo.EXEC_INDEX);
 
                String message = AnalyzerConstants.MSG_START
                                + CommonConstants.CMD_SPLIT + rearMessage.length()
index 796eff1..9b92d83 100644 (file)
@@ -46,6 +46,7 @@ import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.common.HostResult;
 import org.tizen.dynamicanalyzer.common.PathManager;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.swap.communicator.Communicator30;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
@@ -67,7 +68,7 @@ public class DACommunicator {
 
        private static List<String> packageInfoMultiLines = new ArrayList<String>();
 
-       private static PackageInfo selectedApp = null;
+       private static AppInfo selectedApp = null;
 
        private static List<DeviceInfo> devices = null;
        private static DeviceInfo currentDevice = null;
@@ -144,11 +145,16 @@ public class DACommunicator {
                currentDevice = device;
        }
 
-       public static PackageInfo getSelectedApp() {
+       public static AppInfo getSelectedApp() {
                return selectedApp;
        }
 
-       public static void setSelectedApp(PackageInfo app) {
+       public static PackageInfo getSelectedPackage() {
+               return getSelectedDevice().getPackageInfoHash().get(
+                               selectedApp.getPackageId());
+       }
+
+       public static void setSelectedApp(AppInfo app) {
                selectedApp = app;
                if (null != app && null != currentDevice) {
                        currentDevice.getCommunicator().setSelectedApp(app);
@@ -254,14 +260,13 @@ public class DACommunicator {
                return devNameList;
        }
 
-       public static List<PackageInfo> getAppListFromTarget() {
+       public static List<AppInfo> getAppListFromTarget() {
                if (null == currentDevice) {
                        return null;
                }
-               List<PackageInfo> appInfoList = currentDevice.getAppInfoList();
-               HashMap<String, PackageInfo> appInfoHash = currentDevice
-                               .getAppInfoHash();
-               List<PackageInfo> backList = new ArrayList<PackageInfo>();
+               List<AppInfo> appInfoList = currentDevice.getAppInfoList();
+               HashMap<String, AppInfo> appInfoHash = currentDevice.getAppInfoHash();
+               List<AppInfo> backList = new ArrayList<AppInfo>();
                backList.addAll(appInfoHash.values());
 
                packageInfoMultiLines.clear();
@@ -285,37 +290,45 @@ public class DACommunicator {
                        String line = packageInfoMultiLines.get(i);
                        if (line.contains("Appid")) {
                                List<String> lines = new ArrayList<String>();
-                               for (int ii = 0; ii < PackageInfo.PKGINFO_SIZE; ii++) {
+                               int max = AppInfo.PKGINFO_SIZE;
+                               for (int ii = 0; ii < max; ii++) {
+                                       String inputLine = packageInfoMultiLines.get(ii + i);
+                                       if (inputLine.isEmpty()) {
+                                               max++;
+                                               continue;
+                                       }
                                        lines.add(packageInfoMultiLines.get(ii + i));
                                }
-                               PackageInfo pkgInfo = makePackageInfo(lines);
-                               if (null != pkgInfo
-                                               && pkgInfo.getInfo(PackageInfo.APPTYPE_INDEX).contains(
-                                                               PackageInfo.APPTYPE_CPP)
-                                               && pkgInfo.getInfo(PackageInfo.MULTIPLE_INDEX).equals(
-                                                               PackageInfo.FLAG_ZERO)
-                                               && pkgInfo.getInfo(PackageInfo.NODISPLAY_INDEX).equals(
-                                                               PackageInfo.FLAG_ZERO)) {
-                                       String pkgId = pkgInfo.getInfo(PackageInfo.PACKAGE_INDEX);
-                                       String appId = pkgInfo.getInfo(PackageInfo.APPID_INDEX);
-
-                                       if (null == appInfoHash.get(pkgId)) {
+                               AppInfo appInfo = makePackageInfo(currentDevice, lines);
+                               if (null != appInfo
+                                               && (appInfo.getInfo(AppInfo.APPTYPE_INDEX).contains(
+                                                               AppInfo.APPTYPE_CPP) || appInfo.getInfo(
+                                                               AppInfo.APPTYPE_INDEX).contains(
+                                                               AppInfo.APPTYPE_WEB))
+                                               && appInfo.getInfo(AppInfo.MULTIPLE_INDEX).equals(
+                                                               AppInfo.FLAG_ZERO)
+                                               && appInfo.getInfo(AppInfo.NODISPLAY_INDEX).equals(
+                                                               AppInfo.FLAG_ZERO)) {
+                                       String pkgId = appInfo.getInfo(AppInfo.PACKAGE_INDEX);
+                                       String appId = appInfo.getInfo(AppInfo.APPID_INDEX);
+
+                                       if (null == appInfoHash.get(appId)) {
                                                if (!isUnittest(pkgId) && !isIME(appId)) {
-                                                       appInfoList.add(pkgInfo);
-                                                       appInfoHash.put(pkgId, pkgInfo);
+                                                       appInfoList.add(appInfo);
+                                                       appInfoHash.put(appId, appInfo);
                                                }
                                        } else {
-                                               backList.remove(appInfoHash.get(pkgId));
+                                               backList.remove(appInfoHash.get(appId));
                                        }
                                }
-                               i += PackageInfo.PKGINFO_SIZE - 1;
+                               i += AppInfo.PKGINFO_SIZE - 1;
                        }
                }
                if (!backList.isEmpty()) {
-                       for (PackageInfo pkg : backList) {
-                               String pkgId = pkg.getInfo(PackageInfo.PACKAGE_INDEX);
-                               appInfoList.remove(pkg);
-                               appInfoHash.remove(pkgId);
+                       for (AppInfo app : backList) {
+                               String appId = app.getInfo(AppInfo.APPID_INDEX);
+                               appInfoList.remove(app);
+                               appInfoHash.remove(appId);
                        }
                }
                return appInfoList;
@@ -413,23 +426,33 @@ public class DACommunicator {
                }
        }
 
-       private static PackageInfo makePackageInfo(List<String> lines) {
-               PackageInfo pkgInfo = new PackageInfo();
-               for (int i = 0; i < PackageInfo.PKGINFO_SIZE; i++) {
+       private static AppInfo makePackageInfo(DeviceInfo device, List<String> lines) {
+               AppInfo appInfo = new AppInfo();
+               for (int i = 0; i < AppInfo.PKGINFO_SIZE; i++) {
                        String line = lines.get(i);
                        int index = line.indexOf(":");
                        String data = line.substring(index + 1, line.length()).trim();
-                       pkgInfo.setInfo(i, data);
+                       appInfo.setInfo(i, data);
+               }
+
+               String pkgId = appInfo.getInfo(AppInfo.PACKAGE_INDEX);
+               PackageInfo pkgInfo = device.getPackageInfoHash().get(pkgId);
+               if (null == pkgInfo) {
+                       pkgInfo = new PackageInfo(pkgId);
+                       pkgInfo.addAppInfo(appInfo);
+                       device.getPackageInfoHash().put(pkgId, pkgInfo);
+               } else {
+                       pkgInfo.addAppInfo(appInfo);
                }
-               return pkgInfo;
+               return appInfo;
        }
 
-       public static PackageInfo getPkgInfoByName(String appLabel) {
+       public static AppInfo getPkgInfoByName(String appLabel) {
                if (null != currentDevice) {
                        int size = currentDevice.getAppInfoList().size();
                        for (int i = 0; i < size; i++) {
-                               PackageInfo pkgInfo = currentDevice.getAppInfoList().get(i);
-                               if (pkgInfo.getInfo(PackageInfo.LABEL_INDEX).equals(appLabel)) {
+                               AppInfo pkgInfo = currentDevice.getAppInfoList().get(i);
+                               if (pkgInfo.getInfo(AppInfo.LABEL_INDEX).equals(appLabel)) {
                                        return pkgInfo;
                                }
                        }
@@ -437,12 +460,12 @@ public class DACommunicator {
                return null;
        }
 
-       public static PackageInfo getPkgInfoByAppPkgId(String pkgid) {
+       public static AppInfo getPkgInfoByAppPkgId(String pkgid) {
                if (null != currentDevice) {
                        int size = currentDevice.getAppInfoList().size();
                        for (int i = 0; i < size; i++) {
-                               PackageInfo ai = currentDevice.getAppInfoList().get(i);
-                               if (ai.getInfo(PackageInfo.PACKAGE_INDEX).equals(pkgid)) {
+                               AppInfo ai = currentDevice.getAppInfoList().get(i);
+                               if (ai.getInfo(AppInfo.PACKAGE_INDEX).equals(pkgid)) {
                                        return ai;
                                }
                        }
index f7cccb4..560815d 100644 (file)
@@ -50,7 +50,7 @@ import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.common.DASingletonFocusManager;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
@@ -280,7 +280,7 @@ public class IDECommunicator implements Runnable {
                DACommunicator.setSelectedDevice(device);
 
                DACommunicator.getAppListFromTarget();
-               PackageInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(appid);
+               AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(appid);
                if (null == appInfo) {
                        Display.getDefault().syncExec(new Runnable() {
                                public void run() {
@@ -300,7 +300,7 @@ public class IDECommunicator implements Runnable {
                        System.out.println("invalid application name :" + appid);
                        return;
                }
-               final String appLabel = appInfo.getInfo(PackageInfo.LABEL_INDEX);
+               final String appLabel = appInfo.getInfo(AppInfo.LABEL_INDEX);
                System.out.println("IDE recv - deviceName: " + deviceName
                                + " appName : " + appLabel);
 
index f3e9c0a..a2a9d3a 100644 (file)
@@ -97,7 +97,7 @@ public class LogInserter implements Runnable {
                while (!AnalyzerManager.isExit()) {
                        try {
                                LogPackage logPack = logQueue.getFirstLog();
-//                             System.out.println("log queue size : " + logQueue.size());
+                               // System.out.println("log queue size : " + logQueue.size());
                                if (null == logPack) {
                                        break;
                                }
@@ -109,12 +109,13 @@ public class LogInserter implements Runnable {
                                                newLogs.addAll(logs.getLogs());
                                                SqlManager.getInstance().insert(logId, newLogs);
                                        }
-                                       if (null != logs && logId == DataChannelConstants.MSG_FUNCTION_EXIT) {
+                                       if (null != logs
+                                                       && logId == DataChannelConstants.MSG_FUNCTION_EXIT) {
                                                List<LogData> newLogs = new ArrayList<LogData>();
                                                newLogs.addAll(logs.getLogs());
                                                SqlManager.getInstance().updateProfileTable(newLogs);
                                        }
-                                       
+
                                } // for
 
                                initLogPackage();
index 0556daa..4d14d27 100644 (file)
@@ -35,6 +35,7 @@ import org.tizen.dynamicanalyzer.common.HostResult;
 import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
 import org.tizen.dynamicanalyzer.communicator.Communicator22;
 import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.swap.channel.control.TargetInfo;
 import org.tizen.dynamicanalyzer.swap.communicator.Communicator30;
@@ -47,8 +48,9 @@ public class DeviceInfo {
        private String targetVersion = null;
        private BaseCommunicator communicator = null;
 
-       private List<PackageInfo> appInfoList = null;
-       private HashMap<String, PackageInfo> appInfoHash = null;
+       private List<AppInfo> appInfoList = null;
+       private HashMap<String, AppInfo> appInfoHash = null;
+       private HashMap<String, PackageInfo> pkgInfoHash = null;
        private List<String> apiList = null;
 
        private TargetInfo targetInfo = null;
@@ -60,8 +62,9 @@ public class DeviceInfo {
 
        public DeviceInfo(IDevice device) {
                this.device = device;
-               appInfoList = new ArrayList<PackageInfo>();
-               appInfoHash = new HashMap<String, PackageInfo>();
+               appInfoList = new ArrayList<AppInfo>();
+               appInfoHash = new HashMap<String, AppInfo>();
+               pkgInfoHash = new HashMap<String, PackageInfo>();
                targetInfo = new TargetInfo();
                apiList = AnalyzerUtil.getApiMap(device);
        }
@@ -78,11 +81,11 @@ public class DeviceInfo {
                return device;
        }
 
-       public List<PackageInfo> getAppInfoList() {
+       public List<AppInfo> getAppInfoList() {
                return appInfoList;
        }
 
-       public HashMap<String, PackageInfo> getAppInfoHash() {
+       public HashMap<String, AppInfo> getAppInfoHash() {
                return appInfoHash;
        }
 
@@ -171,4 +174,12 @@ public class DeviceInfo {
        public HostResult sendRuntimeMessage(int type, String message) {
                return communicator.sendRuntimeMessage(this, type, message);
        }
+
+       public HashMap<String, PackageInfo> getPackageInfoHash() {
+               return pkgInfoHash;
+       }
+
+       public PackageInfo getSelectedPackage(String pkgId) {
+               return pkgInfoHash.get(pkgId);
+       }
 }
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java
new file mode 100644 (file)
index 0000000..58e223f
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.project;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.ElfSymbolExtracter;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
+import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInfo;
+import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
+
+public class AppInfo {
+
+       public static final int APPID_INDEX = 0;
+       public static final int PACKAGE_INDEX = 1;
+       public static final int EXEC_INDEX = 2;
+       public static final int ICON_INDEX = 3;
+       public static final int LABEL_INDEX = 4;
+       public static final int APPTYPE_INDEX = 5;
+       public static final int COMPONENT_INDEX = 6;
+       public static final int MULTIPLE_INDEX = 7;
+       public static final int NODISPLAY_INDEX = 8;
+       public static final int TASKMANAGE_INDEX = 9;
+       public static final int HW_ACCELERATION_INDEX = 10;
+       public static final int USER_DATA_INDEX = 11;
+       public static final int PKGINFO_SIZE = 12;
+
+       public static final String APPTYPE_CPP = "c++";//$NON-NLS-1$
+       public static final String APPTYPE_WEB = "webapp";//$NON-NLS-1$
+       public static final String FLAG_ZERO = "0";//$NON-NLS-1$
+       public static final String FLAG_ONE = "1";//$NON-NLS-1$
+
+       // private BinaryInfo binInfo = null;
+//     private String mainTargetKey = null;
+       private HashMap<String, BinaryInfo> binaryInfoMap = new HashMap<String, BinaryInfo>();
+
+       private String installTime = null;
+       private String execFileName = null;
+
+       private ElfSymbolExtracter symbolExtractor = new ElfSymbolExtracter();
+
+       public String getInstallTime() {
+               return installTime;
+       }
+
+       public void setInstallTime(String installTime) {
+               this.installTime = installTime;
+       }
+
+       private List<String> appInfo = new ArrayList<String>();
+
+       public AppInfo() {
+               for (int i = 0; i < PKGINFO_SIZE; i++) {
+                       appInfo.add(CommonConstants.EMPTY);
+               }
+       }
+
+       public void setInfo(int index, String data) {
+               appInfo.set(index, data);
+       }
+
+       public String getInfo(int index) {
+               return appInfo.get(index);
+       }
+
+       // public BinaryInfo getBinInfo() {
+       // return binInfo;
+       // }
+
+       // public void setBinInfo(BinaryInfo binInfo) {
+       // this.binInfo = binInfo;
+       // }
+
+       public List<AddrSymbolPair> getSymbols(String sourceBinaryPath) {
+               if (null == sourceBinaryPath || sourceBinaryPath.isEmpty()) {
+                       return null;
+               }
+               symbolExtractor.clear();
+               // symbolExtractor.makeSymbol(binInfo.getSourceBinaryPath());
+               symbolExtractor.makeSymbol(sourceBinaryPath);
+               return symbolExtractor.getAddrSymbolPairs();
+       }
+
+       public String getExecFileName(int type) {
+               if (null == execFileName) {
+                       String execPath = appInfo.get(EXEC_INDEX);
+                       String[] splitPath = execPath.split(CommonConstants.SLASH);
+                       if (type == ApplicationInfo.APPTYPE_TIZEN) {
+                               execFileName = splitPath[splitPath.length - 1]
+                                               + CommonConstants.EXTENSION_EXEC_FILE;
+                       } else {
+                               execFileName = splitPath[splitPath.length - 1];
+                       }
+               }
+               return execFileName;
+       }
+
+       public HashMap<String, BinaryInfo> getBinaryInfoMap() {
+               return binaryInfoMap;
+       }
+
+       public BinaryInfo getBinaryInfo(String targetBinPath) {
+               PackageInfo pkgInfo = DACommunicator.getSelectedDevice().getPackageInfoHash().get(getPackageId());
+//             BinaryInfo ret = binaryInfoMap.get(targetBinPath);
+               BinaryInfo ret = pkgInfo.getBinaryInfo(targetBinPath);
+               return ret;
+       }
+
+       public BinaryInfo getMainBinaryInfo() {
+               return binaryInfoMap.get(getExecPath());
+       }
+
+       public void setMainBinaryInfo(BinaryInfo binInfo) {
+//             mainTargetKey = AnalyzerUtil.getTargetPathKey(binInfo
+//                             .getTargetBinaryPath());
+               binaryInfoMap.put(getExecPath(), binInfo);
+       }
+
+       public String getAppId() {
+               return appInfo.get(APPID_INDEX);
+       }
+
+       public String getPackageId() {
+               return appInfo.get(PACKAGE_INDEX);
+       }
+
+       public String getExecPath() {
+               String exec = appInfo.get(EXEC_INDEX);
+               exec = exec.replaceFirst("/opt/apps", "/opt/usr/apps");
+               if (getAppType().contains(APPTYPE_CPP)) {
+                       exec += ".exe";
+               }
+               return exec;
+       }
+
+       public String getAppType() {
+               return appInfo.get(APPTYPE_INDEX);
+       }
+}
index 23d2d40..d6b69f0 100644 (file)
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: 
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * Contributors:
- * - S-Core Co., Ltd
- * 
- */
-
 package org.tizen.dynamicanalyzer.project;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
-import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.common.ElfSymbolExtracter;
-import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
-import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInfo;
 import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 
 public class PackageInfo {
 
-       public static final int APPID_INDEX = 0;
-       public static final int PACKAGE_INDEX = 1;
-       public static final int EXEC_INDEX = 2;
-       public static final int ICON_INDEX = 3;
-       public static final int LABEL_INDEX = 4;
-       public static final int APPTYPE_INDEX = 5;
-       public static final int COMPONENT_INDEX = 6;
-       public static final int MULTIPLE_INDEX = 7;
-       public static final int NODISPLAY_INDEX = 8;
-       public static final int TASKMANAGE_INDEX = 9;
-       public static final int HW_ACCELERATION_INDEX = 10;
-       public static final int USER_DATA_INDEX = 11;
-       public static final int PKGINFO_SIZE = 12;
-
-       public static final String APPTYPE_CPP = "c++";//$NON-NLS-1$
-       public static final String FLAG_ZERO = "0";//$NON-NLS-1$
-       public static final String FLAG_ONE = "1";//$NON-NLS-1$
-
-       // private BinaryInfo binInfo = null;
-       private String mainTargetKey = null;
-       private HashMap<String, BinaryInfo> binaryInfoMap = new HashMap<String, BinaryInfo>();
-
-       private String installTime = null;
-       private String execFileName = null;
-
-       private ElfSymbolExtracter symbolExtractor = new ElfSymbolExtracter();
-
-       public String getInstallTime() {
-               return installTime;
-       }
-
-       public void setInstallTime(String installTime) {
-               this.installTime = installTime;
-       }
-
-       private List<String> appInfo = new ArrayList<String>();
-
-       public PackageInfo() {
-               for (int i = 0; i < PKGINFO_SIZE; i++) {
-                       appInfo.add(CommonConstants.EMPTY);
-               }
-       }
-
-       public void setInfo(int index, String data) {
-               appInfo.set(index, data);
-       }
+       private String id = null;
+       private List<AppInfo> appInfos = null;
 
-       public String getInfo(int index) {
-               return appInfo.get(index);
+       public PackageInfo(String pkgId) {
+               id = pkgId;
+               appInfos = new ArrayList<AppInfo>();
        }
 
-       // public BinaryInfo getBinInfo() {
-       // return binInfo;
-       // }
-
-       // public void setBinInfo(BinaryInfo binInfo) {
-       // this.binInfo = binInfo;
-       // }
-
-       public List<AddrSymbolPair> getSymbols(String sourceBinaryPath) {
-               if (null == sourceBinaryPath || sourceBinaryPath.isEmpty()) {
-                       return null;
+       public void addAppInfo(AppInfo appInfo) {
+               for (AppInfo app : appInfos) {
+                       if (app.getAppId().equals(appInfo.getAppId())) {
+                               return;
+                       }
                }
-               symbolExtractor.clear();
-               // symbolExtractor.makeSymbol(binInfo.getSourceBinaryPath());
-               symbolExtractor.makeSymbol(sourceBinaryPath);
-               return symbolExtractor.getAddrSymbolPairs();
+               appInfos.add(appInfo);
        }
 
-       public String getExecFileName(int type) {
-               if (null == execFileName) {
-                       String execPath = appInfo.get(EXEC_INDEX);
-                       String[] splitPath = execPath.split(CommonConstants.SLASH);
-                       if (type == ApplicationInfo.APPTYPE_TIZEN) {
-                               execFileName = splitPath[splitPath.length - 1]
-                                               + CommonConstants.EXTENSION_EXEC_FILE;
-                       } else {
-                               execFileName = splitPath[splitPath.length - 1];
+       public AppInfo getAppInfo(String appId) {
+               for (AppInfo info : appInfos) {
+                       if (appId.equals(info.getInfo(AppInfo.APPID_INDEX))) {
+                               return info;
                        }
                }
-               return execFileName;
-       }
-
-       public HashMap<String, BinaryInfo> getBinaryInfoMap() {
-               return binaryInfoMap;
+               return null;
        }
 
-       public BinaryInfo getBinaryInfo(String targetBinPath) {
-               BinaryInfo ret = binaryInfoMap.get(targetBinPath);
-               return ret;
+       public String getPackageId() {
+               return id;
        }
 
-       public BinaryInfo getMainBinaryInfo() {
-               return binaryInfoMap.get(mainTargetKey);
+       public List<AppInfo> getAppInfos() {
+               return appInfos;
        }
 
-       public void setMainBinaryInfo(BinaryInfo binInfo) {
-               mainTargetKey = AnalyzerUtil.getTargetPathKey(binInfo
-                               .getTargetBinaryPath());
-               binaryInfoMap.put(mainTargetKey, binInfo);
+       public BinaryInfo getBinaryInfo(String path) {
+               for (AppInfo app : appInfos) {
+                       if (null != app.getBinaryInfoMap().get(path)) {
+                               return app.getBinaryInfoMap().get(path);
+                       }
+               }
+               return null;
        }
 }
index 25a315e..823422f 100755 (executable)
@@ -214,14 +214,14 @@ public class Project {
                if (null == DACommunicator.getSelectedApp()) {
                        String comboText = ToolbarArea.getInstance().getAppCombo()
                                        .getText();
-                       PackageInfo appInfo = DACommunicator.getPkgInfoByName(comboText);
+                       AppInfo appInfo = DACommunicator.getPkgInfoByName(comboText);
                        DACommunicator.setSelectedApp(appInfo);
                        ToolbarArea.getInstance().setSelectedApp(appInfo);
                }
                appName = DACommunicator.getSelectedApp().getInfo(
-                               PackageInfo.LABEL_INDEX);
+                               AppInfo.LABEL_INDEX);
                pkgId = DACommunicator.getSelectedApp().getInfo(
-                               PackageInfo.PACKAGE_INDEX);
+                               AppInfo.PACKAGE_INDEX);
                DeviceInfo deviceName = DACommunicator.getSelectedDevice();
                if (null != deviceName
                                && null != deviceName.getIDevice().getSerialNumber()
index 52cd430..e9e0865 100644 (file)
@@ -34,7 +34,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
@@ -119,10 +119,10 @@ public abstract class BaseCallstackManager {
                if (userFunctionBin == null || userFunctionBin.isEmpty()) {
                        if (AnalyzerManager.isOsp()) {
                                userFunctionBin = new String(DACommunicator.getSelectedApp()
-                                               .getInfo(PackageInfo.EXEC_INDEX) + ".exe"); //$NON-NLS-1$
+                                               .getInfo(AppInfo.EXEC_INDEX) + ".exe"); //$NON-NLS-1$
                        } else {
                                userFunctionBin = new String(DACommunicator.getSelectedApp()
-                                               .getInfo(PackageInfo.EXEC_INDEX));
+                                               .getInfo(AppInfo.EXEC_INDEX));
                        }
                }
                return userFunctionBin;
index beb07a6..057cca8 100755 (executable)
@@ -33,19 +33,19 @@ import org.tizen.dynamicanalyzer.swap.model.SWAPModel;
 
 public class UserSpaceInst implements SWAPModel {
        // count of applications
-       private int count = 0;
+//     private int count = 0;
        private List<ApplicationInst> appInstList = null;
 
        public UserSpaceInst() {
                 appInstList = new ArrayList<ApplicationInst>();
        }
        public int getCount() {
-               return count;
+               return appInstList.size();
        }
 
-       public void setCount(int count) {
-               this.count = count;
-       }
+//     public void setCount(int count) {
+//             this.count = count;
+//     }
 
        public List<ApplicationInst> getAppInstList() {
                return appInstList;
@@ -53,7 +53,7 @@ public class UserSpaceInst implements SWAPModel {
 
        @Override
        public byte[] getByteValue() {
-               return ByteUtils.getByte(count, appInstList);
+               return ByteUtils.getByte(getCount(), appInstList);
        }
 
        @Override
index 80df759..22dff9a 100644 (file)
@@ -31,6 +31,9 @@ import java.util.List;
 
 import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
 import org.tizen.dynamicanalyzer.swap.model.DATime;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
@@ -94,7 +97,18 @@ public class ProcessInfo {
 
                BinaryInfo binInfo = null;
                if (pcAddr >= getLowestAddress() && pcAddr <= getHighestAddress()) {
-                       binInfo = DACommunicator.getSelectedApp().getMainBinaryInfo();
+                       String pkgId = DACommunicator.getSelectedApp().getInfo(
+                                       AppInfo.PACKAGE_INDEX);
+                       DeviceInfo devInfo = DACommunicator.getSelectedDevice();
+                       PackageInfo pkgInfo = devInfo.getSelectedPackage(pkgId);
+                       List<AppInfo> apps = pkgInfo.getAppInfos();
+                       for (AppInfo app : apps) {
+                               if (targetBinaryPath.equals(app.getExecPath())) {
+                                       binInfo = app.getMainBinaryInfo();
+                                       break;
+                               }
+                       }
+                       // binInfo = DACommunicator.getSelectedApp().getMainBinaryInfo();
                } else {
                        HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
                                        .getInstance().getTargetBinInfoMap();
index fee94f8..851f7de 100755 (executable)
@@ -60,6 +60,7 @@ import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInfo;
 import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInst;
@@ -155,19 +156,32 @@ public class Communicator30 extends BaseCommunicator {
        @Override
        public HostResult startTrace() {
                DACommunicator.setRunning(true);
-               ApplicationInfo appInfo = new ApplicationInfo();
-               PackageInfo selectedApp = DACommunicator.getSelectedApp();
-               String appType = selectedApp.getInfo(PackageInfo.APPTYPE_INDEX);
-               if (appType.contains(PackageInfo.APPTYPE_CPP)) {
-                       appInfo.setAppType(ApplicationInfo.APPTYPE_TIZEN);
-               } else {
-                       appInfo.setAppType(ApplicationInfo.APPTYPE_COMMON_EXEC);
-               }
-               appInfo.setAppId(selectedApp.getInfo(PackageInfo.APPID_INDEX));
-               appInfo.setExecPath(selectedApp.getInfo(PackageInfo.EXEC_INDEX)
-                               + ".exe");
-
-               UserSpaceInst userSpaceInst = getUserSpaceInst(appInfo);
+               // AppInfo selectedApp = DACommunicator.getSelectedApp();
+               //
+               // PackageInfo pkgInfo = DACommunicator.getSelectedDevice()
+               // .getPackageInfoHash()
+               // .get(selectedApp.getInfo(AppInfo.PACKAGE_INDEX));
+               // List<AppInfo> apps = pkgInfo.getAppInfos();
+               // byte[] appInstByte = new byte[0];
+               // List<ApplicationInfo> appInfos = new ArrayList<ApplicationInfo>();
+               // for (AppInfo app : apps) {
+               // ApplicationInfo appInfo = new ApplicationInfo();
+               // String appType = app.getInfo(AppInfo.APPTYPE_INDEX);
+               // if (appType.contains(AppInfo.APPTYPE_CPP)
+               // || appType.contains(AppInfo.APPTYPE_WEB)) {
+               // appInfo.setAppType(ApplicationInfo.APPTYPE_TIZEN);
+               // } else {
+               // appInfo.setAppType(ApplicationInfo.APPTYPE_COMMON_EXEC);
+               // }
+               // appInfo.setAppId(app.getInfo(AppInfo.APPID_INDEX));
+               // // appInfo.setExecPath(app.getInfo(AppInfo.EXEC_INDEX)
+               // // + ".exe");
+               // appInfo.setExecPath(app.getExecPath());
+               // appInfos.add(appInfo);
+               // }
+               UserSpaceInst userSpaceInst = getUserSpaceInst();
+               // appInstByte = ByteUtils.getByte(appInstByte,
+               // userSpaceInst.getByteValue());
 
                byte[] replayData = AnalyzerManager.getProject().getReplayEvent();
                byte[] rear = ByteUtils.getByte(userSpaceInst.getByteValue(),
@@ -231,62 +245,131 @@ public class Communicator30 extends BaseCommunicator {
                return result;
        }
 
-       private UserSpaceInst getUserSpaceInst(ApplicationInfo appInfo) {
+       private UserSpaceInst getUserSpaceInst() {
                UserSpaceInst output = new UserSpaceInst();
-               output.setCount(1); // single processing
-               ApplicationInst appInst = new ApplicationInst();
-               appInst.setApplicationType(ApplicationInfo.APPTYPE_TIZEN);
-               PackageInfo selectedApp = DACommunicator.getSelectedApp();
-               appInst.setApplicationId(appInfo.getAppId());
-               appInst.setExecutablePath(appInfo.getExecPath());
-               BinaryInfo mainInfo = DACommunicator.getSelectedApp()
-                               .getMainBinaryInfo();
-               List<AddrSymbolPair> symbols = selectedApp.getSymbols(mainInfo
-                               .getTempBinaryPath());
-               List<FunctionInst> functionInstList = appInst.getFunctionInstList();
-
-               int size = (symbols == null) ? 0 : symbols.size();
-               int exSize = 0;
-               for (int i = 0; i < size; i++) {
-                       AddrSymbolPair addrSymbol = symbols.get(i);
-                       String symbol = addrSymbol.getSymbol();
-                       // FIXME: black list hard coded.
-                       if (symbol.contains("__i686.get_pc_thunk")) {
-                               exSize++;
-                               continue;
+               // output.setCount(1); // single processing
+
+               PackageInfo pkgInfo = DACommunicator.getSelectedPackage();
+               List<AppInfo> apps = pkgInfo.getAppInfos();
+
+               // for (AppInfo app : apps)
+               for (int ii = apps.size() - 1; ii >= 0; ii--) {
+                       AppInfo app = apps.get(ii);
+                       ApplicationInst appInst = new ApplicationInst();
+
+                       String appType = app.getInfo(AppInfo.APPTYPE_INDEX);
+                       if (appType.contains(AppInfo.APPTYPE_CPP)
+                                       || appType.contains(AppInfo.APPTYPE_WEB)) {
+                               appInst.setApplicationType(ApplicationInfo.APPTYPE_TIZEN);
+                       } else {
+                               appInst.setApplicationType(ApplicationInfo.APPTYPE_COMMON_EXEC);
                        }
-                       FunctionInst functionInst = new FunctionInst();
-                       functionInst.setAddr(addrSymbol.getAddr());
-                       functionInst.setArgs(getFunctionArgs(addrSymbol.getSymbol()));
-                       functionInstList.add(functionInst);
-
-                       // for debug
-                       System.out.print("DEBUG : addr ");
-                       AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
-                       System.out
-                                       .print("   symbol " + addrSymbol.getSymbol() + "   args ");
-                       ByteUtils.printByteArray(functionInst.getArgs());
-                       System.out.println();
+
+                       appInst.setApplicationId(app.getAppId());
+                       appInst.setExecutablePath(app.getExecPath());
+                       System.out.println("Set execute path : " + app.getExecPath());
+                       BinaryInfo binInfo = app.getMainBinaryInfo();
+                       List<AddrSymbolPair> symbols = app.getSymbols(binInfo
+                                       .getTempBinaryPath());
+                       List<FunctionInst> functionInstList = appInst.getFunctionInstList();
+
+                       int size = (symbols == null) ? 0 : symbols.size();
+                       int exSize = 0;
+                       for (int i = 0; i < size; i++) {
+                               AddrSymbolPair addrSymbol = symbols.get(i);
+                               String symbol = addrSymbol.getSymbol();
+                               // FIXME: black list hard coded.
+                               if (symbol.contains("__i686.get_pc_thunk")) {
+                                       exSize++;
+                                       continue;
+                               }
+                               FunctionInst functionInst = new FunctionInst();
+                               functionInst.setAddr(addrSymbol.getAddr());
+                               functionInst.setArgs(getFunctionArgs(addrSymbol.getSymbol()));
+                               functionInstList.add(functionInst);
+
+                               // for debug
+                               System.out.print("DEBUG : addr ");
+                               AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
+                               System.out.print("   symbol " + addrSymbol.getSymbol()
+                                               + "   args ");
+                               ByteUtils.printByteArray(functionInst.getArgs());
+                               System.out.println();
+                       }
+                       appInst.setFunctionCount(size - exSize);
+                       // appInst.setFunctionCount(0);
+                       output.getAppInstList().add(appInst);
                }
-               appInst.setFunctionCount(size - exSize);
-               // appInst.setFunctionCount(0);
-               output.getAppInstList().add(appInst);
+
+               // for (ApplicationInfo appInfo : appInfos) {
+               // ApplicationInst appInst = new ApplicationInst();
+               // appInst.setApplicationType(appInfo.getAppType());
+               // AppInfo selectedApp = DACommunicator.getSelectedApp();
+               // appInst.setApplicationId(appInfo.getAppId());
+               // appInst.setExecutablePath(appInfo.getExecPath());
+               // BinaryInfo mainInfo = DACommunicator.getSelectedApp()
+               // .getBinaryInfo(appInfo.getExecPath());
+               // List<AddrSymbolPair> symbols = selectedApp.getSymbols(mainInfo
+               // .getTempBinaryPath());
+               // List<FunctionInst> functionInstList = appInst.getFunctionInstList();
+               //
+               // int size = (symbols == null) ? 0 : symbols.size();
+               // int exSize = 0;
+               // for (int i = 0; i < size; i++) {
+               // AddrSymbolPair addrSymbol = symbols.get(i);
+               // String symbol = addrSymbol.getSymbol();
+               // // FIXME: black list hard coded.
+               // if (symbol.contains("__i686.get_pc_thunk")) {
+               // exSize++;
+               // continue;
+               // }
+               // FunctionInst functionInst = new FunctionInst();
+               // functionInst.setAddr(addrSymbol.getAddr());
+               // functionInst.setArgs(getFunctionArgs(addrSymbol.getSymbol()));
+               // functionInstList.add(functionInst);
+               //
+               // // for debug
+               // System.out.print("DEBUG : addr ");
+               // AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
+               // System.out.print("   symbol " + addrSymbol.getSymbol()
+               // + "   args ");
+               // ByteUtils.printByteArray(functionInst.getArgs());
+               // System.out.println();
+               // }
+               // appInst.setFunctionCount(size - exSize);
+               // // appInst.setFunctionCount(0);
+               // output.getAppInstList().add(appInst);
+               // }
+               // output.setCount(output.getAppInstList().size());
                return output;
        }
 
-       public HostResult sendBinaryInfoMessage(PackageInfo selectedApp) {
+       public HostResult sendBinaryInfoMessage(AppInfo selectedApp) {
                // send config message
                byte[] msgBinInfo = ByteUtils
                                .toBytes(AnalyzerConstants.MSG_BINARY_INFO);
 
-               int binCount = 1; // FIXME
-               String targetPath = selectedApp.getInfo(PackageInfo.EXEC_INDEX);
-               String type = selectedApp.getInfo(PackageInfo.APPTYPE_INDEX);
-               if (type.contains(PackageInfo.APPTYPE_CPP)) {
-                       targetPath += CommonConstants.EXTENSION_EXEC_FILE;
+               PackageInfo pkgInfo = DACommunicator.getSelectedDevice()
+                               .getPackageInfoHash()
+                               .get(selectedApp.getInfo(AppInfo.PACKAGE_INDEX));
+               List<AppInfo> apps = pkgInfo.getAppInfos();
+               if (null == apps) {
+                       return HostResult.ERR_BIN_INFO_GET_FAIL;
                }
 
-               byte[] preMsg = ByteUtils.getByte(binCount, targetPath);
+               int binCount = apps.size();
+               byte[] preMsg = ByteUtils.getByte(binCount);
+
+               for (AppInfo app : apps) {
+                       // String targetPath = app.getInfo(AppInfo.EXEC_INDEX);
+                       String targetPath = app.getExecPath();
+                       // String type = app.getInfo(AppInfo.APPTYPE_INDEX);
+                       // if (type.contains(AppInfo.APPTYPE_CPP)) {
+                       // targetPath += CommonConstants.EXTENSION_EXEC_FILE;
+                       // }
+                       preMsg = ByteUtils.getByte(preMsg, targetPath);
+               }
+               // byte[] preMsg = ByteUtils.getByte(binCount, targetPath);
 
                int length = preMsg.length;
                byte[] msg = ByteUtils.getByte(msgBinInfo, length, preMsg);
@@ -300,18 +383,23 @@ public class Communicator30 extends BaseCommunicator {
 
                // parse binary info
                byte[] payload = getMessagePayload(result.getRet());
-               BinaryInfo binInfo = new BinaryInfo();
-               binInfo.setTargetBinaryPath(targetPath);
-               selectedApp.setMainBinaryInfo(binInfo);
+
                int index = 0;
                int count = ByteUtils.toInt(payload, index);
                index += INT_SIZE;
                String localBinaryPath = null;
-               // FIXME
+
                for (int i = 0; i < count; i++) {
+                       AppInfo app = apps.get(i);
+                       BinaryInfo binInfo = new BinaryInfo();
+                       String targetPath = app.getExecPath();
+                       binInfo.setTargetBinaryPath(targetPath);
+                       app.setMainBinaryInfo(binInfo);
+
                        int binaryType = ByteUtils.toInt(payload, index);
                        index += INT_SIZE;
                        localBinaryPath = ByteUtils.getString(payload, index).trim();
+                       index += ByteUtils.getStringLength(payload, index);
                        String[] splitLocalBinaryPath = localBinaryPath
                                        .split(CommonConstants.SLASH);
                        binInfo.setLocalBinaryPath(localBinaryPath);
@@ -325,15 +413,16 @@ public class Communicator30 extends BaseCommunicator {
                                if (result.isSuccess()) {
                                        binInfo.setTempBinaryPath(localBinaryPath);
                                }
-                               index += ByteUtils.getStringLength(payload, index);
+
                                String md5sum = ByteUtils.getString(payload, index);
+                               index += ByteUtils.getStringLength(payload, index);
                                binInfo.setType(binaryType);
                                binInfo.setTempBinaryPath(localBinaryPath);
                                binInfo.setMd5sumValue(md5sum);
-                               return result;
+                               continue;
                        } else {
-                               index += ByteUtils.getStringLength(payload, index);
                                String md5sum = ByteUtils.getString(payload, index);
+                               index += ByteUtils.getStringLength(payload, index);
                                binInfo.setType(binaryType);
                                binInfo.setTempBinaryPath(localBinaryPath);
                                binInfo.setMd5sumValue(md5sum);
@@ -349,7 +438,7 @@ public class Communicator30 extends BaseCommunicator {
                                if (result.isSuccess()) {
                                        binInfo.setTempBinaryPath(localBinaryPath);
                                }
-                               return result;
+                               continue;
                        }
 
                        String localHashCode = null;
@@ -366,15 +455,18 @@ public class Communicator30 extends BaseCommunicator {
                                String errorStr = error.readLine();
                                if (null == line) {
                                        System.out.println("host md5sum get failed : " + errorStr);
-                                       return HostResult.ERR_BIN_INFO_GET_FAIL;
+                                       result = HostResult.ERR_BIN_INFO_GET_FAIL;
+                                       continue;
                                }
                                String[] splitResult = line.trim().split(CommonConstants.SPACE);
                                localHashCode = new String(splitResult[0]);
                        } catch (IOException e) {
                                e.printStackTrace();
-                               return HostResult.ERR_BIN_INFO_GET_FAIL;
+                               result = HostResult.ERR_BIN_INFO_GET_FAIL;
+                               continue;
                        } catch (InterruptedException e) {
                                e.printStackTrace();
+                               return HostResult.ERR_BIN_INFO_GET_FAIL;
                        }
 
                        String targetHashCode = binInfo.getMd5sumValue();
@@ -385,7 +477,7 @@ public class Communicator30 extends BaseCommunicator {
                                if (result.isSuccess()) {
                                        binInfo.setTempBinaryPath(localBinaryPath);
                                }
-                               return result;
+                               continue;
                        }
                }
                return result;
@@ -802,7 +894,7 @@ public class Communicator30 extends BaseCommunicator {
        }
 
        @Override
-       public void setSelectedApp(PackageInfo app) {
+       public void setSelectedApp(AppInfo app) {
                HostResult hr = sendBinaryInfoMessage(app);
                if (!hr.isSuccess()) {
                        System.out.println("binary info get failed :" + hr.getMessage());
@@ -810,8 +902,7 @@ public class Communicator30 extends BaseCommunicator {
        }
 
        public HostResult sendScreenShotRequest() {
-               byte[] msg = ByteUtils.getByte(AnalyzerConstants.MSG_GET_SCREENSHOT, 0,
-                               0);
+               byte[] msg = ByteUtils.getByte(AnalyzerConstants.MSG_GET_SCREENSHOT, 0);
                HostResult result = HostResult.SUCCESS;
                Socket controlSock = DACommunicator.getSelectedDevice()
                                .getControlSock();
@@ -933,10 +1024,10 @@ public class Communicator30 extends BaseCommunicator {
                        BinaryInfo binInfo = new BinaryInfo();
                        binInfo.setTargetBinaryPath(data.getBinaryPath());
 
-                       String key = AnalyzerUtil.getTargetPathKey(binInfo
-                                       .getTargetBinaryPath());
+                       // String key = AnalyzerUtil.getTargetPathKey(binInfo
+                       // .getTargetBinaryPath());
                        DACommunicator.getSelectedApp().getBinaryInfoMap()
-                                       .put(key, binInfo);
+                                       .put(binInfo.getTargetBinaryPath(), binInfo);
                        binInfoList.add(binInfo);
                }
 
index 79b7a70..64fe73b 100755 (executable)
@@ -45,7 +45,7 @@ import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
 import org.tizen.dynamicanalyzer.handlers.StopHandler;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
 import org.tizen.dynamicanalyzer.swap.channel.data.LibraryObject;
 import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
@@ -241,11 +241,10 @@ public class MessageParser {
 
                // User Call Trace : App is Tizen C++ or Tizen native
                String applicationType = DACommunicator.getSelectedApp().getInfo(
-                               PackageInfo.APPTYPE_INDEX);
-               if (applicationType.contains(PackageInfo.APPTYPE_CPP)) {
+                               AppInfo.APPTYPE_INDEX);
+               if (applicationType.contains(AppInfo.APPTYPE_CPP)) {
                        SWAPLogParser.setDropCallTraceLog(true);
                }
-
                AnalyzerManager.setProcessInfoArrived(true);
        }
 
@@ -361,16 +360,19 @@ public class MessageParser {
        }
 
        private void processTerminate() {
-               if (!AnalyzerManager.isExit()) {
-                       Display.getDefault().syncExec(new Runnable() {
-                               @Override
-                               public void run() {
-                                       StopProcessManager.getInstance().stopProcessStart(
-                                                       AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
-                               }
-                       });
+               // if (!AnalyzerManager.isExit()) {
+               // Display.getDefault().syncExec(new Runnable() {
+               // @Override
+               // public void run() {
+               // StopProcessManager.getInstance().stopProcessStart(
+               // AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
+               // }
+               // });
+               // }
+               AnalyzerManager.decreaseProcessCount();
+               if (AnalyzerManager.getProcessCount() == 0) {
+                       DACommunicator.setRunning(false);
                }
-               DACommunicator.setRunning(false);
        }
 
        public void startMessageParsing(Socket dataSocket) {
@@ -451,7 +453,9 @@ public class MessageParser {
                                processMessage(buffer);
                                if (id == DataChannelConstants.MSG_DATA_TERMINATE) {
                                        System.out.println("message data terminate arrived!!!");
-                                       break;
+                                       if (AnalyzerManager.getProcessCount() == 0) {
+                                               break;
+                                       }
                                }
                        } // end while()
                        System.out.println("Receive thread end!!");
@@ -509,6 +513,7 @@ public class MessageParser {
                switch (id) {
                case DataChannelConstants.MSG_DATA_PROCESS_INFO:
                        // setting process info
+                       AnalyzerManager.increseProcessCount();
                        processProcessInfo(data);
                        break;
                case DataChannelConstants.MSG_PROCESS_MAP:
@@ -549,10 +554,16 @@ public class MessageParser {
                        break;
                }
 
+               // if (log != null) {
+               // System.out.println("pid : " + log.getPid());
+               // if (log.getPid() == 0
+               // && log.getId() != DataChannelConstants.MSG_DATA_SYSTEM) {
+               // System.out.println("debug");
+               // }
+               // }
                if (MSG_BUFFER_MAX <= messageCount) {
                        addBufferToList();
                        messageCount = 0;
                }
        }
-
 }
index 3f9bb2d..9637b70 100755 (executable)
@@ -141,7 +141,6 @@ public class SWAPLogParser implements Runnable {
                        LogData log = logLumb.get(i);
                        int id = log.getId();
                        int seqNum = log.getSeq();
-
                        if (log instanceof SystemData) {
                                if (seqNum == 1) {
                                        UIRecorderPlayThread rp = UIRecorderTool.getInstance()
@@ -159,6 +158,7 @@ public class SWAPLogParser implements Runnable {
                                if (id != DataChannelConstants.MSG_DATA_SAMPLE) {
                                        ProfileData pData = (ProfileData) log;
                                        long pcAddr = pData.getPcAddr();
+                                       
                                        String apiName = pData.getApiName();
                                        if (null == apiName || apiName.isEmpty()
                                                        || apiName.equals("_end")) { //$NON-NLS-1$
@@ -171,7 +171,6 @@ public class SWAPLogParser implements Runnable {
                                                        pData.setApiName(apiName);
                                                }
                                        }
-
                                        if (isDropCallTraceLog()) {
                                                apiName = pData.getApiName();
                                                if (apiName.contains(OSP_MAIN)) {
@@ -203,19 +202,20 @@ public class SWAPLogParser implements Runnable {
                                        // + "   base addr : "
                                        // + AnalyzerUtil.toHexdecimal(processInfo
                                        // .getLowestAddress()));
+
                                        pushLog(log, logPack);
-                                       
-                                       if(pcAddr >= processInfo.getLowestAddress()
-                                                       && pcAddr <= processInfo.getHighestAddress())
-                                       {
-                                       /* user callstack create by entry and exit */
-                                               AnalyzerManager.getCallstackManager().makeUserCallstack(
-                                                               pData,
-                                                               FunctionUsageProfiler.getInstance()
-                                                                               .getProfileDataMaker());
+
+                                       if (pcAddr >= processInfo.getLowestAddress()
+                                                       && pcAddr <= processInfo.getHighestAddress()) {
+                                               /* user callstack create by entry and exit */
+                                               AnalyzerManager.getCallstackManager()
+                                                               .makeUserCallstack(
+                                                                               pData,
+                                                                               FunctionUsageProfiler.getInstance()
+                                                                                               .getProfileDataMaker());
                                        } else {
                                                AnalyzerManager.getCallstackManager()
-                                               .makeCallstackWithoutBacktrace(pData);                                          
+                                                               .makeCallstackWithoutBacktrace(pData);
                                        }
                                } else {
                                        pushLog(log, logPack);
index d69a584..a2d0a57 100644 (file)
@@ -109,7 +109,6 @@ public class ProfileData extends LogData {
                        ArgsInfo retInfo = LogDataUtils.parseReturn(data, index);
                        ret = retInfo.getArgs();
                        index = retInfo.getLastIndex();
-                       // ret = ByteUtils.toLong(data, index);
                        break;
                case MSG_CONTEXT_SWITCH_ENTRY:
                case MSG_CONTEXT_SWITCH_EXIT:
index e08205a..15abfc0 100644 (file)
@@ -32,7 +32,7 @@ import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.common.SymbolManager;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
@@ -102,9 +102,9 @@ public class CallStackUnit {
                                                .demanglingFunctionName(prevFunctionName);
                        }
                } else {
-                       PackageInfo selectedApp = DACommunicator.getSelectedApp();
+                       AppInfo selectedApp = DACommunicator.getSelectedApp();
                        if (DACommunicator.isDeviceConnected() && null != selectedApp
-                                       && path.equals(selectedApp.getInfo(PackageInfo.EXEC_INDEX))
+                                       && path.equals(selectedApp.getInfo(AppInfo.EXEC_INDEX))
                                        && AnalyzerManager.isOsp()) {
                                path += ".exe"; //$NON-NLS-1$
                        }
index 33eaf8f..7928e8b 100755 (executable)
@@ -54,7 +54,7 @@ import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
@@ -92,7 +92,7 @@ public class ToolbarArea {
        public static final int REPLAY_EDIT_BUTTON = 9;
 
        String selectedDevice = null;
-       PackageInfo selectedApp = null;
+       AppInfo selectedApp = null;
 
        private Shell shell;
        private static ToolbarArea coolbarArea;
@@ -139,11 +139,11 @@ public class ToolbarArea {
                this.selectedDevice = selectedDevice;
        }
 
-       public PackageInfo getSelectedApp() {
+       public AppInfo getSelectedApp() {
                return selectedApp;
        }
 
-       public void setSelectedApp(PackageInfo selectedApp) {
+       public void setSelectedApp(AppInfo selectedApp) {
                this.selectedApp = selectedApp;
        }
 
@@ -320,14 +320,14 @@ public class ToolbarArea {
                        public void selectionEvent(DACustomCombo combo) {
                                String appName = combo.getText();
                                if (null != appName && !appName.isEmpty()) {
-                                       PackageInfo selectedApp = DACommunicator
+                                       AppInfo selectedApp = DACommunicator
                                                        .getPkgInfoByName(appName);
 
                                        if (null != selectedApp) {
                                                DACommunicator.setSelectedApp(selectedApp);
                                                setSelectedApp(selectedApp);
                                                DACommunicator.getSelectedDevice().setSelectedAppName(
-                                                               selectedApp.getInfo(PackageInfo.LABEL_INDEX));
+                                                               selectedApp.getInfo(AppInfo.LABEL_INDEX));
                                        }
 
                                        if (null != DACommunicator.getSelectedDevice()) {
@@ -346,7 +346,7 @@ public class ToolbarArea {
                        @Override
                        public void handleEvent(Event event) {
                                if (!appCombo.isChildShellOpened()) {
-                                       List<PackageInfo> apps = DACommunicator
+                                       List<AppInfo> apps = DACommunicator
                                                        .getAppListFromTarget();
                                        if (null == apps || apps.isEmpty()) {
                                                return;
@@ -356,7 +356,7 @@ public class ToolbarArea {
                                        int size = apps.size();
                                        for (int i = 0; i < size; i++) {
                                                appCombo.add(apps.get(i).getInfo(
-                                                               PackageInfo.LABEL_INDEX));
+                                                               AppInfo.LABEL_INDEX));
                                        }
                                        appCombo.setText(selectedApp);
                                }
@@ -850,14 +850,14 @@ public class ToolbarArea {
                appCombo.setEnabled(true);
                appCombo.initCombo();
 
-               List<PackageInfo> apps = DACommunicator.getAppListFromTarget();
+               List<AppInfo> apps = DACommunicator.getAppListFromTarget();
                int size = 0;
                if (null != apps) {
                        size = apps.size();
                }
 
                for (int i = 0; i < size; i++) {
-                       appCombo.add(apps.get(i).getInfo(PackageInfo.LABEL_INDEX));
+                       appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
                }
                if (size > 0) {
                        String appName = DACommunicator.getSelectedDevice()
@@ -867,15 +867,15 @@ public class ToolbarArea {
                                setSelectedApp(apps.get(0));
                                DACommunicator.setSelectedApp(apps.get(0));
                                DACommunicator.getSelectedDevice().setSelectedAppName(
-                                               apps.get(0).getInfo(PackageInfo.LABEL_INDEX));
+                                               apps.get(0).getInfo(AppInfo.LABEL_INDEX));
                        } else {
-                               PackageInfo appInfo = DACommunicator.getPkgInfoByName(appName);
+                               AppInfo appInfo = DACommunicator.getPkgInfoByName(appName);
                                if (null != appInfo) {
                                        appCombo.setText(appName);
                                        setSelectedApp(appInfo);
                                        DACommunicator.setSelectedApp(appInfo);
                                        DACommunicator.getSelectedDevice().setSelectedAppName(
-                                                       appInfo.getInfo(PackageInfo.LABEL_INDEX));
+                                                       appInfo.getInfo(AppInfo.LABEL_INDEX));
                                        startButton.setButtonEnabled(true);
                                } else {
                                        appCombo.setText(appName);
@@ -951,11 +951,11 @@ public class ToolbarArea {
                                appCombo.add(items.get(i));
                        }
                        appCombo.select(COMBO_FIRST_INDEX);
-                       PackageInfo appInfo = DACommunicator.getPkgInfoByName(items.get(0));
+                       AppInfo appInfo = DACommunicator.getPkgInfoByName(items.get(0));
                        if (null != appInfo) {
                                DACommunicator.setSelectedApp(appInfo);
                                DACommunicator.getSelectedDevice().setSelectedAppName(
-                                               appInfo.getInfo(PackageInfo.LABEL_INDEX));
+                                               appInfo.getInfo(AppInfo.LABEL_INDEX));
                                appCombo.setToolTipText(appCombo.getItem(0));
                                startButton.setButtonEnabled(true);
                        } else {
@@ -967,11 +967,11 @@ public class ToolbarArea {
        }
 
        public void setAppComboText(final String text) {
-               PackageInfo appInfo = DACommunicator.getPkgInfoByName(text);
+               AppInfo appInfo = DACommunicator.getPkgInfoByName(text);
                if (null != appInfo) {
                        DACommunicator.setSelectedApp(appInfo);
                        DACommunicator.getSelectedDevice().setSelectedAppName(
-                                       appInfo.getInfo(PackageInfo.LABEL_INDEX));
+                                       appInfo.getInfo(AppInfo.LABEL_INDEX));
                        Display.getDefault().syncExec(new Runnable() {
                                @Override
                                public void run() {
@@ -982,12 +982,12 @@ public class ToolbarArea {
        }
 
        public void setAppComboTextByAppId(String id) {
-               PackageInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(id);
+               AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(id);
                if (null != appInfo) {
                        DACommunicator.setSelectedApp(appInfo);
                        DACommunicator.getSelectedDevice().setSelectedAppName(
-                                       appInfo.getInfo(PackageInfo.LABEL_INDEX));
-                       appCombo.setText(appInfo.getInfo(PackageInfo.LABEL_INDEX));
+                                       appInfo.getInfo(AppInfo.LABEL_INDEX));
+                       appCombo.setText(appInfo.getInfo(AppInfo.LABEL_INDEX));
                }
        }
 
@@ -1166,7 +1166,7 @@ public class ToolbarArea {
                        return false;
                }
 
-               List<PackageInfo> apps = DACommunicator.getAppListFromTarget();
+               List<AppInfo> apps = DACommunicator.getAppListFromTarget();
                if (null == apps || apps.isEmpty()) {
                        return false;
                }
@@ -1174,7 +1174,7 @@ public class ToolbarArea {
                appCombo.initCombo();
                size = apps.size();
                for (int i = 0; i < size; i++) {
-                       appCombo.add(apps.get(i).getInfo(PackageInfo.LABEL_INDEX));
+                       appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
                }
                index = appCombo.getItems().indexOf(selectedApp);
                if (index >= 0) {
index b6d2c73..5a69a84 100755 (executable)
@@ -659,7 +659,7 @@ public class AnalyzerUtil {
                        newLog[9] = CommonConstants.EMPTY;
 
                        if (id == DataChannelConstants.MSG_PROBE_LIFECYCLE) {
-                               System.out.println();
+                               System.out.println("life cycle");
                        }
                        int apiId = ApiNameManager.getApiId(newLog[0]);
                        int pid = initIntPayload(newLog[1]);
@@ -1073,8 +1073,8 @@ public class AnalyzerUtil {
 
        public static String getBinarySourcePath(int pid, long time) {
                String localBinPath = AnalyzerUtil.getProcessLocalBinaryPath(pid, time);
-               String key = getTargetPathKey(localBinPath);
-               BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(key);
+//             String key = getTargetPathKey(localBinPath);
+               BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(localBinPath);
                String sourceBinPath = binInfo.getTempBinaryPath();
                return sourceBinPath;
        }
@@ -1088,8 +1088,8 @@ public class AnalyzerUtil {
                }
 
                String path = processInfo.getMainTargetBinaryPath();
-               String key = getTargetPathKey(path);
-               BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(key);
+//             String key = getTargetPathKey(path);
+               BinaryInfo binInfo = DACommunicator.getSelectedApp().getBinaryInfo(path);
                return binInfo;
        }