INTERNAL: enable to trace library by "Profile with DA" from IDE 13/27413/2
authorgreatim <jaewon81.lim@samsung.com>
Fri, 12 Sep 2014 09:46:51 +0000 (18:46 +0900)
committergreatim <jaewon81.lim@samsung.com>
Mon, 15 Sep 2014 03:13:40 +0000 (12:13 +0900)
refactor BinarySettingManager and BinarySettingData.
add new NL for error and warning shown to DA user.
enable to trace library from IDE by "profile with DA".

Change-Id: I252fe1cd3c15d4cc1d3617368c4abcf87ccab03d
Signed-off-by: greatim <jaewon81.lim@samsung.com>
25 files changed:
org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/FileUtil.java
org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/tool/debuginfo.bat
org.tizen.dynamicanalyzer.workbench/dynamic-analyzer/tool/debuginfo.sh
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AutoStartManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/SymbolManager.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/listeners/AnalyzerPerspectiveListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/listeners/TableTooltipListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.properties [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/BaseCallstackManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/SWAPCallStackManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinarySettingProcessor.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/InputRow.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/SaveSettingDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/RpmUtil.java

index b831a67..6f82b40 100644 (file)
@@ -1,6 +1,18 @@
 package org.tizen.dynamicanalyzer.util;
 
 import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -42,4 +54,85 @@ public class FileUtil {
                return list;
        }
 
+       /**
+        * Search files in given directory with file name glob pattern. Returned
+        * file paths are relative paths to given directory
+        * <p>
+        * For example, if search file with "*.txt" glob pattern and "/home/user/"
+        * target directory for "/home/user/aaa/bbb/ccc.txt", result file path in
+        * the list is "aaa/bbb/ccc.txt"
+        * 
+        * @param dirPath
+        *            root path of searching
+        * @param fileToken
+        *            glob pattern of file name
+        * @return relative file path list
+        */
+       public static List<String> findFilesInDir(String dirPath, String fileToken) {
+               final List<String> resultFiles = new ArrayList<String>();
+
+               final Path startingDir = Paths.get(dirPath).toAbsolutePath();
+               final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + fileToken);
+               try {
+                       Files.walkFileTree(startingDir, new SimpleFileVisitor<Path>() {
+                               private void find(Path path) {
+                                       Path filename = path.getFileName();
+                                       if (filename != null && matcher.matches(filename)) {
+                                               Path relativePath = startingDir.relativize(path);
+                                               resultFiles.add(relativePath.toString());
+                                       }
+                               }
+
+                               @Override
+                               public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+                                       find(dir);
+                                       return FileVisitResult.CONTINUE;
+                               }
+
+                               @Override
+                               public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                                       find(file);
+                                       return FileVisitResult.CONTINUE;
+                               }
+                       });
+               } catch (NoSuchFileException e) {
+                       Logger.warning("starting directory cannot be found");
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+
+               return resultFiles;
+       }
+
+       // return destination file path
+       // if failed, return null
+       public static String copyFileToDir(String src, String destDir, boolean overwrite)
+                       throws FileAlreadyExistsException {
+               File srcfile = new File(src);
+               if (srcfile.isFile()) {
+                       String srcfilename = srcfile.getName();
+                       String dest;
+                       if (destDir.endsWith(File.separator)) {
+                               dest = destDir + srcfilename;
+                       } else {
+                               dest = destDir + File.separator + srcfilename;
+                       }
+
+                       File destfile = new File(dest);
+
+                       try {
+                               if (overwrite) {
+                                       Files.copy(srcfile.toPath(), destfile.toPath(),
+                                                       StandardCopyOption.REPLACE_EXISTING);
+                               } else {
+                                       Files.copy(srcfile.toPath(), destfile.toPath());
+                               }
+                               return dest;
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
+               }
+
+               return null;
+       }
 }
index c3b4b5f..65fb59d 100755 (executable)
@@ -49,7 +49,5 @@ exit /b
 \r
 :list_pkg\r
 echo %1\r
-echo %2\r
-cd %1\r
-%base_dir%\rpm2cpio -l %2\r
+%base_dir%\rpm2cpio -l %1\r
 exit /b
\ No newline at end of file
index f9eb947..fb1b7f4 100755 (executable)
@@ -69,14 +69,12 @@ extract_pkg()
 
 list_pkg()
 {
-       cd $1
-
        case "$OS" in
                ubuntu)
-                       $RPM_COMMAND_UBUNTU $2 | cpio -t
+                       $RPM_COMMAND_UBUNTU $1 | cpio -t
                        ;;
                mac)
-                       $RPM_COMMAND_MAC $2 | cpio -t
+                       $RPM_COMMAND_MAC $1 | cpio -t
                        ;;
                *)
                        echo "unknown OS"
@@ -133,8 +131,8 @@ if [[ -n $1 ]]; then
                        extract_pkg $@
                        ;;
                -l)
-                       if [[ "$#" -ne 3 ]]; then
-                               echo "list needs two arguments!"
+                       if [[ "$#" -ne 2 ]]; then
+                               echo "list needs an argument!"
                                exit 1
                        fi
                        shift
