LAUNCHER: Assign .debug file directly when attach debugging 96/11796/1
authordonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 5 Nov 2013 07:10:28 +0000 (16:10 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 5 Nov 2013 07:10:28 +0000 (16:10 +0900)
Assign .debug file directly when attach debugging.
 - before: Assign just directory path and expect load .debug file
automatically.
 - after: Assign .debug file directly with directory path.

Change-Id: I46a297d11fb42a423d9ad68898c2b7d21bbef4d0
Signed-off-by: donghyuk.yang <donghyuk.yang@samsung.com>
org.tizen.nativeplatform/src/org/tizen/nativeplatform/launch/PlatformLaunchDelegateForAttach.java

index 97cbaaa..6b1d4cb 100644 (file)
@@ -146,14 +146,17 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
     private void setSharedlibrarySearchPath(ILaunchConfiguration config) throws CoreException {
 
         // Attach debugging should add the "Debug" directory to its [Shared Libraries] path.
-        List<String> values = config.getAttribute(
+        List<String> soLibPath = config.getAttribute(
                 IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, new ArrayList(1));
+        List<String> soLibList = config.getAttribute(
+                IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, new ArrayList(1));
         ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
         IProject proj = ProjectUtil.getProject(config);
-        String appPath = config
+        String appPath = "";
+        String binaryPath = config
                 .getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
-        if (!appPath.isEmpty()) {
-            appPath = new Path(appPath).removeLastSegments(1).toOSString();
+        if (!binaryPath.isEmpty()) {
+            appPath = new Path(binaryPath).removeLastSegments(1).toOSString();
         } else {
             newCoreException(TizenLaunchMessages.CANNOT_LAUNCH_APPLICATION_WITH_GDBSERVER, null);
         }
@@ -165,15 +168,25 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
                 + appPath);
 
         if (canAddLibrarySearchPath(config, debugProjPath)) {
-            values.add(debugProjPath.toOSString());
+            soLibPath.add(debugProjPath.toOSString());
+        }
+
+        IPath programPath = new Path(rootstrapPath + File.separatorChar + "usr"
+                + File.separatorChar + "lib" + File.separatorChar + "debug" + File.separatorChar
+                + binaryPath + ".debug");
+
+        if (canAddLibraryPath(config, programPath)) {
+            soLibList.add(programPath.toOSString());
         }
 
+        List<String> aa = new ArrayList<String>();
+        aa.add(debugProjPath.append("taskmgr.debug").toOSString());
         IPath debugBinPath = new Path(rootstrapPath + File.separatorChar + "usr"
                 + File.separatorChar + "lib" + File.separatorChar + "debug" + File.separatorChar
                 + "usr" + File.separatorChar + "bin");
 
         if (canAddLibrarySearchPath(config, debugBinPath)) {
-            values.add(debugBinPath.toOSString());
+            soLibPath.add(debugBinPath.toOSString());
         }
 
         IPath debugLibPath = new Path(rootstrapPath + File.separatorChar + "usr"
@@ -181,13 +194,14 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
                 + "usr" + File.separatorChar + "lib");
 
         if (canAddLibrarySearchPath(config, debugLibPath)) {
-            values.add(debugLibPath.toOSString());
+            soLibPath.add(debugLibPath.toOSString());
         }
 
         // set shared library search path
-        if (values.size() > 0) {
-            wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, values);
+        if (soLibPath.size() > 0) {
+            wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH, soLibPath);
         }
+        wc.setAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST, soLibList);
         wc.doSave();
     }
 
@@ -208,6 +222,24 @@ public class PlatformLaunchDelegateForAttach extends PlatformLaunchDelegate {
         return ret;
     }
 
+    protected boolean canAddLibraryPath(ILaunchConfiguration config, IPath searchPath)
+            throws CoreException {
+        List<String> values = config.getAttribute(
+                IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB_LIST,
+                Collections.EMPTY_LIST);
+        Iterator it = values.iterator();
+        boolean ret = true;
+
+        while (it.hasNext()) {
+            IPath oldPath = new Path((String) it.next());
+            if (PathUtil.equalPath(oldPath, searchPath)) {
+                ret = false;
+                break;
+            }
+        }
+        return ret;
+    }
+
     protected void checkChangedConfiguration(ILaunchConfiguration config) throws CoreException {
         setAttachProcess(config);
     }