# HG changeset patch # User timkelly # Date 1268418363 21600 # Node ID fc2867001a802adffafecebdbf5516aeb7ca0c46 # Parent 664feec309ffaf814cf843ed82191b52aab1b75c Refactor executables view support extension from com.nokia.carbide.cpp.edc to com.nokia.cdt.debug.common. diff -r 664feec309ff -r fc2867001a80 debuggercdi/com.nokia.cdt.debug.common/META-INF/MANIFEST.MF --- a/debuggercdi/com.nokia.cdt.debug.common/META-INF/MANIFEST.MF Thu Mar 11 20:24:32 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.common/META-INF/MANIFEST.MF Fri Mar 12 12:26:03 2010 -0600 @@ -6,8 +6,12 @@ Bundle-Activator: com.nokia.cdt.debug.common.CarbideCommonDebuggerPlugin Bundle-Vendor: Nokia Require-Bundle: org.eclipse.core.runtime, + org.eclipse.cdt.core, org.eclipse.cdt.debug.core;bundle-version="7.0.0", - org.eclipse.debug.core;bundle-version="3.6.0" + org.eclipse.debug.core;bundle-version="3.6.0", + com.nokia.carbide.cdt.builder;bundle-version="2.0.0", + org.eclipse.cdt.debug.edc Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy -Export-Package: com.nokia.cdt.debug.common.internal.source.lookup +Export-Package: com.nokia.cdt.debug.common.internal.source.lookup, + com.nokia.cdt.debug.common.internal.executables diff -r 664feec309ff -r fc2867001a80 debuggercdi/com.nokia.cdt.debug.common/plugin.xml --- a/debuggercdi/com.nokia.cdt.debug.common/plugin.xml Thu Mar 11 20:24:32 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.common/plugin.xml Fri Mar 12 12:26:03 2010 -0600 @@ -20,4 +20,21 @@ name="Symbian OS SDK Mapping"/> + + + + + + + + + + + + + + diff -r 664feec309ff -r fc2867001a80 debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/CarbideExecutablesProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/CarbideExecutablesProvider.java Fri Mar 12 12:26:03 2010 -0600 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +package com.nokia.cdt.debug.common.internal.executables; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.cdt.core.CProjectNature; +import org.eclipse.cdt.debug.core.executables.Executable; +import org.eclipse.cdt.debug.core.executables.IProjectExecutablesProvider; +import org.eclipse.cdt.debug.core.executables.ISourceFileRemapping; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; + +import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; +import com.nokia.carbide.cdt.builder.EpocEngineHelper; +import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; +import com.nokia.cdt.debug.common.CarbideCommonDebuggerPlugin; + +public class CarbideExecutablesProvider implements IProjectExecutablesProvider { + + List supportedNatureIds = new ArrayList(); + + public CarbideExecutablesProvider() { + supportedNatureIds.add(CProjectNature.C_NATURE_ID); + supportedNatureIds.add(CCProjectNature.CC_NATURE_ID); + supportedNatureIds.add(CarbideBuilderPlugin.CARBIDE_PROJECT_NATURE_ID); + supportedNatureIds.add(CarbideBuilderPlugin.CARBIDE_SBSV2_PROJECT_NATURE_ID); + } + + public List getProjectNatures() { + return supportedNatureIds; + } + + public List getExecutables(IProject project, IProgressMonitor monitor) { + List executables = new ArrayList(); + + if (CarbideBuilderPlugin.getBuildManager().isCarbideProject(project)) { + ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); + if (cpi != null) { + ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); + if (config != null) { + List mmps = EpocEngineHelper.getMMPFilesForBuildConfiguration(config); + + SubMonitor progress = SubMonitor.convert(monitor, mmps.size()); + + for (IPath mmp : mmps) { + if (progress.isCanceled()) { + break; + } + + progress.subTask("Parsing " + mmp.lastSegment()); + + IPath hp = EpocEngineHelper.getHostPathForExecutable(config, mmp); + if (hp != null) { + File hpFile = hp.toFile(); + if (hpFile.exists()) { + try { + Executable exe = new Executable(new Path(hpFile.getCanonicalPath()), + project, null, new ISourceFileRemapping[] {new SymbianSourceFileRemapping()}); + executables.add(exe); + } catch (Exception e) { + } + } + } + + progress.worked(1); + } + } + } + } + + return executables; + } + + public IStatus removeExecutable(Executable executable, IProgressMonitor monitor) { + try { + executable.getPath().toFile().delete(); + } catch (Exception e) { + return new Status(IStatus.WARNING, CarbideCommonDebuggerPlugin.PLUGIN_ID, "An error occured trying to delete " + executable.getPath().toOSString()); + } + return Status.OK_STATUS; + } +} diff -r 664feec309ff -r fc2867001a80 debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/SymbianSourceFileRemapping.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/SymbianSourceFileRemapping.java Fri Mar 12 12:26:03 2010 -0600 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +package com.nokia.cdt.debug.common.internal.executables; + +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.executables.ISourceFileRemapping; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; + +import com.nokia.cdt.debug.common.internal.source.lookup.SymbianSourceContainer; + +public class SymbianSourceFileRemapping implements ISourceFileRemapping { + + public String remapSourceFile(IPath executable, String filePath) { + + try { + // handle the case where the common lookup finds the file in the workspace + Object[] foundElements = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector().findSourceElements(filePath); + if (foundElements.length == 1 && foundElements[0] instanceof IFile) { + IFile newLocation = (IFile) foundElements[0]; + return newLocation.getLocation().toOSString(); + } + } catch (CoreException e1) { + } + + String epocRoot = ""; + String[] segs = executable.segments(); + for (int i = 0; i < segs.length; i++) { + if (segs[i].equalsIgnoreCase("epoc32")) + epocRoot = executable.removeLastSegments(segs.length - i).toOSString(); + } + if (epocRoot.length() > 0) + { + SymbianSourceContainer symbianSourceContainer = new SymbianSourceContainer(new Path(epocRoot)); + try { + Object[] foundElements = symbianSourceContainer.findSourceElements(filePath); + if (foundElements.length == 1) + { + if (foundElements[0] instanceof LocalFileStorage) + { + LocalFileStorage newLocation = (LocalFileStorage) foundElements[0]; + filePath = newLocation.getFullPath().toOSString(); + } + else + if (foundElements[0] instanceof IResource) + { + IResource newResource = (IResource) foundElements[0]; + filePath = newResource.getLocation().toOSString(); + } + } + + } catch (CoreException e) {} + } + + return filePath; + } + +} diff -r 664feec309ff -r fc2867001a80 debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/SymbianSourceFileRemappingFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/debuggercdi/com.nokia.cdt.debug.common/src/com/nokia/cdt/debug/common/internal/executables/SymbianSourceFileRemappingFactory.java Fri Mar 12 12:26:03 2010 -0600 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +package com.nokia.cdt.debug.common.internal.executables; + +import org.eclipse.cdt.core.model.IBinary; +import org.eclipse.cdt.debug.core.executables.ISourceFileRemapping; +import org.eclipse.cdt.debug.core.executables.ISourceFileRemappingFactory; + +public class SymbianSourceFileRemappingFactory implements ISourceFileRemappingFactory { + + public ISourceFileRemapping createRemapper(IBinary binary) { + return new SymbianSourceFileRemapping(); + } + +} diff -r 664feec309ff -r fc2867001a80 debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF --- a/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Thu Mar 11 20:24:32 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/META-INF/MANIFEST.MF Fri Mar 12 12:26:03 2010 -0600 @@ -7,7 +7,6 @@ Bundle-Vendor: Nokia Bundle-Localization: plugin Require-Bundle: com.nokia.cdt.debug.common, - org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.cdt.launch, org.eclipse.cdt.debug.core, @@ -20,7 +19,6 @@ org.eclipse.ui.console, com.freescale.swt, org.eclipse.ui.forms, - com.nokia.carbide.cpp.support, org.eclipse.ui.ide, com.nokia.carbide.cpp.debug.kernelaware, com.nokia.carbide.cdt.builder, @@ -29,8 +27,7 @@ com.nokia.cpp.utils.core, com.freescale.cdt.debug.cw.core.ui, com.nokia.carbide.remoteConnections, - com.nokia.cpp.utils.ui, - com.nokia.carbide.cpp.edc;bundle-version="1.0.0" + com.nokia.cpp.utils.ui Bundle-ActivationPolicy: lazy Export-Package: com.nokia.cdt.internal.debug.launch, com.nokia.cdt.internal.debug.launch.ui, diff -r 664feec309ff -r fc2867001a80 debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.java --- a/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.java Thu Mar 11 20:24:32 2010 -0600 +++ b/debuggercdi/com.nokia.cdt.debug.launch/src/com/nokia/cdt/internal/debug/launch/AbstractSymbianLaunchShortcut.java Fri Mar 12 12:26:03 2010 -0600 @@ -20,7 +20,7 @@ import org.eclipse.ui.IFileEditorInput; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; -import com.nokia.carbide.cpp.edc.executables.SymbianSourceFileRemapping; +import com.nokia.cdt.debug.common.internal.executables.SymbianSourceFileRemapping; public abstract class AbstractSymbianLaunchShortcut implements ILaunchShortcut2 {