index 62064b2..12198a4 100644 (file)
@@ -46,6 +46,7 @@ public class AnalyzerConstants {
        public static final String LICENSE_FILE_NAME = "license"; //$NON-NLS-1$
        public static final String USER_INTERFACE_API_LIST_FILE_NAME = "user_interface_api_list"; //$NON-NLS-1$
 
+       public static final String LIB_PREFIX = "lib"; //$NON-NLS-1$
        public static final String LIB_EXT = ".so"; //$NON-NLS-1$
        
        public static final String API_NAME_FILE_NAME = "apis"; //$NON-NLS-1$
@@ -344,6 +345,7 @@ public class AnalyzerConstants {
        public final static String CALLSTACK_KEY_TIME = "time";//$NON-NLS-1$
        public final static String CALLSTACK_KEY_LIBNAME = "libName";//$NON-NLS-1$
        
+       public final static String LAUNCH_APP = "launch_app";//$NON-NLS-1$
        public final static String APPCONTROL = "_AppControl";//$NON-NLS-1$
        public final static String RUNNING_PROCESS = "[Running process]";//$NON-NLS-1$
        public final static String WITHOUT_EXECUTABLE = "[Without executable]";//$NON-NLS-1$
index 56a095c..a35bd60 100644 (file)
@@ -89,12 +89,12 @@ public class AutoStartManager implements Runnable {
                final String deviceName = new String(strMsg[MSG_INDEX_DEVICE].trim());
                final String appid = new String(strMsg[MSG_INDEX_APPID].trim());
                final String appName = new String(strMsg[MSG_INDEX_APPNAME].trim());
-//             final String resultPath = new String(
-//                             strMsg[MSG_INDEX_RESULTPATH].trim());
-//
-//             if (!resultPath.isEmpty()) {
-//                     Logger.setPerformanceSaveFilename(resultPath);
-//             }
+               // final String resultPath = new String(
+               // strMsg[MSG_INDEX_RESULTPATH].trim());
+               //
+               // if (!resultPath.isEmpty()) {
+               // Logger.setPerformanceSaveFilename(resultPath);
+               // }
 
                if (isOpenWelcomeDlg()) {
                        Logger.debug("Start -AutoRun Waiting...");
@@ -112,7 +112,7 @@ public class AutoStartManager implements Runnable {
                DeviceInfo device = DACommunicator.getDeviceByName(deviceName);
                GlobalInformation.setCurrentDeviceInfo(device);
 
-               PackageInfo pkgInfo = DACommunicator.getPkgInfoByPkgId(appid);
+               PackageInfo pkgInfo = DACommunicator.getPkgInfoByMainAppID(appid);
                if (null == pkgInfo) {
                        Display.getDefault().syncExec(new Runnable() {
                                public void run() {
@@ -133,8 +133,7 @@ public class AutoStartManager implements Runnable {
                        return;
                }
                final String appLabel = pkgInfo.getMainApp().getInfo(AppInfo.PROPERTY.LABEL.index);
-               Logger.debug("IDE recv - deviceName: " + deviceName
-                               + " appName : " + appLabel);
+               Logger.debug("IDE recv - deviceName: " + deviceName + " appName : " + appLabel);
 
                ToolbarArea.getInstance().setDeviceComboText(deviceName);
                ToolbarArea.getInstance().setAppComboText(appLabel);
index 872fe55..33e24c1 100644 (file)
@@ -62,6 +62,7 @@ import org.tizen.dynamicanalyzer.project.ProcessInformation;
 import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.util.Logger;
 
@@ -144,12 +145,11 @@ public class SymbolManager {
                }
 
                IExecutableSymbolicsReaderFactory provider = new ElfExecutableSymbolicsReaderFactory();
-               IExecutableSymbolicsReader exeReader = provider
-                               .createExecutableSymbolicsReader(path);
+               IExecutableSymbolicsReader exeReader = provider.createExecutableSymbolicsReader(path);
                if (exeReader != null) {
                        IDebugInfoProviderFactory providerProvider = new DwarfDebugInfoProviderFactory();
-                       IDebugInfoProvider dprovider = providerProvider.createDebugInfoProvider(path,
-                                       exeReader);
+                       IDebugInfoProvider dprovider = providerProvider
+                                       .createDebugInfoProvider(path, exeReader);
                        if (dprovider != null) {
                                if (!exeReader.getSymbolFile().equals(
                                                dprovider.getExecutableSymbolicsReader().getSymbolFile())) {
@@ -223,12 +223,11 @@ public class SymbolManager {
                        IModuleLineEntryProvider moduleLineEntryProvider = reader.getModuleScope()
                                        .getModuleLineEntryProvider();
                        if (moduleLineEntryProvider != null) {
-                               ILineEntry lineEntry = moduleLineEntryProvider
-                                               .getLineEntryAtAddress(addr);
+                               ILineEntry lineEntry = moduleLineEntryProvider.getLineEntryAtAddress(addr);
                                if (lineEntry != null) {
                                        if (lineEntry.getLowAddress().compareTo(addr) == 0) {
-                                               ILineEntry prevEntry = moduleLineEntryProvider
-                                                               .getPreviousLineEntry(lineEntry, false);
+                                               ILineEntry prevEntry = moduleLineEntryProvider.getPreviousLineEntry(
+                                                               lineEntry, false);
                                                if (prevEntry != null) {
                                                        srcline.setLineEntry(prevEntry);
                                                        return srcline;
@@ -375,17 +374,18 @@ public class SymbolManager {
                        } else {
                                // if address is not in main executable binary of process
                                // search address in binary of "binary setting configuration"
-                               HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
-                                               .getInstance().getTargetBinInfoMap();
+                               List<BinarySettingData> binDataList = BinarySettingManager.getInstance()
+                                               .getBinarySettingList();
                                List<String> binPaths = new ArrayList<String>();
-                               binPaths.addAll(binInfoMap.keySet());
+                               for (BinarySettingData binData : binDataList) {
+                                       binPaths.add(binData.getBinaryPath());
+                               }
 
                                LibraryObject libraryObject = null;
                                int size = binPaths.size();
                                for (int i = 0; i < size; i++) {
                                        String binPath = binPaths.get(i);
-                                       BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(
-                                                       binPath);
+                                       BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(binPath);
                                        LibraryObject libObj = pmap.getLibraryByBinaryID(bininfo.getID());
                                        if (null == libObj) {
                                                continue;
@@ -402,15 +402,8 @@ public class SymbolManager {
                                // if found binary of address in "binary setting configuration"
                                if (null != libraryObject) {
                                        int binaryID = libraryObject.getBinaryID();
-                                       BinaryInfo binfo = project.getDeviceStatusInfo().getBinaryInfo(
-                                                       binaryID);
-                                       String path = null;
-                                       if (binfo != null) {
-                                               path = binfo.getTargetBinaryPath();
-                                       }
-
-                                       BinaryInfo binInfo = binInfoMap.get(path);
-                                       if (null != binInfo) {
+                                       BinaryInfo binInfo = project.getDeviceStatusInfo().getBinaryInfo(binaryID);
+                                       if (binInfo != null) {
                                                String localPath = binInfo.getTempBinaryPath();
                                                String baseAddr = Long.toString(libraryObject.getLowestAddress());
                                                String pcStr = Long.toString(address);
@@ -423,6 +416,7 @@ public class SymbolManager {
                                }
                        }
                }
+
                // _end indicates end of BSS (uninitialized data) section
                // function entry of _end is considered as bad data
                // TODO: test and remove _end condition
index 2f9a94a..8bee963 100644 (file)
@@ -29,7 +29,6 @@ import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.DAEMONLOG_COUNT
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.DAEMONLOG_PREFIX;
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.DA_VERSION_OLD;
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.DA_VERSION_SWAP;
-import static org.tizen.sdblib.receiver.LsReceiver.CMD_LS_WITH_STYLE;
 import static org.tizen.sdblib.util.DeviceUtil.isOnline;
 
 import java.io.BufferedReader;
@@ -369,6 +368,23 @@ public class DACommunicator {
                return processName;
        }
 
+       public static PackageInfo getPkgInfoByMainAppID(String appid) {
+               DeviceInfo curDev = GlobalInformation.getCurrentDeviceInfo();
+               if (null != curDev) {
+                       Map<String, PackageInfo> pkgHash = curDev.getPackageInfoHash();
+
+                       for (Map.Entry<String, PackageInfo> entry : pkgHash.entrySet()) {
+                               AppInfo app = entry.getValue().getMainApp();
+                               String id = app.getInfo(AppInfo.PROPERTY.APPID.index);
+                               if (appid.equals(id)) {
+                                       return entry.getValue();
+                               }
+                       }
+               }
+
+               return null;
+       }
+
        public static PackageInfo getPkgInfoByLabel(String appLabel) {
                DeviceInfo curDev = GlobalInformation.getCurrentDeviceInfo();
                if (null != curDev) {
index e98e094..ebdb483 100644 (file)
@@ -41,8 +41,8 @@ import java.net.Socket;
 import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
@@ -53,9 +53,12 @@ import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels;
 import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -256,6 +259,67 @@ public class IDECommunicator implements Runnable {
 
        }
 
+       // return null if succeed
+       // otherwise return error string for popup
+       private String binarySettingWithRPM(String mainrpm, String debugrpm, String srcrpm) {
+               if (mainrpm == null) {
+                       return UserErrorWarningLabels.ERROR_LIBTRACE_START + CommonConstants.NEW_LINE
+                                       + UserErrorWarningLabels.ERROR_RPM_NOT_FOUND;
+               }
+
+               List<String> libfilelist = new ArrayList<String>();
+               List<String> filelist = RpmUtil.getFileListInRpm(mainrpm);
+               int filecount = filelist.size();
+               for (int i = 0; i < filecount; i++) {
+                       String filepath = filelist.get(i);
+                       int index = filepath.lastIndexOf("/");
+                       String filename = filepath.substring(index + 1);
+                       // search for libxxx.so or libxxx.so.x.x (library files)
+                       if (filename.endsWith(AnalyzerConstants.LIB_EXT)
+                                       || filename.contains(AnalyzerConstants.LIB_EXT + CommonConstants.DOT)) {
+                               libfilelist.add(filepath);
+                       }
+               }
+
+               if (libfilelist.size() == 0) {
+                       return UserErrorWarningLabels.ERROR_LIBTRACE_START + CommonConstants.NEW_LINE
+                                       + UserErrorWarningLabels.ERROR_LIB_NOT_FOUND_INRPM;
+               }
+
+               // remove duplicated shared libraries
+               Collections.sort(libfilelist);
+               List<String> finallist = new ArrayList<String>();
+               int size = libfilelist.size();
+               String prev = libfilelist.get(0);
+               for (int i = 1; i < size; i++) {
+                       if (!libfilelist.get(i).startsWith(prev)) {
+                               finallist.add(prev);
+                       }
+                       prev = libfilelist.get(i);
+               }
+               finallist.add(prev);
+
+               // make binary setting data
+               List<BinarySettingData> addBinData = new ArrayList<BinarySettingData>();
+               for (String binPath : finallist) {
+                       BinarySettingData binaryData = new BinarySettingData();
+                       binaryData.setBinaryPath(binPath);
+                       if (debugrpm != null) {
+                               binaryData.setDebugRpmPath(debugrpm);
+                       }
+                       if (srcrpm != null) {
+                               binaryData.setSourceRpmPath(srcrpm);
+                       }
+                       addBinData.add(binaryData);
+               }
+               BinarySettingManager.getInstance().addBinarySettingData(addBinData);
+               BinarySettingManager.getInstance().checkSourcePath(addBinData);
+               DACommunicator.sendBinaryInfoMessageForLib(addBinData);
+               DACommunicator.sendSWAPMessage(AnalyzerConstants.MSG_SWAP_INST_ADD, addBinData);
+
+               return null;
+       }
+
        // trace Application
        private void autoStartApplication(String[] strMsg) {
                if (strMsg.length < MSG_DEFAULT_LENGTH) {
@@ -293,77 +357,100 @@ public class IDECommunicator implements Runnable {
                PackageInfo pkgInfo = null;
                if (projectType.equals(PROJECT_TYPE_OSP) || projectType.equals(PROJECT_TYPE_EFL)
                                || projectType.equals(PROJECT_TYPE_WEBAPP)) {
-                       pkgInfo = DACommunicator.getPkgInfoByPkgId(binaryOfTarget);
+                       pkgInfo = DACommunicator.getPkgInfoByMainAppID(binaryOfTarget);
                        if (pkgInfo == null) {
                                popupMessageUnsupportedApp(binaryOfTarget);
+                               ToolbarArea.getInstance().setToolbarStartStopState(true);
                                return;
                        }
 
                        if (localPackagePathList.size() > 0) {
                                pkgInfo.getMainApp().setLocalPackagePath(localPackagePathList);
                        }
+               } else if (projectType.equals(PROJECT_TYPE_LIBRARY)) {
+                       if (localPackagePathList.size() == 0) {
+                               Logger.error("rpm package for library is not set");
+                               popupMessage(UserErrorWarningLabels.ERROR_LIBTRACE_START + CommonConstants.NEW_LINE
+                                               + UserErrorWarningLabels.ERROR_RPM_NOT_FOUND);
+                               ToolbarArea.getInstance().setToolbarStartStopState(true);
+                               return;
+                       }
 
-                       final String appLabel = pkgInfo.getMainApp().getInfo(AppInfo.PROPERTY.LABEL.index);
-                       Logger.debug("IDE recv - deviceName: " + deviceName + " appName : " + appLabel);
+                       String mainrpm = null;
+                       String debugrpm = null;
+                       String srcrpm = null;
 
-                       Display.getDefault().syncExec(new Runnable() {
-                               public void run() {
-                                       ToolbarArea.getInstance().setDeviceComboText(deviceName);
-                                       ToolbarArea.getInstance().setAppComboText(appLabel);
-                                       ToolbarArea.getInstance().startTrace();
+                       for (int i = 0; i < localPackagePathList.size(); i++) {
+                               String path = localPackagePathList.get(i);
+                               if (!path.endsWith(RpmUtil.RPM_EXT)) {
+                                       continue;
                                }
-                       });
 
-                       SingletonFocusManager.setFocusToDA();
-               } else if (projectType.equals(PROJECT_TYPE_LIBRARY)) {
-                       if (localPackagePathList.size() > 0) {
-                               String mainrpm = null;
-                               String debugrpm = null;
-                               String srcrpm = null;
-
-                               for (int i = 0; i < localPackagePathList.size(); i++) {
-                                       String path = localPackagePathList.get(i);
-                                       if (path.endsWith(RpmUtil.RPM_EXT) && path.contains(RpmUtil.DEBUGINFO)) {
-                                               debugrpm = path;
-                                       } else if (path.endsWith(RpmUtil.RPM_EXT) && path.contains(RpmUtil.DEBUGSOURCE)) {
-                                               srcrpm = path;
-                                       } else if (path.endsWith(RpmUtil.RPM_EXT)) {
-                                               mainrpm = path;
-                                       }
+                               if (path.contains(RpmUtil.DEBUGINFO)) {
+                                       debugrpm = path;
+                               } else if (path.contains(RpmUtil.DEBUGSOURCE)) {
+                                       srcrpm = path;
+                               } else if (!path.contains(RpmUtil.DEVEL)) {
+                                       mainrpm = path;
                                }
+                       }
+                       
+                       String errormsg = binarySettingWithRPM(mainrpm, debugrpm, srcrpm);
+                       if(errormsg != null) {
+                               Logger.error("error during binary setting wit rpm");
+                               popupMessage(errormsg);
+                               ToolbarArea.getInstance().setToolbarStartStopState(true);
+                               return;
+                       }
 
-                               if (mainrpm != null) {
-                                       List<String> libfilelist = new ArrayList<String>();
-                                       List<String> filelist = RpmUtil.getFileListInRpm(mainrpm);
-                                       int filecount = filelist.size();
-                                       for (int i = 0; i < filecount; i++) {
-                                               String filepath = filelist.get(i);
-                                               int index = filepath.lastIndexOf("/");
-                                               String filename = filepath.substring(index + 1);
-                                               // search for libxxx.so or libxxx.so.x.x (library files)
-                                               if (filename.endsWith(AnalyzerConstants.LIB_EXT)
-                                                               || filename.contains(AnalyzerConstants.LIB_EXT
-                                                                               + CommonConstants.DOT)) {
-                                                       libfilelist.add(filepath);
-                                               }
-                                       }
-
-                                       if (libfilelist.size() > 0) {
-
-                                       } else {
-                                               Logger.error("there is no library in rpm for library tracing");
-                                               popupMessage("Library tracing cannot be started.\nLibrary is not found in rpm.");
+                       // start trace
+                       // first, get applabel to execute
+                       if (executablePath.contains(AnalyzerConstants.LAUNCH_APP)) {
+                               // launch with launchpad
+                               int index = executablePath.indexOf(AnalyzerConstants.LAUNCH_APP)
+                                               + AnalyzerConstants.LAUNCH_APP.length() + 1;
+                               if (index < executablePath.length()) {
+                                       String appID = executablePath.substring(index).trim();
+                                       pkgInfo = DACommunicator.getPkgInfoByMainAppID(appID);
+                                       if (pkgInfo == null) {
+                                               popupMessageUnsupportedApp(appID);
+                                               ToolbarArea.getInstance().setToolbarStartStopState(true);
+                                               return;
                                        }
                                } else {
-                                       Logger.error("there is no main rpm for library tracing");
-                                       popupMessage("Library tracing cannot be started.\nRpm is not found.");
+                                       // there is no appid
+                                       Logger.error("there is no appid for library tracing");
+                                       popupMessage(UserErrorWarningLabels.ERROR_LIBTRACE_START
+                                                       + CommonConstants.NEW_LINE
+                                                       + UserErrorWarningLabels.ERROR_NO_APPID_FOR_LAUNCHPAD);
+                                       ToolbarArea.getInstance().setToolbarStartStopState(true);
+                                       return;
                                }
                        } else {
-                               Logger.error("rpm package for library is not set");
+                               // launch by common executable
+                               pkgInfo = DACommunicator.getPkgInfoByPkgId(AnalyzerConstants.COMMON_EXECUTABLE);
+                               AppInfo mainapp = pkgInfo.getMainApp();
+                               mainapp.setInfo(AppInfo.PROPERTY.EXEC.index, executablePath);
                        }
-               } else {
+               } else { // projectType is not in (EFL, WEBAPP, OSP, LIBRARY)
                        // TODO : get appInfo from executable path
                        popupMessageUnsupportedApp(executablePath);
+                       ToolbarArea.getInstance().setToolbarStartStopState(true);
+               }
+
+               if (pkgInfo != null) {
+                       final String appLabel = pkgInfo.getMainApp().getInfo(AppInfo.PROPERTY.LABEL.index);
+                       Logger.debug("IDE recv - deviceName: " + deviceName + " appName : " + appLabel);
+
+                       Display.getDefault().syncExec(new Runnable() {
+                               public void run() {
+                                       ToolbarArea.getInstance().setDeviceComboText(deviceName);
+                                       ToolbarArea.getInstance().setAppComboText(appLabel);
+                                       ToolbarArea.getInstance().startTrace();
+                               }
+                       });
+
+                       SingletonFocusManager.setFocusToDA();
                }
        }
 
index 04e8dd7..9c435e5 100644 (file)
@@ -39,14 +39,12 @@ import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
 import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.dynamicanalyzer.workbench.SingletonFocusManager;
 
 public class AnalyzerPerspectiveListener extends PerspectiveAdapter {
        private static boolean init = false;
 
        @Override
-       public void perspectiveActivated(IWorkbenchPage page,
-                       IPerspectiveDescriptor perspective) {
+       public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
 
                if (!init) {
                        ToolbarArea.getInstance().initToolbarEnablement();
@@ -61,8 +59,7 @@ public class AnalyzerPerspectiveListener extends PerspectiveAdapter {
 
                        IDECommunicator.startIDECommunicatorThread();
                        Logger.performance("TEST", "DA Start", "Start IDE Communicator");
-                       ConfigurationDialogDataManager.getInstance()
-                                       .updateFeaturesValueFromConfigureManager();
+                       ConfigurationDialogDataManager.getInstance().updateFeaturesValueFromConfigureManager();
 
                        ExecutionCallbackManager.registerCallback(
                                        ExecutionCallbackManager.WINDOWADVISOR_POSTWINDOWOPEN,
@@ -76,8 +73,7 @@ public class AnalyzerPerspectiveListener extends PerspectiveAdapter {
        }
 
        @Override
-       public void perspectiveDeactivated(IWorkbenchPage page,
-                       IPerspectiveDescriptor perspective) {
+       public void perspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
                DACommunicator.removeDeviceListener();
        }
 
index 670c882..10a02b7 100644 (file)
@@ -450,15 +450,15 @@ public class TableTooltipListener implements Listener {
                String libName = getLibPath(item);
 
                BinarySettingData binData = BinarySettingManager.getInstance()
-                               .getRealBinarySetting(libName);
+                               .getBinarySetting(libName);
 
                if (null != binData) {
-                       if (null != binData.getUserSourcePath()
-                                       && !binData.getUserSourcePath().isEmpty()) {
+                       if (null != binData.getUserSourceDir()
+                                       && !binData.getUserSourceDir().isEmpty()) {
                                String fileName = getSourceFilePath(sourceLine.getFilePath());
-                               filePath = binData.getUserSourcePath() + File.separator + fileName;
+                               filePath = binData.getUserSourceDir() + File.separator + fileName;
                        } else {
-                               filePath = binData.getDebugSourcePath() + sourceLine.getFilePath();
+                               filePath = binData.getRpmSourceDir() + sourceLine.getFilePath();
                        }
                } else {
                        AppInfo appInfo = AnalyzerManager.getProject().getApplicationInfo();
@@ -564,7 +564,7 @@ public class TableTooltipListener implements Listener {
                baseAddr = Long.toString(libobj.getLowestAddress());
 
                BinarySettingData binData = BinarySettingManager.getInstance()
-                               .getRealBinarySetting(binInfo.getTargetBinaryPath());
+                               .getBinarySetting(binInfo.getTargetBinaryPath());
                if (null != binData) { // binary for the address is set in binary setting
                        String debugPath = binData.getDebugFilePath();
                        if (null != debugPath && !debugPath.isEmpty()) {
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.java
new file mode 100644 (file)
index 0000000..3afe642
--- /dev/null
@@ -0,0 +1,23 @@
+package org.tizen.dynamicanalyzer.nl;
+
+import org.eclipse.osgi.util.NLS;
+
+public class UserErrorWarningLabels extends NLS {
+       private static final String BUNDLE_NAME = "org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels"; //$NON-NLS-1$
+
+       public static String ERROR_LIBTRACE_START;
+       public static String ERROR_RPM_NOT_FOUND;
+       public static String ERROR_LIB_NOT_FOUND_INRPM;
+       public static String ERROR_NO_APPID_FOR_LAUNCHPAD;
+
+       public static String WARNING_PATH_NOT_FOUND;
+       public static String WARNING_FILE_NOT_FOUND;
+       
+       static {
+               NLS.initializeMessages(BUNDLE_NAME, UserErrorWarningLabels.class);
+       }
+
+       private UserErrorWarningLabels() {
+       }
+
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.properties
new file mode 100644 (file)
index 0000000..e4b8c64
--- /dev/null
@@ -0,0 +1,7 @@
+ERROR_LIBTRACE_START=Library tracing cannot be started properly.
+ERROR_RPM_NOT_FOUND=Library rpm package file cannot be found.
+ERROR_LIB_NOT_FOUND_INRPM=Library file cannot be found in rpm package.
+ERROR_NO_APPID_FOR_LAUNCHPAD=There is no appid for launch_app.
+
+WARNING_PATH_NOT_FOUND=Path cannot be found.
+WARNING_FILE_NOT_FOUND=File cannot be found.
\ No newline at end of file
index ca14521..7148fda 100644 (file)
@@ -31,7 +31,6 @@ import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -44,6 +43,7 @@ import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
+import org.tizen.dynamicanalyzer.util.FileUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.RpmUtil;
@@ -102,17 +102,13 @@ public class AppInfo {
        public static final String FLAG_ZERO = "0";//$NON-NLS-1$
        public static final String FLAG_ONE = "1";//$NON-NLS-1$
 
-       public static final String DEBUGPKGTYPE_DEBUG = "debug-";//$NON-NLS-1$
-       public static final String DEBUGPKGTYPE_DEBUGINFO = "debuginfo";//$NON-NLS-1$
-       public static final String DEBUGPKGTYPE_DEBUGSOURCE = "debugsource";//$NON-NLS-1$
-
        private ElfSymbolExtractor symbolExtractor = new ElfSymbolExtractor();
 
        private String execFileName = null;
        private List<String> localPackagePath = null;
        private Map<Integer, String> runningProcesses = null;
        private String execPath = null;
-       
+
        private static List<String> readlinkResult = new ArrayList<String>();
        private List<String> properties = new ArrayList<String>();
 
@@ -153,16 +149,16 @@ public class AppInfo {
 
        public String getExecFileName() {
                if (null == execFileName) {
-//                     String[] splitPath = properties.get(PROPERTY.EXEC.index).split(
-//                                     CommonConstants.SLASH);
-//                     if (getAppType().contains(APPTYPE_CPP)) {
-//                             execFileName = splitPath[splitPath.length - 1]
-//                                             + CommonConstants.EXTENSION_EXEC_FILE;
-//                     } else {
-//                             execFileName = splitPath[splitPath.length - 1];
-//                     }
+                       // String[] splitPath = properties.get(PROPERTY.EXEC.index).split(
+                       // CommonConstants.SLASH);
+                       // if (getAppType().contains(APPTYPE_CPP)) {
+                       // execFileName = splitPath[splitPath.length - 1]
+                       // + CommonConstants.EXTENSION_EXEC_FILE;
+                       // } else {
+                       // execFileName = splitPath[splitPath.length - 1];
+                       // }
                        String[] splitPath = getExecPath().split(CommonConstants.SLASH);
-                       execFileName = splitPath[splitPath.length - 1];         
+                       execFileName = splitPath[splitPath.length - 1];
                }
                return execFileName;
        }
@@ -188,9 +184,9 @@ public class AppInfo {
                if (localPackagePath != null) {
                        int psize = localPackagePath.size();
                        for (int i = 0; i < psize; i++) {
-                               if (localPackagePath.get(i).contains(DEBUGPKGTYPE_DEBUGINFO)) {
+                               if (localPackagePath.get(i).contains(RpmUtil.DEBUGINFO)) {
                                        getDebugFilePathFromDebugRpm(localPackagePath.get(i));
-                               } else if (localPackagePath.get(i).contains(DEBUGPKGTYPE_DEBUGSOURCE)) {
+                               } else if (localPackagePath.get(i).contains(RpmUtil.DEBUGSOURCE)) {
                                        getSourcePathFromSourceRpm(localPackagePath.get(i));
                                }
                        }
@@ -243,97 +239,29 @@ public class AppInfo {
 
                // extract rpm file
                if (null != copiedRpmPath) {
-                       String toolPath = PathManager.getDebugInfoScript();
-                       String[] command = null;
-                       command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", rpmPath, debugRpmPath };
-                       try {
-                               Runtime rt = Runtime.getRuntime();
-                               Process process = rt.exec(command);
-                               process.waitFor();
-                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                               process.getInputStream()));
-                               String line = null;
-                               int lineCount = 0;
-                               while (null != (line = reader.readLine())) {
-                                       lineCount++;
-                                       if (lineCount == 1) {
-                                               Logger.debug("CHANGE DIR : " + line);
-                                       } else {
-                                               Logger.debug("EXTRACT RPM : " + line);
-                                       }
-                               }
-                               if (lineCount == 0) {
-                                       BufferedReader error = new BufferedReader(new InputStreamReader(
-                                                       process.getErrorStream()));
-                                       String errorStr = error.readLine();
-                                       Logger.debug("debug info file extract failed... : " + errorStr);
-                                       return;
-                               }
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                               return;
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
+                       boolean extracted = RpmUtil.extractRpm(rpmPath, copiedRpmPath);
+                       if (!extracted) {
                                return;
                        }
                }
 
                // check debuginfo file path
-               if (debugInfoRpmFile.getName().contains(DEBUGPKGTYPE_DEBUGINFO)) {
-                       String debugCmd = PathManager.getDebugInfoScript()      + " "
-                                       + RpmUtil.getDebugInfoOption() + " -f " + rpmPath 
-                                       + CommonConstants.SPACE + getExecFileName() + ".debug";
-                       try {
-                               Runtime rt = Runtime.getRuntime();
-                               Process process = rt.exec(debugCmd);
-                               process.waitFor();
-                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                               process.getInputStream()));
-                               String line = reader.readLine();
-                               if (null == line) {
-                                       BufferedReader error = new BufferedReader(new InputStreamReader(
-                                                       process.getErrorStream()));
-                                       String errorStr = error.readLine();
-                                       Logger.debug("debug info file find failed... : " + errorStr);
-                                       return;
-                               }
-                               debugFilePath = rpmPath + line.substring(1, line.length());
-                               Logger.debug("DEBUG PATH : " + debugFilePath);
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                               return;
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
+               if (debugInfoRpmFile.getName().contains(RpmUtil.DEBUGINFO)) {
+                       List<String> files = FileUtil.findFilesInDir(rpmPath, getExecFileName() + ".debug");
+                       if (files.size() == 0) {
                                return;
+                       } else {
+                               debugFilePath = rpmPath + File.separator + files.get(0);
+                               Logger.debug("DEBUG PATH : " + debugFilePath);
                        }
-
                        // future extension for applications with normal debug package
-               } else if (debugInfoRpmFile.getName().contains(DEBUGPKGTYPE_DEBUG)) {
-                       String debugCmd = PathManager.getDebugInfoScript() + " "
-                                       + RpmUtil.getDebugInfoOption() + " -f " 
-                                       + rpmPath + CommonConstants.SPACE + getExecFileName();
-                       try {
-                               Runtime rt = Runtime.getRuntime();
-                               Process process = rt.exec(debugCmd);
-                               process.waitFor();
-                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                               process.getInputStream()));
-                               String line = reader.readLine();
-                               if (null == line) {
-                                       BufferedReader error = new BufferedReader(new InputStreamReader(
-                                                       process.getErrorStream()));
-                                       String errorStr = error.readLine();
-                                       Logger.debug("debug info file find failed... : " + errorStr);
-                                       return;
-                               }
-                               debugFilePath = rpmPath + line.substring(1, line.length());
-                               Logger.debug("DEBUG PATH : " + debugFilePath);
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                               return;
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
+               } else if (debugInfoRpmFile.getName().contains(RpmUtil.DEBUG)) {
+                       List<String> files = FileUtil.findFilesInDir(rpmPath, getExecFileName());
+                       if (files.size() == 0) {
                                return;
+                       } else {
+                               debugFilePath = rpmPath + File.separator + files.get(0);
+                               Logger.debug("DEBUG PATH : " + debugFilePath);
                        }
                } else {
                        return;
@@ -359,7 +287,7 @@ public class AppInfo {
                // get source project name
                // (ex. pr-debugsource-0.0.0-1.1.i586.rpm -> pr-0.0.0)
                String debugsourceRpmFileName = debugsourceRpmFile.getName();
-               int index = debugsourceRpmFileName.indexOf(DEBUGPKGTYPE_DEBUGSOURCE);
+               int index = debugsourceRpmFileName.indexOf(RpmUtil.DEBUGSOURCE);
                String project = debugsourceRpmFileName.substring(0, index);
                String[] splitSrcRpmFileName = debugsourceRpmFileName.split(CommonConstants.DASH);
                String version = splitSrcRpmFileName[splitSrcRpmFileName.length - 2];
@@ -385,68 +313,18 @@ public class AppInfo {
 
                // extract rpm file
                if (null != copiedRpmPath) {
-                       String toolPath = PathManager.getDebugInfoScript();
-                       String[] command = null;
-                       command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", rpmPath, sourceRpmPath };
-
-                       try {
-                               Runtime rt = Runtime.getRuntime();
-                               Process process = rt.exec(command);
-                               process.waitFor();
-                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                               process.getInputStream()));
-                               String line = null;
-                               int lineCount = 0;
-                               while (null != (line = reader.readLine())) {
-                                       lineCount++;
-                                       if (lineCount == 1) {
-                                               Logger.debug("CHANGE DIR : " + line);
-                                       } else {
-                                               Logger.debug("EXTRACT RPM : " + line);
-                                       }
-                               }
-                               if (lineCount == 0) {
-                                       BufferedReader error = new BufferedReader(new InputStreamReader(
-                                                       process.getErrorStream()));
-                                       String errorStr = error.readLine();
-                                       Logger.debug("debug source file extract failed... : " + errorStr);
-                                       return;
-                               }
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                               return;
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
+                       boolean extracted = RpmUtil.extractRpm(rpmPath, copiedRpmPath);
+                       if (!extracted) {
                                return;
                        }
                }
 
                // check debugsource file path
-               String sourceCmd = PathManager.getDebugInfoScript() + " "
-                               + RpmUtil.getDebugInfoOption() + " -f " 
-                               + rpmPath + CommonConstants.SPACE + projectName + CommonConstants.ASTERISK;
-               try {
-                       Runtime rt = Runtime.getRuntime();
-                       Process process = rt.exec(sourceCmd);
-                       process.waitFor();
-                       BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                       process.getInputStream()));
-                       String line = reader.readLine();
-                       if (null == line) {
-                               BufferedReader error = new BufferedReader(new InputStreamReader(
-                                               process.getErrorStream()));
-                               String errorStr = error.readLine();
-                               Logger.debug("source file path get failed... : " + errorStr);
-                               return;
-                       }
+               List<String> files = FileUtil.findFilesInDir(rpmPath, projectName
+                               + CommonConstants.ASTERISK);
+               if (files.size() != 0) {
                        setSourcePath(rpmPath);
                        Logger.debug("SOURCE PATH : " + properties.get(PROPERTY.SRCPATH.index));
-               } catch (IOException e) {
-                       e.printStackTrace();
-                       return;
-               } catch (InterruptedException e) {
-                       e.printStackTrace();
-                       return;
                }
        }
 
@@ -457,7 +335,7 @@ public class AppInfo {
        public String getPackageId() {
                return properties.get(PROPERTY.PACKAGE.index);
        }
-       
+
        public String getExecPath() {
                return properties.get(PROPERTY.EXEC.index);
        }
@@ -476,20 +354,24 @@ public class AppInfo {
                                                readlinkResult.add(appLines[i]);
                                        }
                                }
-                       }); // get actual file path using da readlink command (inside target platform)
-                       
-                       if (readlinkResult.isEmpty() || readlinkResult.size() > 1) { // fail to get path
+                       }); // get actual file path using da readlink command (inside target
+                               // platform)
+
+                       if (readlinkResult.isEmpty() || readlinkResult.size() > 1) { // fail
+                                                                                                                                                       // to
+                                                                                                                                                       // get
+                                                                                                                                                       // path
                                if (getAppType().contains(APPTYPE_CPP)) {
                                        exec = exec.replaceFirst("/opt/apps", "/opt/usr/apps");
                                        exec += CommonConstants.EXTENSION_EXEC_FILE;
                                } else if (getAppType().contains(APPTYPE_CAPP)) {
-                                       exec = exec.replaceFirst("/opt/apps", "/opt/usr/apps");                 
+                                       exec = exec.replaceFirst("/opt/apps", "/opt/usr/apps");
                                }
                                execPath = exec;
                        } else {
                                execPath = readlinkResult.get(0);
                        }
-                       
+
                        return execPath;
                }
        }
index 776d602..307aa4a 100644 (file)
@@ -47,6 +47,7 @@ import org.tizen.dynamicanalyzer.project.ProcessInformation;
 import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter;
@@ -248,26 +249,30 @@ public abstract class BaseCallstackManager {
                                symbol = getUserFunctionPosition(pid, time)
                                                + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + functionName;
                        } else {
-                               HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager.getInstance()
-                                               .getTargetBinInfoMap();
+                               List<BinarySettingData> binDataList = BinarySettingManager.getInstance()
+                                               .getBinarySettingList();
 
                                LibraryObject libraryObject = pmap.getLibraryByAddress(addr);
                                if (null != libraryObject) {
                                        int binaryID = libraryObject.getBinaryID();
                                        BinaryInfo binfo = AnalyzerManager.getProject().getDeviceStatusInfo()
                                                        .getBinaryInfo(binaryID);
-                                       String path = null;
-                                       if (binfo != null) {
-                                               path = binfo.getTargetBinaryPath();
+                                       String path = binfo.getTargetBinaryPath();
+
+                                       boolean isInBinarySetting = false;
+                                       for (BinarySettingData binData : binDataList) {
+                                               if (path.equals(binData.getBinaryPath())) {
+                                                       isInBinarySetting = true;
+                                                       break;
+                                               }
                                        }
 
-                                       BinaryInfo binInfo = binInfoMap.get(path);
-                                       if (null != binInfo) {
-                                               String localPath = binInfo.getTempBinaryPath();
+                                       if (isInBinarySetting) {
+                                               String localPath = binfo.getTempBinaryPath();
                                                String baseAddr = Long.toString(libraryObject.getLowestAddress());
                                                String pcStr = Long.toString(addr);
                                                boolean isPieBuild = true;
-                                               if (binInfo.getType() != 1) {
+                                               if (binfo.getType() != 1) {
                                                        isPieBuild = false;
                                                }
                                                functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild,
index a10d07c..28f423e 100644 (file)
@@ -31,7 +31,6 @@ import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.M
 import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_FUNCTION_EXIT;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.NavigableMap;
@@ -47,6 +46,7 @@ import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
 import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter;
@@ -114,12 +114,12 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                userCallstack.add(new CallStackItem(selfCallstackUnit, time));
                        } else {
                                if (!isAddrInBinaryRange(pid, time, callerAddr)) {
-                                       CallStackUnit callbackApi = addrMap.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR);
+                                       CallStackUnit callbackApi = addrMap
+                                                       .get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR);
                                        if (null == callbackApi) {
                                                callbackApi = new CallStackUnit(
                                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
-                                                               LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
-                                                               log);
+                                                               LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
                                                offerCallStackUnit(callbackApi);
                                                addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
                                                                callbackApi);
@@ -133,18 +133,17 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                                callerCsa.setAddr(callerAddr);
                                        } else {
                                                CallStackItem topCallstackItem = userCallstack.get(size - 1);
-                                               callerCsa.setFunctionStartAddr(topCallstackItem
-                                                               .getCallStackUnit().getAddr());
-                                               userCallstack.set(size - 1, new CallStackItem(callerCsa,
-                                                               topCallstackItem.getStartTime()));
+                                               callerCsa.setFunctionStartAddr(topCallstackItem.getCallStackUnit()
+                                                               .getAddr());
+                                               userCallstack.set(size - 1,
+                                                               new CallStackItem(callerCsa, topCallstackItem.getStartTime()));
                                        }
                                }
                                userCallstack.add(new CallStackItem(selfCallstackUnit, time));
                        }
                        size = userCallstack.size();
                        for (int i = size - 1; i >= 0; i--) {
-                               callstackData.getAddrs().add(
-                                               userCallstack.get(i).getCallStackUnit().getAddr());
+                               callstackData.getAddrs().add(userCallstack.get(i).getCallStackUnit().getAddr());
                        }
                        offerCallStackData(callstackData);
                        getCallStackDataBySeqMap().put(seq, callstackData);
@@ -154,8 +153,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                // if not in range profiling, this should not be reached
                                return;
                        }
-                       CallStackUnit removeCallStackUnit = userCallstack.get(size - 1)
-                                       .getCallStackUnit();
+                       CallStackUnit removeCallStackUnit = userCallstack.get(size - 1).getCallStackUnit();
                        if (selfCallstackUnit.getFunctionId() == removeCallStackUnit.getFunctionId()) {
                                userCallstack.remove(size - 1);
                                size = userCallstack.size();
@@ -170,19 +168,17 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                size = userCallstack.size();
                                if (size > 0) {
                                        CallStackItem prevCallstackItem = userCallstack.get(size - 1);
-                                       long prevSelfAddr = prevCallstackItem.getCallStackUnit()
-                                                       .getFunctionStartAddr();
+                                       long prevSelfAddr = prevCallstackItem.getCallStackUnit().getFunctionStartAddr();
                                        CallStackUnit callerCsa = addrMap.get(prevSelfAddr);
                                        if (null == callerCsa) {
                                                prevCallstackItem.getCallStackUnit().setAddr(prevSelfAddr);
                                        } else {
-                                               userCallstack.set(size - 1, new CallStackItem(callerCsa,
-                                                               prevCallstackItem.getStartTime()));
+                                               userCallstack.set(size - 1,
+                                                               new CallStackItem(callerCsa, prevCallstackItem.getStartTime()));
                                        }
                                }
                                for (int i = size - 1; i >= 0; i--) {
-                                       callstackData.getAddrs().add(
-                                                       userCallstack.get(i).getCallStackUnit().getAddr());
+                                       callstackData.getAddrs().add(userCallstack.get(i).getCallStackUnit().getAddr());
                                }
                                offerCallStackData(callstackData);
                                getCallStackDataBySeqMap().put(seq, callstackData);
@@ -193,8 +189,8 @@ public class SWAPCallStackManager extends BaseCallstackManager {
 
                        String apiName = FunctionNameManager.getFunctionName(log.getApiId());
                        if (apiName.equals("main")) { //$NON-NLS-1$
-                               ProcessInformation process = AnalyzerManager.getProject()
-                                               .getProcessInformation(log.getPid());
+                               ProcessInformation process = AnalyzerManager.getProject().getProcessInformation(
+                                               log.getPid());
                                process.setDropLog(true);
                        }
                }
@@ -294,8 +290,8 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                int pid = log.getPid();
                long time = log.getTime();
 
-               Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(pid);            
-               
+               Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(pid);
+
                int seq = log.getSeq();
                int tid = log.getTid();
                long callerAddr = log.getCallerPcAddr();
@@ -307,36 +303,32 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                        return;
                }
 
-               List<CallStackItem> probeCallstack = new ArrayList<CallStackItem>(
-                               getUserCallstack(tid));
+               List<CallStackItem> probeCallstack = new ArrayList<CallStackItem>(getUserCallstack(tid));
                int size = probeCallstack.size();
 
                CallStackData callstackData = new CallStackData(seq);
 
                if ((size == 0) || (!isAddrInBinaryRange(pid, time, callerAddr))) {
-                       CallStackUnit callbackApi = addrMap.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR);
+                       CallStackUnit callbackApi = addrMap
+                                       .get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR);
                        if (null == callbackApi) {
                                callbackApi = new CallStackUnit(
                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
-                                               LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
-                                               log);
+                                               LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
                                offerCallStackUnit(callbackApi);
-                               addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
-                                               callbackApi);
+                               addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR, callbackApi);
                        }
                        probeCallstack.add(new CallStackItem(callbackApi));
                } else {
                        CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
                        if (null == callerCallstackUnit) {
                                String strCallerSymbol = getCallStackSymbol(callerAddr, pid, time);
-                               callerCallstackUnit = new CallStackUnit(callerAddr, strCallerSymbol,
-                                               inputData);
+                               callerCallstackUnit = new CallStackUnit(callerAddr, strCallerSymbol, inputData);
                                offerCallStackUnit(callerCallstackUnit);
                                addrMap.put(callerAddr, callerCallstackUnit);
                        }
 
-                       CallStackUnit topUserCallstack = probeCallstack.get(size - 1)
-                                       .getCallStackUnit();
+                       CallStackUnit topUserCallstack = probeCallstack.get(size - 1).getCallStackUnit();
                        if (callerCallstackUnit.getFunctionId() == topUserCallstack.getFunctionId()) {
                                probeCallstack.set(size - 1, new CallStackItem(callerCallstackUnit));
                        } else {
@@ -346,8 +338,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
 
                size = probeCallstack.size();
                for (int i = size - 1; i >= 0; i--) {
-                       callstackData.getAddrs().add(
-                                       probeCallstack.get(i).getCallStackUnit().getAddr());
+                       callstackData.getAddrs().add(probeCallstack.get(i).getCallStackUnit().getAddr());
                }
                offerCallStackData(callstackData);
                getCallStackDataBySeqMap().put(seq, callstackData);
@@ -374,11 +365,13 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                && addr <= pmap.getMainbinary().getHighestAddress()) {
                        return true;
                }
-               
-               HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
-                               .getInstance().getTargetBinInfoMap();
+
+               List<BinarySettingData> binDataList = BinarySettingManager.getInstance()
+                               .getBinarySettingList();
                List<String> binPaths = new ArrayList<String>();
-               binPaths.addAll(binInfoMap.keySet());
+               for (BinarySettingData binData : binDataList) {
+                       binPaths.add(binData.getBinaryPath());
+               }
                // TODO: performance improvement
                int size = binPaths.size();
                for (int i = 0; i < size; i++) {
@@ -392,7 +385,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                        if (addr >= libObj.getLowestAddress() && addr <= libObj.getHighestAddress()) {
                                return true;
                        }
-               }       
+               }
                return false;
        }
 
index cc20bfd..a8c4809 100755 (executable)
@@ -86,7 +86,6 @@ import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
 import org.tizen.dynamicanalyzer.swap.model.DATime;
 import org.tizen.dynamicanalyzer.swap.model.data.LogDataUtils;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.EmulatorScreenshot;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.SocketClient;
 import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
@@ -315,10 +314,10 @@ public class Communicator30 extends BaseCommunicator {
                        // TODO : if no executable is selected for tracing (system wide
                        // tracing)
                        return null;
-               } else { // normal application is selected
+               } else { // normal application or common executable is selected
                        for (int k = apps.size() - 1; k >= 0; k--) {
                                AppInfo app = apps.get(k);
-                               // TODO : remove
+                               // TODO : hardcoding have to remove
                                if (app.getAppId().contains(AnalyzerConstants.APPCONTROL)) {
                                        continue;
                                }
@@ -408,9 +407,9 @@ public class Communicator30 extends BaseCommunicator {
                                preMsg = ByteUtil.getByte(preMsg, entry.getValue());
                        }
                } else if (AnalyzerConstants.WITHOUT_EXECUTABLE.equals(selectedPkg.getPackageId())) {
-                       // do not send message for system wide trace
+                       // do not send binary info message for system wide trace
                        return HostResult.SUCCESS;
-               } else {
+               } else { // normal application or common executable
                        List<AppInfo> apps = selectedPkg.getAppInfos();
                        if (null == apps) {
                                return HostResult.ERR_BIN_INFO_GET_FAIL;
@@ -936,8 +935,6 @@ public class Communicator30 extends BaseCommunicator {
        }
 
        public HostResult sendSWAPMessage(int messageId, List<BinarySettingData> settings) {
-               HashMap<String, BinaryInfo> targetBinInfoMap = BinarySettingManager.getInstance()
-                               .getTargetBinInfoMap();
                byte[] msg = new byte[0];
                int count = settings.size();
                int failedCount = 0;
@@ -945,7 +942,8 @@ public class Communicator30 extends BaseCommunicator {
                byte[] libInst = new byte[0];
                for (int a = 0; a < count; a++) {
                        String binaryPath = settings.get(a).getBinaryPath();
-                       BinaryInfo binInfo = targetBinInfoMap.get(binaryPath);
+                       BinaryInfo binInfo = GlobalInformation.getCurrentDeviceInfo().getDeviceStatusInfo()
+                                       .getBinaryInfo(binaryPath);
                        if (null == binInfo) {
                                continue;
                        }
@@ -1082,7 +1080,6 @@ public class Communicator30 extends BaseCommunicator {
 
                parseBinaryInfo(payload, binPaths, bininfos);
 
-               BinarySettingManager.getInstance().addBinaryInfos(bininfos);
                return result;
        }
 
index a2a0195..b7b5b43 100644 (file)
  */
 package org.tizen.dynamicanalyzer.swap.platform;
 
+import java.io.BufferedWriter;
+import java.io.IOException;
+
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 
 public class BinarySettingData {
        private String binaryPath = null;
-       private String debugSourcePath = null;
-       private String debugInfoRpmPath = null;
+       private String debugRpmPath = null;
+       private String sourceRpmPath = null;
        private String debugFilePath = null;
-       private String userSourcePath = null;
+       private String rpmSourceDir = null;
+       private String userSourceDir = null;
 
        public String getBinaryPath() {
                return binaryPath;
@@ -43,64 +47,108 @@ public class BinarySettingData {
                this.binaryPath = binaryPath;
        }
 
-       public String getDebugSourcePath() {
-               return debugSourcePath;
+       public String getDebugRpmPath() {
+               return debugRpmPath;
        }
 
-       public void setDebugSourcePath(String sourcePath) {
-               this.debugSourcePath = sourcePath;
+       public void setDebugRpmPath(String debugRpmPath) {
+               this.debugRpmPath = debugRpmPath;
        }
 
-       public String getSaveData() {
-               StringBuffer strBuffer = new StringBuffer();
+       public String getSourceRpmPath() {
+               return sourceRpmPath;
+       }
 
-               // index 0 : binary path
-               strBuffer.append(binaryPath).append(CommonConstants.COMMA);
+       public void setSourceRpmPath(String sourceRpmPath) {
+               this.sourceRpmPath = sourceRpmPath;
+       }
 
-               // index 1 : debug source path
-               if (null == debugSourcePath) {
-                       strBuffer.append(CommonConstants.SPACE);
-               } else {
-                       strBuffer.append(debugSourcePath);
-               }
-               strBuffer.append(CommonConstants.COMMA);
+       public String getDebugFilePath() {
+               return debugFilePath;
+       }
 
-               // index 2 : debug rpm path
-               if (null == debugInfoRpmPath) {
-                       strBuffer.append(CommonConstants.SPACE);
-               } else {
-                       strBuffer.append(debugInfoRpmPath);
-               }
-               strBuffer.append(CommonConstants.COMMA);
+       public void setDebugFilePath(String debugFilePath) {
+               this.debugFilePath = debugFilePath;
+       }
 
-               // index 3 : debug file path
-               if (null == debugFilePath) {
-                       strBuffer.append(CommonConstants.SPACE);
-               } else {
-                       strBuffer.append(debugFilePath);
-               }
-               strBuffer.append(CommonConstants.COMMA);
+       public String getRpmSourceDir() {
+               return rpmSourceDir;
+       }
+
+       public void setRpmSourceDir(String rpmSourceDir) {
+               this.rpmSourceDir = rpmSourceDir;
+       }
+
+       public String getUserSourceDir() {
+               return userSourceDir;
+       }
+
+       public void setUserSourceDir(String userSourceDir) {
+               this.userSourceDir = userSourceDir.trim();
+       }
 
-               // index 4 : user source path
-               if (null == userSourcePath) {
-                       strBuffer.append(CommonConstants.SPACE);
-               } else {
-                       strBuffer.append(userSourcePath);
+       public boolean saveData(BufferedWriter writer) {
+               if (writer != null) {
+                       StringBuffer strBuffer = new StringBuffer();
+
+                       // index 0 : binary path
+                       strBuffer.append(binaryPath).append(CommonConstants.COMMA);
+
+                       // index 1 : debug rpm path
+                       if (null != debugRpmPath) {
+                               strBuffer.append(debugRpmPath);
+                       }
+                       strBuffer.append(CommonConstants.COMMA);
+
+                       // index 2 : source rpm path
+                       if (null != sourceRpmPath) {
+                               strBuffer.append(sourceRpmPath);
+                       }
+                       strBuffer.append(CommonConstants.COMMA);
+
+                       // index 3 : debug file path
+                       if (null != debugFilePath) {
+                               strBuffer.append(debugFilePath);
+                       }
+                       strBuffer.append(CommonConstants.COMMA);
+
+                       // index 4 : source path from rpm package
+                       if (null != rpmSourceDir) {
+                               strBuffer.append(rpmSourceDir);
+                       }
+                       strBuffer.append(CommonConstants.COMMA);
+
+                       // index 5 : source path from user input
+                       if (null != userSourceDir) {
+                               strBuffer.append(userSourceDir);
+                       }
+
+                       try {
+                               writer.write(strBuffer.toString());
+                               writer.newLine();
+                               return true;
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
                }
 
-               return strBuffer.toString();
+               return false;
        }
 
-       public void loadSaveData(String saveLog) {
-               String[] splitContent = saveLog.split(CommonConstants.COMMA);
+       public void openData(String log) {
+               String[] splitContent = log.split(CommonConstants.COMMA);
 
                setBinaryPath(splitContent[0]);
-               setDebugSourcePath(splitContent[1]);
-               setDebugRpmPath(splitContent[2]);
+               if (splitContent.length > 1)
+                       setDebugRpmPath(splitContent[1]);
+               if (splitContent.length > 2)
+                       setSourceRpmPath(splitContent[2]);
+               if (splitContent.length > 3)
                        setDebugFilePath(splitContent[3]);
-               if (splitContent.length >= 5) {
-                       setUserSourcePath(splitContent[4]);
-               }
+               if (splitContent.length > 4)
+                       setRpmSourceDir(splitContent[4]);
+               if (splitContent.length > 5)
+                       setUserSourceDir(splitContent[5]);
        }
 
        public boolean isEqual(String binPath) {
@@ -110,28 +158,4 @@ public class BinarySettingData {
                return false;
        }
 
-       public String getDebugRpmPath() {
-               return debugInfoRpmPath;
-       }
-
-       public void setDebugRpmPath(String debugPath) {
-               this.debugInfoRpmPath = debugPath;
-       }
-
-       public String getDebugFilePath() {
-               return debugFilePath;
-       }
-
-       public void setDebugFilePath(String debugFilePath) {
-               this.debugFilePath = debugFilePath;
-       }
-
-       public String getUserSourcePath() {
-               return userSourcePath;
-       }
-
-       public void setUserSourcePath(String userSourcePath) {
-               this.userSourcePath = userSourcePath.trim();
-       }
-
 }
index 5f94e4b..afaea53 100644 (file)
 package org.tizen.dynamicanalyzer.swap.platform;
 
 import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
 import java.io.IOException;
-import java.io.InputStreamReader;
+import java.nio.file.FileAlreadyExistsException;
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.List;
-import java.util.regex.Pattern;
-
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.project.BinaryInfo;
-import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow;
 import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
-import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.FileUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.RpmUtil;
 
 public class BinarySettingManager {
        private static BinarySettingManager instance = null;
-       private HashMap<String, BinaryInfo> targetBinInfoMap = new HashMap<String, BinaryInfo>();
-
-       // temporary list
-       private HashMap<String, InputRow> inputRowHash = new HashMap<String, InputRow>();
-       private List<InputRow> inputRowList = new ArrayList<InputRow>();
-
-       private List<BinarySettingData> realBinarySettings = new ArrayList<BinarySettingData>();
+       private List<BinarySettingData> targetBinaryList = new ArrayList<BinarySettingData>();
+       // private Map<String, BinaryInfo> targetBinaryInfoMap = new HashMap<String,
+       // BinaryInfo>();
 
-       private String debugRoot = PathManager.getRootstrapsPath(ConfigureManager
-                       .getPlatform());
+       private String debugRoot = PathManager.getRootstrapsPath(ConfigureManager.getPlatform());
 
        public static synchronized BinarySettingManager getInstance() {
                if (null == instance) {
@@ -69,449 +57,307 @@ public class BinarySettingManager {
                return instance;
        }
 
-       public void removeRealBinarySettingData(String binPath) {
-               for (int i = 0; i < realBinarySettings.size(); i++) {
-                       if (binPath.equals(realBinarySettings.get(i).getBinaryPath())) {
-                               realBinarySettings.remove(i);
-                               break;
-                       }
-               }
+       public void addBinarySettingData(BinarySettingData binData) {
+               removeBinarySettingData(binData.getBinaryPath());
+               targetBinaryList.add(binData);
        }
 
-       public void putRealBinarySettingData(List<BinarySettingData> data) {
+       public void addBinarySettingData(List<BinarySettingData> data) {
                for (BinarySettingData binData : data) {
-                       for (int i = 0; i < realBinarySettings.size(); i++) {
-                               String realBinary = realBinarySettings.get(i).getBinaryPath();
-                               if (realBinary.equals(binData.getBinaryPath())) {
-                                       realBinarySettings.remove(i);
-                                       break;
-                               }
-                       }
-                       realBinarySettings.add(binData);
+                       addBinarySettingData(binData);
                }
        }
 
-       // TODO: this method is somewhat long and complicated and there are some values need to be defined.
-       public void checkSourcePath(List<BinarySettingData> input) {
-               int size = input.size();
-               for (int i = 0; i < size; i++) {
-                       BinarySettingData binData = input.get(i);
-                       if (null != binData.getDebugRpmPath() && !binData.getDebugRpmPath().isEmpty()) {
-                               // check dir exists.
-                               String debugPath = binData.getDebugRpmPath();
-                               File debugInfoFile = new File(debugPath);
-
-                               if (!debugInfoFile.exists() || debugInfoFile.isDirectory()) {
-                                       continue;
-                               }
-                               // check rpm file exists
-                               String targetLibPath = binData.getBinaryPath();
-                               String[] splitTargetLib = targetLibPath.split(CommonConstants.SLASH);
-                               String libFullName = splitTargetLib[splitTargetLib.length - 1];
-                               int index = libFullName.indexOf(".so");
-                               // 3 means remove "lib" string
-                               String debugSourceToken = libFullName.substring(3, index)
-                                               + "-debugsource";
-                               String[] files = debugInfoFile.getParentFile().list();
-                               String debugInfoSourceRpmName = null;
-                               for (int j = 0; j < files.length; j++) {
-                                       if (files[j].contains(debugSourceToken)) {
-                                               debugInfoSourceRpmName = files[j];
-                                               break;
-                                       }
-                               }
-
-                               // copy rpm file
-                               String rpmPath = PathManager.DA_RPM_PATH + File.separator + libFullName;
-                               File rpms = new File(rpmPath);
-                               if (!rpms.exists()) {
-                                       if (!rpms.mkdirs()) {
-                                               Logger.debug("rpm directory create failed...");
-                                               continue;
-                                       }
-                               }
-
-                               // copy debug info file
-                               String from = debugPath;
-                               String to = rpmPath + File.separator + debugInfoFile.getName();
-                               String debugRpmPath = null;
-                               String debugRpmSourcePath = null;
-                               if (AnalyzerUtil.copyFile(from, to)) {
-                                       debugRpmPath = to;
-                               } else {
-                                       continue;
-                               }
-
-                               // copy debug source file
-                               if (null != debugInfoSourceRpmName && !debugInfoSourceRpmName.isEmpty()) {
-                                       from = debugInfoFile.getParent() + File.separator
-                                                       + debugInfoSourceRpmName;
-                                       to = rpmPath + File.separator + debugInfoSourceRpmName;
-                                       if (AnalyzerUtil.copyFile(from, to)) {
-                                               debugRpmSourcePath = to;
-                                       }
-                               }
+       public void removeBinarySettingData(String binPath) {
+               for (int i = 0; i < targetBinaryList.size(); i++) {
+                       if (targetBinaryList.get(i).getBinaryPath().equals(binPath)) {
+                               targetBinaryList.remove(i);
+                               break;
+                       }
+               }
+       }
 
-                               // extract rpm file exists
-                               if (null != debugRpmPath) {
-                                       String toolPath = PathManager.getDebugInfoScript();
-                                       String[] command = null;
-                                       if (null != debugRpmSourcePath) {
-                                               command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-r", rpmPath, debugRpmPath,
-                                                               debugRpmSourcePath };
-                                       } else {
-                                               command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", rpmPath, debugRpmPath };
-                                       }
-                                       try {
-                                               Runtime rt = Runtime.getRuntime();
-                                               Process process = rt.exec(command);
-                                               process.waitFor();
-                                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                                               process.getInputStream()));
-                                               String line = null;
-                                               int lineCount = 0;
-                                               while (null != (line = reader.readLine())) {
-                                                       lineCount++;
-                                                       if (lineCount == 1) {
-                                                               Logger.debug("CHANGE DIR : " + line);
-                                                       } else {
-                                                               Logger.debug("EXTRACT RPM : " + line);
-                                                       }
-                                               }
-                                               if (lineCount == 0) {
-                                                       BufferedReader error = new BufferedReader(
-                                                                       new InputStreamReader(process.getErrorStream()));
-                                                       String errorStr = error.readLine();
-                                                       Logger.debug("debug info file extract failed... : "
-                                                                       + errorStr);
-                                                       continue;
-                                               }
-                                       } catch (IOException e) {
-                                               e.printStackTrace();
-                                               continue;
-                                       } catch (InterruptedException e) {
-                                               e.printStackTrace();
-                                               continue;
-                                       }
-                               }
+       public BinarySettingData getBinarySetting(String targetBinaryPath) {
+               int size = targetBinaryList.size();
 
-                               // check real debug file path
-                               String[] splitDebugPath = debugPath.split(Pattern.quote(File.separator));
-                               String debugFileName = splitDebugPath[splitDebugPath.length - 1];
-                               if (debugFileName.contains("debuginfo")) {
-                                       String libPostFix = libFullName
-                                                       .substring(index, libFullName.length());
-                                       String libVersion = libPostFix.substring(4, libPostFix.length());
-                                       String debugCmd = PathManager.getDebugInfoScript() + " " 
-                                                       + RpmUtil.getDebugInfoOption() + " -f " + rpmPath 
-                                                       + " " + "*" + libPostFix + ".debug";
-                                       String debugFilePath = null;
-                                       try {
-                                               Runtime rt = Runtime.getRuntime();
-                                               Process process = rt.exec(debugCmd);
-                                               process.waitFor();
-                                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                                               process.getInputStream()));
-                                               String line = reader.readLine();
-                                               if (null == line) {
-                                                       BufferedReader error = new BufferedReader(
-                                                                       new InputStreamReader(process.getErrorStream()));
-                                                       String errorStr = error.readLine();
-                                                       Logger.debug("debug source file extract failed... : "
-                                                                       + errorStr);
-                                                       continue;
-                                               }
-                                               debugFilePath = rpmPath + line.substring(1, line.length());
-                                               Logger.debug("DEBUG PATH : " + debugFilePath);
-                                       } catch (IOException e) {
-                                               e.printStackTrace();
-                                               continue;
-                                       } catch (InterruptedException e) {
-                                               e.printStackTrace();
-                                               continue;
-                                       }
-                                       binData.setDebugFilePath(debugFilePath);
-
-                                       // check real source file path
-                                       if (null != debugRpmSourcePath && !debugRpmSourcePath.isEmpty()) {
-                                               String sourceFilePath = null;
-                                               String sourceCmd = PathManager.getDebugInfoScript() + " " 
-                                                               + RpmUtil.getDebugInfoOption() + " -f " 
-                                                               + rpmPath + " " + "*" + libVersion;
-                                               try {
-                                                       Runtime rt = Runtime.getRuntime();
-                                                       Process process = rt.exec(sourceCmd);
-                                                       process.waitFor();
-                                                       BufferedReader reader = new BufferedReader(
-                                                                       new InputStreamReader(process.getInputStream()));
-                                                       String line = reader.readLine();
-                                                       if (null == line) {
-                                                               BufferedReader error = new BufferedReader(
-                                                                               new InputStreamReader(process.getErrorStream()));
-                                                               String errorStr = error.readLine();
-                                                               Logger.debug("source file path get failed.. : "
-                                                                               + errorStr);
-                                                               continue;
-                                                       }
-                                                       sourceFilePath = rpmPath;
-                                                       Logger.debug("SOURCE PATH : " + sourceFilePath);
-                                               } catch (IOException e) {
-                                                       e.printStackTrace();
-                                                       continue;
-                                               } catch (InterruptedException e) {
-                                                       e.printStackTrace();
-                                                       continue;
-                                               }
-                                               binData.setDebugSourcePath(sourceFilePath);
-                                       } else {
-                                               binData.setDebugSourcePath(CommonConstants.EMPTY);
-                                       }
-                               } else if (debugFileName.contains("debug-")) {
-                                       String debugCmd = PathManager.getDebugInfoScript() + " "
-                                                       + RpmUtil.getDebugInfoOption() + " -f " 
-                                                       + rpmPath + CommonConstants.SPACE + libFullName;
-                                       String debugFilePath = null;
-                                       try {
-                                               Runtime rt = Runtime.getRuntime();
-                                               Process process = rt.exec(debugCmd);
-                                               process.waitFor();
-                                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                                               process.getInputStream()));
-                                               String line = reader.readLine();
-                                               if (null == line) {
-                                                       BufferedReader error = new BufferedReader(
-                                                                       new InputStreamReader(process.getErrorStream()));
-                                                       String errorStr = error.readLine();
-                                                       Logger.debug("debug source file extract failed... : "
-                                                                       + errorStr);
-                                                       continue;
-                                               }
-                                               debugFilePath = rpmPath + line.substring(1, line.length());
-                                               Logger.debug("DEBUG PATH : " + debugFilePath);
-                                       } catch (IOException e) {
-                                               e.printStackTrace();
-                                               continue;
-                                       } catch (InterruptedException e) {
-                                               e.printStackTrace();
-                                               continue;
-                                       }
-                                       binData.setDebugFilePath(debugFilePath);
-                               } else {
-                                       binData.setDebugFilePath(CommonConstants.EMPTY);
-                               }
+               BinarySettingData binData = null;
+               for (int i = 0; i < size; i++) {
+                       if (targetBinaryList.get(i).getBinaryPath().equals(targetBinaryPath)) {
+                               binData = targetBinaryList.get(i);
+                               break;
                        }
                }
+               return binData;
+       }
 
+       public List<BinarySettingData> getBinarySettingList() {
+               return Collections.unmodifiableList(targetBinaryList);
        }
 
-       public HashMap<String, InputRow> getInputRowHash() {
-               return inputRowHash;
+       public String getDebugRoot() {
+               return debugRoot;
        }
 
-       public List<InputRow> getInputRowList() {
-               return inputRowList;
+       public void setDebugRoot(String debugRoot) {
+               this.debugRoot = debugRoot;
        }
 
-       public void removeInputRow(String path) {
-               InputRow inputRow = inputRowHash.get(path);
-               InputRow nextInputRow = null;
-               InputRow prevInputRow = null;
-               if (null == inputRow) {
-                       return;
+       public void saveData(BufferedWriter writer) {
+               int size = targetBinaryList.size();
+               for (int i = 0; i < size; i++) {
+                       targetBinaryList.get(i).saveData(writer);
                }
+       }
 
-               int index = inputRowList.indexOf(inputRow);
-               if (index == 0 && inputRowList.size() > 1) {
-                       nextInputRow = inputRowList.get(index + 1);
-                       FormData nextData = (FormData) nextInputRow.getLayoutData();
-                       nextData.top = new FormAttachment(0, 0);
-               } else if (index + 1 < inputRowList.size()) {
-                       prevInputRow = inputRowList.get(index - 1);
-                       nextInputRow = inputRowList.get(index + 1);
-                       FormData nextData = (FormData) nextInputRow.getLayoutData();
-                       nextData.top = new FormAttachment(prevInputRow, 2);
+       public void openData(BufferedReader reader) throws IOException {
+               String content;
+               while (null != (content = reader.readLine())) {
+                       BinarySettingData binaryData = new BinarySettingData();
+                       binaryData.openData(content);
+                       addBinarySettingData(binaryData);
                }
-               inputRowHash.remove(path);
-               inputRowList.remove(index);
        }
 
-       public void addBinaryInfos(List<BinaryInfo> input) {
-               for (int i = 0; i < input.size(); i++) {
-                       String targetPath = input.get(i).getTargetBinaryPath();
-                       BinaryInfo binInfo = targetBinInfoMap.get(targetPath);
-                       if (null != binInfo) {
-                               targetBinInfoMap.remove(targetPath);
+       public void initBinarySettings() {
+       }
+
+       // return source rpm file path
+       // return null if source rpm cannot be found
+       private String findSourceRpmPath(BinarySettingData binData) {
+               String sourceRpm = null;
+               String debugRpmPath = binData.getDebugRpmPath();
+               if (null != debugRpmPath && !debugRpmPath.isEmpty()) {
+                       // check debug rpm file existence
+                       File debugRpmFile = new File(debugRpmPath);
+                       if (debugRpmFile.isFile()) {
+                               String sourceCandidate = debugRpmPath.replace(RpmUtil.DEBUGINFO,
+                                               RpmUtil.DEBUGSOURCE);
+
+                               // check source rpm file existence
+                               File sourceRpmFile = new File(sourceCandidate);
+                               if (sourceRpmFile.isFile()) {
+                                       sourceRpm = sourceCandidate;
+                                       binData.setSourceRpmPath(sourceRpm);
+                               }
                        }
-                       targetBinInfoMap.put(input.get(i).getTargetBinaryPath(), input.get(i));
                }
+
+               return sourceRpm;
        }
 
-       public void removeBinaryInfos(List<BinaryInfo> input) {
-               for (int i = 0; i < input.size(); i++) {
-                       String targetPath = input.get(i).getTargetBinaryPath();
-                       BinaryInfo binInfo = targetBinInfoMap.get(targetPath);
-                       if (null != binInfo) {
-                               targetBinInfoMap.remove(targetPath);
+       // return the path that rpm files be extracted
+       // return null if failed
+       private String copyAndExtractRpmFile(BinarySettingData binData) {
+               String targetBinPath = binData.getBinaryPath();
+               String[] splitTargetBin = targetBinPath.split(CommonConstants.SLASH);
+               String dirName = splitTargetBin[splitTargetBin.length - 1];
+
+               // make directory for rpm file
+               String rpmPath = PathManager.DA_RPM_PATH + File.separator + dirName;
+               File rpms = new File(rpmPath);
+               if (!rpms.exists()) {
+                       if (!rpms.mkdirs()) {
+                               Logger.debug("rpm directory create failed...");
+                               return null;
                        }
                }
-       }
 
-       public HashMap<String, BinaryInfo> getTargetBinInfoMap() {
-               return targetBinInfoMap;
-       }
+               String debugRpmPath = null;
+               String debugRpmSourcePath = null;
 
-       public BinarySettingData getRealBinarySetting(String targetBinaryPath) {
-               List<BinarySettingData> binaries = getRealBinarySettings();
-               int size = binaries.size();
+               // copy debug info rpm file
+               String from = binData.getDebugRpmPath();
+               if (from != null && !from.isEmpty()) {
+                       try {
+                               debugRpmPath = FileUtil.copyFileToDir(from, rpmPath, true);
+                               if (debugRpmPath == null) {
+                                       return null;
+                               }
+                       } catch (FileAlreadyExistsException e) {
+                               e.printStackTrace();
+                               return null;
+                       }
+               } else {
+                       return null;
+               }
 
-               BinarySettingData binData = null;
-               for (int i = 0; i < size; i++) {
-                       if (targetBinaryPath.equals(binaries.get(i).getBinaryPath())) {
-                               binData = binaries.get(i);
-                               break;
+               // copy debug source rpm file
+               from = binData.getSourceRpmPath();
+               if (from != null && !from.isEmpty()) {
+                       try {
+                               debugRpmSourcePath = FileUtil.copyFileToDir(from, rpmPath, true);
+                       } catch (FileAlreadyExistsException e) {
+                               e.printStackTrace();
                        }
                }
-               return binData;
-       }
 
-       public List<BinarySettingData> getRealBinarySettings() {
-               return realBinarySettings;
-       }
+               // extract rpm files
+               RpmUtil.extractRpm(rpmPath, debugRpmPath);
+               if (debugRpmSourcePath != null) {
+                       RpmUtil.extractRpm(rpmPath, debugRpmSourcePath);
+               }
 
-       public String getDebugRoot() {
-               return debugRoot;
+               return rpmPath;
        }
 
-       public void setDebugRoot(String debugRoot) {
-               this.debugRoot = debugRoot;
-       }
+       // TODO: there are some values need to be defined.
+       private void findRealDebugFile(BinarySettingData binData, String extractPath) {
+               String targetBinPath = binData.getBinaryPath();
+               String[] splitTargetBin = targetBinPath.split(CommonConstants.SLASH);
+               String binName = splitTargetBin[splitTargetBin.length - 1];
+
+               String debugRpmPath = binData.getDebugRpmPath();
+               // debug rpm file name contains "debuginfo"
+               if (debugRpmPath.contains(RpmUtil.DEBUGINFO)) {
+                       // find real debug file
+                       String debugCandidate = "*" + binName + ".debug";
+                       List<String> debugfilelist = FileUtil.findFilesInDir(extractPath, debugCandidate);
+                       if (debugfilelist.size() > 0) {
+                               String fullpath;
+                               if (extractPath.endsWith(File.separator)) {
+                                       fullpath = extractPath + debugfilelist.get(0);
+                               } else {
+                                       fullpath = extractPath + File.separator + debugfilelist.get(0);
+                               }
+                               binData.setDebugFilePath(fullpath);
 
-       public void initBinarySettings() {
-               File saveFile = new File(PathManager.DA_BINARY_AUTO_SAVE_FILE);
-               BufferedReader br = null;
-               String content = null;
-               try {
-                       List<BinarySettingData> binarySettings = new ArrayList<BinarySettingData>();
-                       br = new BufferedReader(new FileReader(saveFile));
-                       while (null != (content = br.readLine())) {
-                               BinarySettingData binaryData = new BinarySettingData();
-                               binaryData.loadSaveData(content);
-                               binarySettings.add(binaryData);
+                               // find real source file path
+                               String debugSourceRpmPath = binData.getSourceRpmPath();
+                               if (null != debugSourceRpmPath && !debugSourceRpmPath.isEmpty()) {
+                                       Logger.debug("SOURCE PATH : " + extractPath);
+                                       binData.setRpmSourceDir(extractPath);
+                               } else {
+                                       binData.setRpmSourceDir(null);
+                               }
+                       } else {
+                               binData.setDebugFilePath(null);
                        }
-
-                       BinarySettingManager.getInstance().putRealBinarySettingData(binarySettings);
-               } catch (FileNotFoundException e) {
-                       Logger.debug("BinarySettings.save file is not exist - normal operation");
-               } catch (IOException e) {
-                       e.printStackTrace();
-               } finally {
-                       CommonUtil.tryClose(br);
+               } else if (debugRpmPath.contains(RpmUtil.DEBUG)) {
+                       List<String> debugfilelist = FileUtil.findFilesInDir(extractPath, binName);
+                       if (debugfilelist.size() > 0) {
+                               String fullpath;
+                               if (extractPath.endsWith(File.separator)) {
+                                       fullpath = extractPath + debugfilelist.get(0);
+                               } else {
+                                       fullpath = extractPath + File.separator + debugfilelist.get(0);
+                               }
+                               binData.setDebugFilePath(fullpath);
+                       } else {
+                               binData.setDebugFilePath(null);
+                       }
+               } else { // unknown debug package type
+                       binData.setDebugFilePath(null);
                }
        }
 
-       // TODO: this method is somewhat long and complicated and there are some values need to be defined.
-       public String getDebugInfoPath(String libPath, String rootPath) {
-               boolean isDebugInfo = true;
-               String debugPath = null;
-
-               String[] splitTargetLib = libPath.split(CommonConstants.SLASH);
-               String libFullName = splitTargetLib[splitTargetLib.length - 1];
-               if (rootPath.endsWith(CommonConstants.SLASH)) {
-                       rootPath = rootPath.substring(0, rootPath.length() - 1);
-               }
-               int index = libFullName.indexOf(".so");
-               if (index < 0) {
-                       return null;
-               }
-               // 3 means remove "lib" string
-               String debugInfoToken = "*" + libFullName.substring(3, index) + "-debuginfo*.rpm";
-               // String rootstrapPath = PathManager.getRootStrapsPath();
-               List<String> lines = new ArrayList<String>();
-               String toolPath = PathManager.getDebugInfoScript();
-               String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-f", rootPath, debugInfoToken };
-               try {
-                       Runtime rt = Runtime.getRuntime();
-                       Process process = rt.exec(command);
-                       process.waitFor();
-                       BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                       process.getInputStream()));
-                       int lineCount = 0;
-                       String line = null;
-                       while (null != (line = reader.readLine())) {
-                               lineCount++;
-                               Logger.debug("LINE (" + lineCount + ") : " + line);
-                               lines.add(line);
+       public void checkSourcePath(List<BinarySettingData> input) {
+               int size = input.size();
+               for (int i = 0; i < size; i++) {
+                       BinarySettingData binData = input.get(i);
+                       if (binData.getSourceRpmPath() == null) {
+                               findSourceRpmPath(binData);
                        }
-                       if (lineCount == 0) {
-                               BufferedReader error = new BufferedReader(new InputStreamReader(
-                                               process.getErrorStream()));
-                               String errorStr = error.readLine();
-                               Logger.error("find debug info path fail.. " + errorStr);
-                               isDebugInfo = false;
+                       String extractPath = copyAndExtractRpmFile(binData);
+                       if (extractPath != null) {
+                               findRealDebugFile(binData, extractPath);
                        }
-               } catch (IOException e) {
-                       e.printStackTrace();
-                       return null;
-               } catch (InterruptedException e) {
-                       e.printStackTrace();
-                       return null;
                }
+       }
 
-               if (!isDebugInfo) {
+       // find debug rpm package in rootPath
+       // binName must be null if you do not want unpack rpm file
+       private String findDebugRpmPath(String token, String rootPath, String binName) {
+               String debugRpmPath = null;
 
-                       String libVersion = null;
-                       if (libFullName.length() > index + 4) {
-                               libVersion = libFullName.substring(index + 4, libFullName.length());
-                       } else {
-                               libVersion = CommonConstants.EMPTY;
-                       }
-                       debugInfoToken = "*" + libFullName.substring(3, index) + "-debug-"
-                                       + libVersion + "*.rpm";
+               // remove last '/' in rootPath
+               if (!rootPath.endsWith(File.separator)) {
+                       rootPath = rootPath + File.separator;
+               }
 
-                       command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-f", rootPath, debugInfoToken };
-                       try {
-                               Runtime rt = Runtime.getRuntime();
-                               Process process = rt.exec(command);
-                               process.waitFor();
-                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                               process.getInputStream()));
-                               int lineCount = 0;
-                               String line = null;
-                               while (null != (line = reader.readLine())) {
-                                       lineCount++;
-                                       Logger.debug("LINE (" + lineCount + ") : " + line);
-                                       lines.add(line);
+               List<String> rpmlist = FileUtil.findFilesInDir(rootPath, token);
+
+               if (binName != null) {
+                       // get file list in rpm package and find target binary name
+                       for (int i = 0; i < rpmlist.size(); i++) {
+                               String rpmpath = rootPath + rpmlist.get(i);
+                               List<String> filelist = RpmUtil.getFileListInRpm(rpmpath);
+                               int filesize = filelist.size();
+                               boolean bFound = false;
+                               for (int k = 0; k < filesize; k++) {
+                                       if (filelist.get(k).contains(binName)) {
+                                               bFound = true;
+                                               break;
+                                       }
                                }
-                               if (lineCount == 0) {
-                                       BufferedReader error = new BufferedReader(new InputStreamReader(
-                                                       process.getErrorStream()));
-                                       String errorStr = error.readLine();
-                                       Logger.error("find debug info path fail.. " + errorStr);
-                                       return null;
+
+                               if (bFound) {
+                                       debugRpmPath = rpmpath;
+                                       break;
+                               }
+                       }
+               } else {
+                       // TODO : select exact rpm file
+                       String longest = null;
+                       for (String rpm : rpmlist) {
+                               if (longest == null) {
+                                       longest = rpm;
+                               } else if (rpm.length() > longest.length()) {
+                                       longest = rpm;
                                }
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                               return null;
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
-                               return null;
                        }
-               }
 
-               String select = null;
-               for (String line : lines) {
-                       if (null == select) {
-                               select = line;
-                       } else if (select.length() > line.length()) {
-                               select = line;
+                       if (longest != null) {
+                               debugRpmPath = rootPath + longest;
                        }
                }
 
-               if (null == select) {
+               return debugRpmPath;
+       }
+
+       // search for debug rpm file in rootPath
+       public String getDebugRpmPath(String binPath, String rootPath) {
+               String debugRpmPath;
+
+               // check whether rootPath exist or not
+               File rootPathDir = new File(rootPath);
+               if (!rootPathDir.isDirectory()) {
                        return null;
+               }
+
+               // make search token
+               String prefixToken, searchToken;
+               String[] splitTargetBin = binPath.split(CommonConstants.SLASH);
+               String binName = splitTargetBin[splitTargetBin.length - 1];
+               int index = binName.indexOf(AnalyzerConstants.LIB_EXT);
+               if (index < 0) {
+                       // executable binary
+                       prefixToken = "*" + binName + "*";
+               } else if (binName.startsWith(AnalyzerConstants.LIB_PREFIX)) {
+                       // shared library (libxxx.so)
+                       prefixToken = "*" + binName.substring(3, index) + "*";
                } else {
-                       debugPath = rootPath + select.substring(1, select.length());
+                       // shared library (xxx.so)
+                       prefixToken = "*" + binName.substring(0, index) + "*";
+               }
+
+               searchToken = prefixToken + RpmUtil.DEBUGINFO + "*" + RpmUtil.RPM_EXT;
+               debugRpmPath = findDebugRpmPath(searchToken, rootPath, null);
+               if (debugRpmPath != null) {
+                       return debugRpmPath;
+               }
+
+               searchToken = prefixToken + RpmUtil.DEBUG + "*" + RpmUtil.RPM_EXT;
+               debugRpmPath = findDebugRpmPath(searchToken, rootPath, null);
+               if (debugRpmPath != null) {
+                       return debugRpmPath;
+               }
+
+               searchToken = "*" + RpmUtil.RPM_EXT;
+               debugRpmPath = findDebugRpmPath(searchToken, rootPath, binName);
+               if (debugRpmPath != null) {
+                       return debugRpmPath;
                }
-               return debugPath;
+
+               return null;
        }
 }
index fb90924..90f7ef5 100644 (file)
@@ -75,7 +75,7 @@ public class BinarySettingProcessor implements Runnable {
                                BinarySettingData binaryData = new BinarySettingData();
                                binaryData.setBinaryPath(entry.getFullPath());
                                binaryData.setDebugRpmPath(BinarySettingManager.getInstance()
-                                               .getDebugInfoPath(entry.getFullPath(),
+                                               .getDebugRpmPath(entry.getFullPath(),
                                                                page.getDebugRootPath()));
                                addBinData.add(binaryData);
                                if (addBinData.size() < 40) {
@@ -86,7 +86,7 @@ public class BinarySettingProcessor implements Runnable {
                        BinarySettingProgressManager.getInstance().setValue(40);
 
                        if (addBinData.size() > 0) {
-                               BinarySettingManager.getInstance().putRealBinarySettingData(
+                               BinarySettingManager.getInstance().addBinarySettingData(
                                                addBinData);
                                BinarySettingProgressManager.getInstance().setValue(50);
 
@@ -111,7 +111,7 @@ public class BinarySettingProcessor implements Runnable {
                } else if (type == TYPE_LOAD) {
                        BinarySettingProgressManager.getInstance().setValue(30);
                        List<BinarySettingData> binarySettings = BinarySettingManager
-                                       .getInstance().getRealBinarySettings();
+                                       .getInstance().getBinarySettingList();
                        BinarySettingProgressManager.getInstance().setValue(50);
                        DACommunicator.sendBinaryInfoMessageForLib(binarySettings);
                        BinarySettingProgressManager.getInstance().setValue(80);
@@ -127,7 +127,7 @@ public class BinarySettingProcessor implements Runnable {
                } else {
                        BinarySettingProgressManager.getInstance().setValue(30);
                        List<BinarySettingData> binarySettings = BinarySettingManager
-                                       .getInstance().getRealBinarySettings();
+                                       .getInstance().getBinarySettingList();
                        BinarySettingProgressManager.getInstance().setValue(40);
                        int count = 41;
                        for (BinarySettingData binData : binarySettings) {
@@ -138,7 +138,7 @@ public class BinarySettingProcessor implements Runnable {
                                if (null == binData.getDebugRpmPath()
                                                || binData.getDebugRpmPath().isEmpty()) {
                                        String debugPath = BinarySettingManager.getInstance()
-                                                       .getDebugInfoPath(binData.getBinaryPath(),
+                                                       .getDebugRpmPath(binData.getBinaryPath(),
                                                                        page.getDebugRootPath());
                                        binData.setDebugRpmPath(debugPath);
                                }
index 1c6a215..0f5d68c 100644 (file)
@@ -38,8 +38,6 @@ import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
@@ -47,14 +45,12 @@ import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.BinarySettingsPage;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 import org.tizen.dynamicanalyzer.widgets.da.base.DAText;
 
 public class InputRow extends Composite {
-       // private Text binaryPathText = null;
        private Label binaryNameLabel = null;
        private DAText debugPathText = null;
        private DAText sourcePathText = null;
@@ -65,28 +61,6 @@ public class InputRow extends Composite {
        private DACustomButton removeButton = null;
        private int index = -1;
 
-       private DACustomButtonClickEventListener removeButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       BinarySettingManager.getInstance().removeInputRow(
-                                       binaryNameLabel.getText());
-                       Composite inputComposite = button.getParent().getParent();
-                       BinarySettingData rmData = BinarySettingManager.getInstance()
-                                       .getRealBinarySetting(binaryNameLabel.getText());
-                       List<BinarySettingData> rmBinaries = new ArrayList<BinarySettingData>();
-                       rmBinaries.add(rmData);
-                       DACommunicator.sendSWAPMessage(
-                                       AnalyzerConstants.MSG_SWAP_INST_REMOVE, rmBinaries);
-
-                       BinarySettingManager.getInstance().removeRealBinarySettingData(
-                                       binaryNameLabel.getText());
-                       button.getParent().dispose();
-                       ((BinarySettingsPage) (inputComposite.getParent().getParent()))
-                                       .updateLayout();
-               }
-       };
-
        private DACustomButtonClickEventListener findDebugButtonListener = new DACustomButtonClickEventListener() {
 
                @Override
@@ -94,7 +68,7 @@ public class InputRow extends Composite {
                        FileExplorerDialog dialog = new FileExplorerDialog(getShell());
                        dialog.setFilter("debug");
                        dialog.getExplorer().setRoot(
-//                                     BinarySettingManager.getInstance().getDebugRoot());
+                       // BinarySettingManager.getInstance().getDebugRoot());
                                        CommonUtil.getHomeDirectory());
                        Object result = dialog.open();
                        List<BinarySettingData> bins = new ArrayList<BinarySettingData>();
@@ -104,9 +78,8 @@ public class InputRow extends Composite {
                                if (!files.isEmpty()) {
                                        File file = files.get(0);
                                        debugPathText.setText(file.getAbsolutePath());
-                                       BinarySettingData binData = BinarySettingManager
-                                                       .getInstance().getRealBinarySetting(
-                                                                       binaryNameLabel.getText());
+                                       BinarySettingData binData = BinarySettingManager.getInstance()
+                                                       .getBinarySetting(binaryNameLabel.getText());
                                        // binData.setDebugFilePath(file.getAbsolutePath());
                                        binData.setDebugRpmPath(file.getAbsolutePath());
                                        bins.add(binData);
@@ -132,16 +105,15 @@ public class InputRow extends Composite {
                                                file = file.getParentFile();
                                        }
                                        sourcePathText.setText(file.getAbsolutePath());
-                                       BinarySettingData binData = BinarySettingManager
-                                                       .getInstance().getRealBinarySetting(
-                                                                       binaryNameLabel.getText());
-                                       binData.setUserSourcePath(file.getAbsolutePath());
+                                       BinarySettingData binData = BinarySettingManager.getInstance()
+                                                       .getBinarySetting(binaryNameLabel.getText());
+                                       binData.setUserSourceDir(file.getAbsolutePath());
                                }
                        }
                }
        };
 
-       public InputRow(Composite parent) {
+       public InputRow(Composite parent, DACustomButtonClickEventListener removeListener) {
                super(parent, SWT.BORDER);
                this.setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
 
@@ -165,46 +137,37 @@ public class InputRow extends Composite {
                this.setLayout(new FormLayout());
 
                binaryNameLabel = new Label(this, SWT.TRANSPARENT);
-               binaryNameLabel
-                               .setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
+               binaryNameLabel.setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
                binaryNameLabel.setFont(FontResources.getDADefaultFont());
 
                Label debugLabel = new Label(this, SWT.TRANSPARENT);
-               debugLabel
-                               .setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
+               debugLabel.setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
                debugLabel.setFont(FontResources.getDADefaultFont());
                debugLabel.setForeground(ColorResources.BINARY_SETTINGS_LABEL_COLOR);
                debugLabel.setText("Debug package");
 
                Label sourceLabel = new Label(this, SWT.TRANSPARENT);
-               sourceLabel
-                               .setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
+               sourceLabel.setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
                sourceLabel.setForeground(ColorResources.BINARY_SETTINGS_LABEL_COLOR);
                sourceLabel.setFont(FontResources.getDADefaultFont());
                sourceLabel.setText("Source Directory path");
 
                debugPathText = new DAText(this, SWT.SINGLE);
 
-               findDebugButton = new DACustomButton(this,
-                               ImageResources.FIND_BUTTON_NORMAL,
-                               ImageResources.FIND_BUTTON_PUSH,
-                               ImageResources.FIND_BUTTON_HOVER,
+               findDebugButton = new DACustomButton(this, ImageResources.FIND_BUTTON_NORMAL,
+                               ImageResources.FIND_BUTTON_PUSH, ImageResources.FIND_BUTTON_HOVER,
                                ImageResources.FIND_BUTTON_DISABLE);
                findDebugButton.addClickListener(findDebugButtonListener);
 
-               findSourceButton = new DACustomButton(this,
-                               ImageResources.FIND_BUTTON_NORMAL,
-                               ImageResources.FIND_BUTTON_PUSH,
-                               ImageResources.FIND_BUTTON_HOVER,
+               findSourceButton = new DACustomButton(this, ImageResources.FIND_BUTTON_NORMAL,
+                               ImageResources.FIND_BUTTON_PUSH, ImageResources.FIND_BUTTON_HOVER,
                                ImageResources.FIND_BUTTON_DISABLE);
                findSourceButton.addClickListener(findSourceButtonListener);
 
-               removeButton = new DACustomButton(this,
-                               ImageResources.DELETE_BUTTON_NORMAL,
-                               ImageResources.DELETE_BUTTON_PUSH,
-                               ImageResources.DELETE_BUTTON_HOVER,
+               removeButton = new DACustomButton(this, ImageResources.DELETE_BUTTON_NORMAL,
+                               ImageResources.DELETE_BUTTON_PUSH, ImageResources.DELETE_BUTTON_HOVER,
                                ImageResources.DELETE_BUTTON_DISABLE);
-               removeButton.addClickListener(removeButtonListener);
+               removeButton.addClickListener(removeListener);
 
                sourcePathText = new DAText(this, SWT.SINGLE);
                sourcePathText.setBackground(ColorResources.WHITE);
@@ -302,19 +265,14 @@ public class InputRow extends Composite {
 
        public String getSaveData() {
                StringBuffer strBuffer = new StringBuffer();
-               strBuffer.append(binaryNameLabel.getText()).append(
-                               CommonConstants.COMMA);
-               if (null == debugPathText.getText()
-                               || debugPathText.getText().isEmpty()) {
-                       strBuffer.append(CommonConstants.SPACE).append(
-                                       CommonConstants.COMMA);
+               strBuffer.append(binaryNameLabel.getText()).append(CommonConstants.COMMA);
+               if (null == debugPathText.getText() || debugPathText.getText().isEmpty()) {
+                       strBuffer.append(CommonConstants.SPACE).append(CommonConstants.COMMA);
                } else {
-                       strBuffer.append(debugPathText.getText()).append(
-                                       CommonConstants.COMMA);
+                       strBuffer.append(debugPathText.getText()).append(CommonConstants.COMMA);
                }
 
-               if (null == sourcePathText.getText()
-                               || sourcePathText.getText().isEmpty()) {
+               if (null == sourcePathText.getText() || sourcePathText.getText().isEmpty()) {
                        strBuffer.append(CommonConstants.SPACE);
                } else {
                        strBuffer.append(sourcePathText.getText());
index c15e5b5..516b882 100644 (file)
@@ -54,7 +54,6 @@ import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.nl.WidgetLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -125,8 +124,7 @@ public class SaveSettingDialog extends DAMessageBox {
        };
 
        private String getSaveFileName() {
-               SimpleDateFormat format = new SimpleDateFormat(DEFAULT_TIME_FORMAT,
-                               Locale.KOREA);
+               SimpleDateFormat format = new SimpleDateFormat(DEFAULT_TIME_FORMAT, Locale.KOREA);
                Date date = new Date();
                String tmpAppName = "da_";
                int length = tmpAppName.length() - MAX_SAVE_FILE_NAME_LENGTH;
@@ -141,23 +139,17 @@ public class SaveSettingDialog extends DAMessageBox {
        }
 
        private boolean executeSaveTrace() {
-               String targetPath = PathManager.DA_SETTING_PATH
-                               + File.separator + saveFileName + ".setting";
+               String targetPath = PathManager.DA_SETTING_PATH + File.separator + saveFileName
+                               + ".setting";
                File saveFile = new File(targetPath);
                FileWriter fileWriter = null;
                BufferedWriter bufWriter = null;
 
-               List<BinarySettingData> saveData = BinarySettingManager.getInstance()
-                               .getRealBinarySettings();
-
                boolean success = false;
                try {
                        fileWriter = new FileWriter(saveFile);
                        bufWriter = new BufferedWriter(fileWriter);
-                       for (int i = 0; i < saveData.size(); i++) {
-                               bufWriter.write(saveData.get(i).getSaveData());
-                               bufWriter.newLine();
-                       }
+                       BinarySettingManager.getInstance().saveData(bufWriter);
                        success = true;
                } catch (IOException e) {
                        e.printStackTrace();
@@ -217,8 +209,7 @@ public class SaveSettingDialog extends DAMessageBox {
                                e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1);
                                e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
                                e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2);
-                               e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width,
-                                               rect.y + 1);
+                               e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width, rect.y + 1);
                        }
                });
 
@@ -267,8 +258,7 @@ public class SaveSettingDialog extends DAMessageBox {
                if (str == null
                                || str.isEmpty()
                                || str.contains("\\") //$NON-NLS-1$
-                               || str.contains(CommonConstants.SLASH)
-                               || str.contains(CommonConstants.COLON)
+                               || str.contains(CommonConstants.SLASH) || str.contains(CommonConstants.COLON)
                                || str.contains(CommonConstants.ASTERISK)
                                || str.contains("\\?") || str.contains("\"") //$NON-NLS-1$ //$NON-NLS-2$
                                || str.contains("<") || str.contains(">") //$NON-NLS-1$ //$NON-NLS-2$
index 24e8f8d..6d9f708 100644 (file)
@@ -39,9 +39,11 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.project.BinaryInfo;
 import org.tizen.dynamicanalyzer.project.LibraryObject;
 import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
+import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
@@ -80,21 +82,25 @@ public class HeapChart extends TimelineChart {
                 * Add total allocation
                 */
                DAChartSeries totalAllocationSeries = new DAChartSeries(
-                               TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION, DAChartSeries.SERIES_STYLE_AREA,
-                               ColorResources.SERIES_COLOR_HEAP_SYSTEM);
-               chartSeriesMap.put(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION, totalAllocationSeries);
+                               TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION,
+                               DAChartSeries.SERIES_STYLE_AREA, ColorResources.SERIES_COLOR_HEAP_SYSTEM);
+               chartSeriesMap.put(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION,
+                               totalAllocationSeries);
                /*
                 * Add additional library allocation
                 */
-               HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager.getInstance().getTargetBinInfoMap();
-               ProcessMemoryMap pmap = AnalyzerManager.getProject().getProcessInformation(pid)
-                               .getProcessMemoryMap(ToolbarArea.getInstance().getTime());
-               Iterator<String> iter = binInfoMap.keySet().iterator();
-               while (iter.hasNext()) {
-                       String libraryPath = iter.next();
-                       LibraryObject libObj = pmap.getLibraryByBinaryID(binInfoMap.get(libraryPath).getID());
+               Project project = AnalyzerManager.getProject();
+               List<BinarySettingData> binDataList = BinarySettingManager.getInstance()
+                               .getBinarySettingList();
+               ProcessMemoryMap pmap = project.getProcessInformation(pid).getProcessMemoryMap(
+                               ToolbarArea.getInstance().getTime());
+               for (BinarySettingData binData : binDataList) {
+                       String libraryPath = binData.getBinaryPath();
+                       BinaryInfo binInfo = project.getDeviceStatusInfo().getBinaryInfo(libraryPath);
+                       LibraryObject libObj = pmap.getLibraryByBinaryID(binInfo.getID());
                        if (null != libObj) {
-                               DAChartSeries libraryAllocSeries = new DAChartSeries(libraryPath, DAChartSeries.SERIES_STYLE_AREA);
+                               DAChartSeries libraryAllocSeries = new DAChartSeries(libraryPath,
+                                               DAChartSeries.SERIES_STYLE_AREA);
                                chartSeriesMap.put(libraryPath, libraryAllocSeries);
                        }
                }
@@ -102,9 +108,10 @@ public class HeapChart extends TimelineChart {
                 * Add target allocation
                 */
                DAChartSeries targetAllocationSeries = new DAChartSeries(
-                               TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION, DAChartSeries.SERIES_STYLE_AREA,
-                               ColorResources.SERIES_COLOR_HEAP_USER);
-               chartSeriesMap.put(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION, targetAllocationSeries);
+                               TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION,
+                               DAChartSeries.SERIES_STYLE_AREA, ColorResources.SERIES_COLOR_HEAP_USER);
+               chartSeriesMap.put(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION,
+                               targetAllocationSeries);
 
                return chartSeriesMap;
        }
@@ -148,7 +155,8 @@ public class HeapChart extends TimelineChart {
                                popupMenu, parent.getChartBoard().getTimeline());
                chart.addMouseListener(timelineChartMouseEventListener);
                chart.addMouseMoveListener(timelineChartMouseEventListener);
-               chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(parent.getChartBoard().getTimeline()));
+               chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(parent.getChartBoard()
+                               .getTimeline()));
 
                return item;
        }
@@ -188,7 +196,8 @@ public class HeapChart extends TimelineChart {
                                Display.getDefault().syncExec(new Runnable() {
                                        @Override
                                        public void run() {
-                                               parentBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue(),
+                                               parentBoardItem.getItemCell().setAdditionalInfo(
+                                                               processName + "\nPID : " + pid.intValue(),
                                                                ImageResources.CHART_HEAP_SMALL);
                                        }
                                });
@@ -203,10 +212,12 @@ public class HeapChart extends TimelineChart {
                                        @Override
                                        public void run() {
                                                HeapChart childChart = new HeapChart();
-                                               DAChartBoardItem childBoardItem = childChart.createChildBoardItem(parentBoardItem);
+                                               DAChartBoardItem childBoardItem = childChart
+                                                               .createChildBoardItem(parentBoardItem);
                                                setChartSeries(childBoardItem.getChart(), seriesMap);
                                                String processName = AnalyzerUtil.getProcessName(pid.intValue());
-                                               childBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue(),
+                                               childBoardItem.getItemCell().setAdditionalInfo(
+                                                               processName + "\nPID : " + pid.intValue(),
                                                                ImageResources.CHART_HEAP_SMALL);
                                                childBoardItemList.add(childBoardItem);
                                                parentBoardItem.unFoldChild();
@@ -219,14 +230,15 @@ public class HeapChart extends TimelineChart {
                                List<Object> row = data.get(i);
                                double time = (Long) row.get(TargetProcessDBTable.COLUMN.TIME.ordinal())
                                                / TimelineConstants.MEGA_DOUBLE;
-                               long totalAlloc = (Long) row.get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_TOTAL_BYTE.ordinal());
+                               long totalAlloc = (Long) row
+                                               .get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_TOTAL_BYTE.ordinal());
 
                                @SuppressWarnings("unchecked")
-                               List<Object> binaryPathList = (List<Object>) row.get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_NAME
-                                               .ordinal());
+                               List<Object> binaryPathList = (List<Object>) row
+                                               .get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_NAME.ordinal());
                                @SuppressWarnings("unchecked")
-                               List<Object> binaryAllocList = (List<Object>) row.get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_BYTE
-                                               .ordinal());
+                               List<Object> binaryAllocList = (List<Object>) row
+                                               .get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_BYTE.ordinal());
 
                                DAChartSeries totalAllocSeries = seriesMap
                                                .get(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION);
@@ -238,7 +250,8 @@ public class HeapChart extends TimelineChart {
                                                                                                                                        // located
                                                                                                                                        // at first
                                                                                                                                        // index.
-                               DAChartSeries appAllocSeries = seriesMap.get(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION);
+                               DAChartSeries appAllocSeries = seriesMap
+                                               .get(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION);
                                appAllocSeries.addSeriesItem(new DAChartSeriesItem(time, targetAlloc, Formatter
                                                .toByteFormat(targetAlloc)));
 
@@ -261,8 +274,8 @@ public class HeapChart extends TimelineChart {
                                        if (index > 0) {
                                                libraryAlloc = (Long) binaryAllocList.get(index);
                                        }
-                                       allocSeries.addSeriesItem(new DAChartSeriesItem(time, totalUserAlloc - beforeLibraryAlloc,
-                                                       Formatter.toByteFormat(libraryAlloc)));
+                                       allocSeries.addSeriesItem(new DAChartSeriesItem(time, totalUserAlloc
+                                                       - beforeLibraryAlloc, Formatter.toByteFormat(libraryAlloc)));
                                        beforeLibraryAlloc = libraryAlloc;
                                }
                        }
@@ -275,7 +288,8 @@ public class HeapChart extends TimelineChart {
                while (iterSeries.hasNext()) {
                        String libraryPath = iterSeries.next();
                        if (libraryPath.equals(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION)
-                                       || libraryPath.equals(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION)) {
+                                       || libraryPath
+                                                       .equals(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION)) {
                                continue;
                        }
                        chart.addSeries(seriesMap.get(libraryPath));
index 54ebfda..afdbb97 100755 (executable)
@@ -264,6 +264,8 @@ public class ToolbarArea {
                                                        if (selectedPkg.getMainApp().getRunningProcesses() == null) {
                                                                enablestart = false;
                                                        }
+                                               } else if (appName.equals(AnalyzerConstants.COMMON_EXECUTABLE)) {
+                                                       // TODO : implement to select common executable
                                                }
 
                                                GlobalInformation.setCurrentApplication(selectedPkg);
@@ -944,7 +946,7 @@ public class ToolbarArea {
        }
 
        public void setAppComboTextByAppId(String id) {
-               PackageInfo pkgInfo = DACommunicator.getPkgInfoByPkgId(id);
+               PackageInfo pkgInfo = DACommunicator.getPkgInfoByMainAppID(id);
                if (null != pkgInfo) {
                        GlobalInformation.setCurrentApplication(pkgInfo);
                        GlobalInformation.getCurrentDeviceInfo().getCommunicator().onAppSelected(pkgInfo);
index e10c9eb..38ce074 100644 (file)
 package org.tizen.dynamicanalyzer.ui.toolbar.configuration;
 
 import java.io.BufferedReader;
-import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 import org.eclipse.swt.SWT;
@@ -78,7 +75,6 @@ public class BinarySettingsPage extends DAPageComposite {
        public static final int RADIO_ADD = 2;
        public static final int RADIO_REMOVE = 3;
 
-       private HashMap<String, InputRow> inputRowHash = null;
        private List<InputRow> inputRowList = null;
 
        private ScrolledComposite scrolledComposite = null;
@@ -99,7 +95,7 @@ public class BinarySettingsPage extends DAPageComposite {
                @Override
                public void handleClickEvent(DACustomButton button) {
                        DeviceExplorerDilaog dialog = new DeviceExplorerDilaog(getShell());
-//                     dialog.setFilter(".so");
+                       // dialog.setFilter(".so");
                        Object result = dialog.open();
                        if (result != null) {
                                BinarySettingProgressManager.getInstance().startProcessStart(
@@ -109,12 +105,31 @@ public class BinarySettingsPage extends DAPageComposite {
                }
        };
 
+       private DACustomButtonClickEventListener removeButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       String binaryPath = ((InputRow) button.getParent()).getBinaryText();
+
+                       removeInputRow(binaryPath);
+                       Composite inputComposite = button.getParent().getParent();
+                       BinarySettingData rmData = BinarySettingManager.getInstance().getBinarySetting(
+                                       binaryPath);
+                       List<BinarySettingData> rmBinaries = new ArrayList<BinarySettingData>();
+                       rmBinaries.add(rmData);
+                       DACommunicator.sendSWAPMessage(AnalyzerConstants.MSG_SWAP_INST_REMOVE, rmBinaries);
+
+                       BinarySettingManager.getInstance().removeBinarySettingData(binaryPath);
+                       button.getParent().dispose();
+                       ((BinarySettingsPage) (inputComposite.getParent().getParent())).updateLayout();
+               }
+       };
+
        private DACustomButtonClickEventListener loadButtonListener = new DACustomButtonClickEventListener() {
 
                @Override
                public void handleClickEvent(DACustomButton button) {
-                       LoadSettingDialog dialog = new LoadSettingDialog(button.getParent()
-                                       .getShell());
+                       LoadSettingDialog dialog = new LoadSettingDialog(button.getParent().getShell());
                        Object result = dialog.open();
                        if (result == null) {
                                return;
@@ -126,27 +141,20 @@ public class BinarySettingsPage extends DAPageComposite {
                        String path = (String) result;
                        File saveFile = new File(path);
                        BufferedReader br = null;
-                       String content = null;
                        try {
-                               List<BinarySettingData> binarySettings = new ArrayList<BinarySettingData>();
                                br = new BufferedReader(new FileReader(saveFile));
-                               while (null != (content = br.readLine())) {
-                                       InputRow inputRow = new InputRow(inputComposite);
-                                       String[] splitContent = content
-                                                       .split(CommonConstants.COMMA);
-                                       inputRow.setBinaryText(new String(splitContent[0]));
-                                       inputRow.setDebugText(new String(splitContent[3]));
-                                       inputRow.setSourceText(new String(splitContent[4]));
+                               BinarySettingManager.getInstance().openData(br);
+                               List<BinarySettingData> binarySettings = BinarySettingManager.getInstance()
+                                               .getBinarySettingList();
+
+                               for (int i = 0; i < binarySettings.size(); i++) {
+                                       InputRow inputRow = new InputRow(inputComposite, removeButtonListener);
+                                       inputRow.setBinaryText(binarySettings.get(i).getBinaryPath());
+                                       inputRow.setDebugText(binarySettings.get(i).getDebugRpmPath());
+                                       inputRow.setSourceText(binarySettings.get(i).getUserSourceDir());
                                        inputRowList.add(inputRow);
-                                       inputRowHash.put(inputRow.getBinaryText(), inputRow);
-
-                                       BinarySettingData binaryData = new BinarySettingData();
-                                       binaryData.loadSaveData(content);
-                                       binarySettings.add(binaryData);
                                }
 
-                               BinarySettingManager.getInstance().putRealBinarySettingData(
-                                               binarySettings);
                                BinarySettingProgressManager.getInstance().startProcessStart(
                                                "now loading binaries...");
                                BinarySettingProcessor.runLoadingThread(me);
@@ -179,20 +187,21 @@ public class BinarySettingsPage extends DAPageComposite {
                                }
 
                                if (null != rootPath) {
-                                       BinarySettingProgressManager.getInstance()
-                                                       .startProcessStart("Wait for update debug path");
+                                       BinarySettingProgressManager.getInstance().startProcessStart(
+                                                       "Wait for update debug path");
                                        BinarySettingProcessor.runUpdateDebugRoot(me);
                                        BinarySettingManager.getInstance().setDebugRoot(rootPath);
                                }
                        }
                }
        };
+
        private DACustomButtonClickEventListener saveButtonListener = new DACustomButtonClickEventListener() {
 
                @Override
                public void handleClickEvent(DACustomButton button) {
-                       SaveSettingDialog dialog = new SaveSettingDialog(button.getParent()
-                                       .getShell(), inputRowList);
+                       SaveSettingDialog dialog = new SaveSettingDialog(button.getParent().getShell(),
+                                       inputRowList);
                        dialog.open();
                }
        };
@@ -209,20 +218,17 @@ public class BinarySettingsPage extends DAPageComposite {
                                        return;
                                }
                        }
-                       List<BinarySettingData> binaries = BinarySettingManager
-                                       .getInstance().getRealBinarySettings();
+                       List<BinarySettingData> binaries = BinarySettingManager.getInstance()
+                                       .getBinarySettingList();
                        if (!binaries.isEmpty()) {
-                               DACommunicator.sendSWAPMessage(
-                                               AnalyzerConstants.MSG_SWAP_INST_REMOVE, binaries);
+                               DACommunicator.sendSWAPMessage(AnalyzerConstants.MSG_SWAP_INST_REMOVE, binaries);
 
                                for (int i = 0; i < inputRowList.size(); i++) {
-                                       BinarySettingManager.getInstance()
-                                                       .removeRealBinarySettingData(
-                                                                       inputRowList.get(i).getBinaryText());
+                                       BinarySettingManager.getInstance().removeBinarySettingData(
+                                                       inputRowList.get(i).getBinaryText());
                                        inputRowList.get(i).dispose();
                                }
                                inputRowList.clear();
-                               inputRowHash.clear();
                        }
 
                        updateLayout();
@@ -234,17 +240,14 @@ public class BinarySettingsPage extends DAPageComposite {
                        inputRowList.get(i).dispose();
                }
                inputRowList.clear();
-               inputRowHash.clear();
        }
 
        public BinarySettingsPage(Composite parent, int style) {
                super(parent, style);
                me = this;
                setTitle("Binary Settings"); // TODO nl
-               rootPath = PathManager
-                               .getRootstrapsPath(ConfigureManager.getPlatform());
-               inputRowHash = BinarySettingManager.getInstance().getInputRowHash();
-               inputRowList = BinarySettingManager.getInstance().getInputRowList();
+               rootPath = PathManager.getRootstrapsPath(ConfigureManager.getPlatform());
+               inputRowList = new ArrayList<InputRow>();
 
                String settingPath = PathManager.DA_SETTING_PATH;
                File settingFolder = new File(settingPath);
@@ -257,8 +260,7 @@ public class BinarySettingsPage extends DAPageComposite {
                this.setLayout(new FormLayout());
                this.setBackground(ColorResources.DIALOG_BG_UPPER);
 
-               int libCount = BinarySettingManager.getInstance()
-                               .getRealBinarySettings().size();
+               int libCount = BinarySettingManager.getInstance().getBinarySettingList().size();
                librariesLabel = new Label(this, SWT.TRANSPARENT);
                FormData data = new FormData();
                data.top = new FormAttachment(0, 15);
@@ -270,8 +272,7 @@ public class BinarySettingsPage extends DAPageComposite {
                librariesLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
                librariesLabel.setFont(FontResources.getDADefaultFont());
 
-               scrolledComposite = new ScrolledComposite(this, SWT.BORDER
-                               | SWT.V_SCROLL | SWT.H_SCROLL);
+               scrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
                data = new FormData();
                data.top = new FormAttachment(librariesLabel, 4);
                data.left = new FormAttachment(0, 6);
@@ -282,13 +283,11 @@ public class BinarySettingsPage extends DAPageComposite {
                scrolledComposite.setLayout(new FormLayout());
                scrolledComposite.setExpandHorizontal(true);
                scrolledComposite.setExpandVertical(true);
-               scrolledComposite
-                               .setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
+               scrolledComposite.setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
 
                inputComposite = new Composite(scrolledComposite, SWT.NONE);
                scrolledComposite.setContent(inputComposite);
-               scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT,
-                               SWT.DEFAULT));
+               scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
                scrolledComposite.setShowFocusedControl(true);
                data = new FormData();
                data.top = new FormAttachment(0, 5);
@@ -297,8 +296,7 @@ public class BinarySettingsPage extends DAPageComposite {
                data.bottom = new FormAttachment(100, -5);
                inputComposite.setLayoutData(data);
                inputComposite.setLayout(new FormLayout());
-               inputComposite
-                               .setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
+               inputComposite.setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
 
                loadButton = new DAButton(this, SWT.NONE);
                data = new FormData();
@@ -350,9 +348,6 @@ public class BinarySettingsPage extends DAPageComposite {
                addButton.setText("Add");
                addButton.addClickListener(addButtonListener);
 
-               inputRowList.clear();
-               inputRowHash.clear();
-
                this.addListener(SWT.Show, new Listener() {
 
                        @Override
@@ -375,11 +370,10 @@ public class BinarySettingsPage extends DAPageComposite {
                        String binary = inputRow.getBinaryText();
                        String debug = inputRow.getDebugText();
                        String source = inputRow.getSourceText();
-                       BinarySettingData binData = BinarySettingManager.getInstance()
-                                       .getRealBinarySetting(binary);
+                       BinarySettingData binData = BinarySettingManager.getInstance().getBinarySetting(binary);
                        if (binData != null) {
                                binData.setDebugRpmPath(debug);
-                               binData.setUserSourcePath(source);
+                               binData.setUserSourceDir(source);
                        } else {
                                Logger.debug("binary data is null");
                        }
@@ -389,45 +383,14 @@ public class BinarySettingsPage extends DAPageComposite {
        }
 
        public void doClose() {
-               String targetPath = PathManager.DA_BINARY_AUTO_SAVE_FILE;
-
-               File saveFile = new File(targetPath);
-               FileWriter fileWriter = null;
-               BufferedWriter bufWriter = null;
-
-               List<BinarySettingData> saveData = BinarySettingManager.getInstance()
-                               .getRealBinarySettings();
-
-               boolean success = false;
-               try {
-                       fileWriter = new FileWriter(saveFile);
-                       bufWriter = new BufferedWriter(fileWriter);
-                       for (int i = 0; i < saveData.size(); i++) {
-                               bufWriter.write(saveData.get(i).getSaveData());
-                               bufWriter.newLine();
-                       }
-                       success = true;
-               } catch (IOException e) {
-                       e.printStackTrace();
-               } finally {
-                       CommonUtil.tryClose(bufWriter, fileWriter);
-               }
-
-               if (success) {
-                       // add snapshot model update
-                       Logger.debug("binary settings auto save success!!"); //$NON-NLS-1$
-
-               } else {
-                       Logger.debug("binary settings auto save fail..."); //$NON-NLS-1$
-               }
        }
 
        public void initInputRows() {
                List<BinarySettingData> binData = null;
-               binData = BinarySettingManager.getInstance().getRealBinarySettings();
+               binData = BinarySettingManager.getInstance().getBinarySettingList();
                clearLayout();
                for (int i = 0; i < binData.size(); i++) {
-                       InputRow inputRow = new InputRow(inputComposite);
+                       InputRow inputRow = new InputRow(inputComposite, removeButtonListener);
                        inputRow.setBinaryText(binData.get(i).getBinaryPath());
                        // String debug = binData.get(i).getDebugFilePath();
                        String debug = binData.get(i).getDebugRpmPath();
@@ -437,30 +400,62 @@ public class BinarySettingsPage extends DAPageComposite {
                                inputRow.setDebugText(CommonConstants.EMPTY);
                        }
 
-                       String source = binData.get(i).getUserSourcePath();
+                       String source = binData.get(i).getUserSourceDir();
                        if (null != source && !source.isEmpty()) {
                                inputRow.setSourceText(source);
                        } else {
-                               source = binData.get(i).getDebugSourcePath();
+                               source = binData.get(i).getRpmSourceDir();
                                if (null != source && !source.isEmpty()) {
                                        inputRow.setSourceText(source);
                                } else {
                                        inputRow.setSourceText(CommonConstants.EMPTY);
                                }
                        }
-                       inputRowHash.put(binData.get(i).getBinaryPath(), inputRow);
                        inputRowList.add(inputRow);
                }
                updateLayout();
        }
 
+       private void removeInputRow(String path) {
+               InputRow prev = null;
+               InputRow cur = null;
+               InputRow next = null;
+
+               for (int i = 0; i < inputRowList.size(); i++) {
+                       // define prev, cur, next inputRow
+                       if (i != 0) {
+                               prev = cur;
+                       }
+                       cur = inputRowList.get(i);
+                       if (i != inputRowList.size() - 1) {
+                               next = inputRowList.get(i + 1);
+                       } else {
+                               next = null;
+                       }
+
+                       if (cur.getBinaryText().equals(path)) {
+                               // modify layout of next input row
+                               if (next != null) {
+                                       FormData nextData = (FormData) next.getLayoutData();
+                                       if (prev != null) {
+                                               nextData.top = new FormAttachment(prev, 2);
+                                       } else {
+                                               nextData.top = new FormAttachment(0, 0);
+                                       }
+                               }
+
+                               // remove from row list
+                               inputRowList.remove(i);
+                               break;
+                       }
+               }
+       }
+
        public void updateLayout() {
-               int count = BinarySettingManager.getInstance().getRealBinarySettings()
-                               .size();
+               int count = BinarySettingManager.getInstance().getBinarySettingList().size();
                librariesLabel.setText("Libraries (" + count + ")");
                inputComposite.layout();
-               scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT,
-                               SWT.DEFAULT));
+               scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
                if (count == 0) {
                        saveButton.setButtonEnabled(false);
                        clearButton.setButtonEnabled(false);
index d0e3e0d..00436f0 100644 (file)
@@ -12,20 +12,27 @@ import org.tizen.dynamicanalyzer.util.Logger;
 
 public class RpmUtil {
        public static final String RPM_EXT = ".rpm";
+       public static final String DEVEL = "devel";
+       public static final String DEBUG = "debug-";
        public static final String DEBUGINFO = "debuginfo";
        public static final String DEBUGSOURCE = "debugsource";
 
        // extract rpm file exists
-       public static void extractRpm(String targetpath, String rpmpath) {
+       public static boolean extractRpm(String targetpath, String rpmpath) {
+               boolean bret = false;
                if (null != rpmpath) {
                        String toolPath = PathManager.getDebugInfoScript();
-                       String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d", targetpath, rpmpath };
+                       String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d",
+                                       targetpath, rpmpath };
+
+                       BufferedReader reader = null;
+                       BufferedReader error = null;
+
                        try {
                                Runtime rt = Runtime.getRuntime();
                                Process process = rt.exec(command);
                                process.waitFor();
-                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                               process.getInputStream()));
+                               reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
 
                                String line = null;
                                int lineCount = 0;
@@ -38,18 +45,23 @@ public class RpmUtil {
                                        }
                                }
 
-                               if (lineCount == 0) {
-                                       BufferedReader error = new BufferedReader(new InputStreamReader(
-                                                       process.getErrorStream()));
+                               if (lineCount < 2) {
+                                       error = new BufferedReader(new InputStreamReader(process.getErrorStream()));
                                        String errorStr = error.readLine();
                                        Logger.debug("debug info file extract failed... : " + errorStr);
+                               } else {
+                                       bret = true;
                                }
                        } catch (IOException e) {
                                e.printStackTrace();
                        } catch (InterruptedException e) {
                                e.printStackTrace();
+                       } finally {
+                               CommonUtil.tryClose(reader, error);
                        }
                }
+
+               return bret;
        }
 
        public static List<String> getFileListInRpm(String rpmpath) {
@@ -58,12 +70,12 @@ public class RpmUtil {
                if (null != rpmpath) {
                        String toolPath = PathManager.getDebugInfoScript();
                        String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-l", rpmpath };
+                       BufferedReader reader = null;
                        try {
                                Runtime rt = Runtime.getRuntime();
                                Process process = rt.exec(command);
                                process.waitFor();
-                               BufferedReader reader = new BufferedReader(new InputStreamReader(
-                                               process.getInputStream()));
+                               reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
 
                                ret = new ArrayList<String>();
                                String line = null;
@@ -77,25 +89,27 @@ public class RpmUtil {
                                e.printStackTrace();
                        } catch (InterruptedException e) {
                                e.printStackTrace();
+                       } finally {
+                               CommonUtil.tryClose(reader);
                        }
                }
 
                return ret;
        }
-       
+
        public static String getDebugInfoOption() {
                String option = null;
-               
+
                if (CommonUtil.isLinux()) {
                        option = "-u";
                } else if (CommonUtil.isMac()) {
-                       option = "-m";                  
+                       option = "-m";
                } else if (CommonUtil.isWin()) {
-                       option = "";                    
+                       option = "";
                } else { // should never be here
-                       Logger.error("Unknown host OS!\n");                     
+                       Logger.error("Unknown host OS!\n");
                }
-               
+
                return option;
        }
 }