diff --git a/debug/org.eclipse.cdt.debug.core/plugin.properties b/debug/org.eclipse.cdt.debug.core/plugin.properties index 2ba538b936f..43660fe2e79 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.properties +++ b/debug/org.eclipse.cdt.debug.core/plugin.properties @@ -1,2 +1,3 @@ -pluginName=CDT Debug Core Plug-in -providerName=Eclipse.org +pluginName=CDT Debug Core Plug-in +providerName=Eclipse.org +CDTDebugger.name=C/C++ Core Debugger Extension diff --git a/debug/org.eclipse.cdt.debug.core/plugin.xml b/debug/org.eclipse.cdt.debug.core/plugin.xml index 943a8628acf..4d330fafa17 100644 --- a/debug/org.eclipse.cdt.debug.core/plugin.xml +++ b/debug/org.eclipse.cdt.debug.core/plugin.xml @@ -1,19 +1,22 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java index e4646a388da..cb0eeef5e6f 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugCorePlugin.java @@ -6,6 +6,7 @@ package org.eclipse.cdt.debug.core; +import org.eclipse.cdt.debug.internal.core.CDebuggerManager; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPluginDescriptor; @@ -27,6 +28,8 @@ public class CDebugCorePlugin extends Plugin //The shared instance. private static CDebugCorePlugin plugin; + private CDebuggerManager debuggerManager; + /** * The constructor. */ @@ -104,4 +107,11 @@ public class CDebugCorePlugin extends Plugin { getDefault().getLog().log( status ); } + + public ICDebuggerManager getDebuggerManager() { + if ( debuggerManager == null ) { + debuggerManager = new CDebuggerManager(); + } + return debuggerManager; + } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java new file mode 100644 index 00000000000..8fa7326b8e2 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugger.java @@ -0,0 +1,16 @@ +/* + * (c) Copyright QNX Software System Ltd. 2002. + * All Rights Reserved. + */ +package org.eclipse.cdt.debug.core; + +import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDISession; +import org.eclipse.core.resources.IFile; +import org.eclipse.debug.core.ILaunchConfiguration; + +public interface ICDebugger { + public ICDISession createLaunchSession(ILaunchConfiguration config, IFile exe) throws CDIException ; + public ICDISession createAttachSession(ILaunchConfiguration config, IFile exe, int pid) throws CDIException; + public ICDISession createCoreSession(ILaunchConfiguration config, IFile exe, IFile corefile) throws CDIException; +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebuggerInfo.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebuggerInfo.java new file mode 100644 index 00000000000..3003e65dbaa --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebuggerInfo.java @@ -0,0 +1,10 @@ +/* + * (c) Copyright QNX Software System Ltd. 2002. + * All Rights Reserved. + */package org.eclipse.cdt.debug.core; + +public interface ICDebuggerInfo { + String getID(); + String getName(); + String[] getSupportedPlatforms(); +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebuggerManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebuggerManager.java new file mode 100644 index 00000000000..2367a6af7a3 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebuggerManager.java @@ -0,0 +1,10 @@ +/* + * (c) Copyright QNX Software System Ltd. 2002. + * All Rights Reserved. + */ +package org.eclipse.cdt.debug.core; + +public interface ICDebuggerManager { + public ICDebugger createDebugger(String id); + public ICDebuggerInfo[] queryDebuggers(String platform_id); +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebuggerManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebuggerManager.java new file mode 100644 index 00000000000..a2e5ccafbc3 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebuggerManager.java @@ -0,0 +1,88 @@ +/* + * (c) Copyright QNX Software System Ltd. 2002. + * All Rights Reserved. + */ +package org.eclipse.cdt.debug.internal.core; + +import java.util.ArrayList; +import java.util.StringTokenizer; + +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDebugger; +import org.eclipse.cdt.debug.core.ICDebuggerManager; +import org.eclipse.cdt.debug.core.ICDebuggerInfo; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; + +public class CDebuggerManager implements ICDebuggerManager { + + public CDebuggerManager() { + } + + public ICDebugger createDebugger(String id) { + ICDebugger debugger = null; + + IExtensionPoint extension = CDebugCorePlugin.getDefault().getDescriptor().getExtensionPoint("CDebugger"); + if (extension != null) { + IExtension[] extensions = extension.getExtensions(); + for(int i = 0; i < extensions.length; i++){ + if ( id.equals(extensions[i].getUniqueIdentifier()) ) { + IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); + try { + debugger = (ICDebugger)configElements[0].createExecutableExtension("class"); + } + catch (CoreException e) { + return null; + } + } + } + } + return debugger; + } + + public ICDebuggerInfo[] queryDebuggers(String platform_id) { + IExtensionPoint extension = CDebugCorePlugin.getDefault().getDescriptor().getExtensionPoint("CDebugger"); + if (extension != null) { + IExtension[] extensions = extension.getExtensions(); + CDebuggerInfo dinfo; + ArrayList dlist = new ArrayList(extensions.length); + for(int i = 0; i < extensions.length; i++){ + IConfigurationElement [] configElements = extensions[i].getConfigurationElements(); + String platform = configElements[0].getAttribute("platform"); + if ( platform == null || platform.equals("*") || platform.indexOf(platform_id) != -1 ) { + dlist.add(dinfo = new CDebuggerInfo()); + dinfo.name = extensions[i].getLabel(); + dinfo.id = extensions[i].getUniqueIdentifier(); + dinfo.platforms = platform; + } + } + return (ICDebuggerInfo[]) dlist.toArray(new ICDebuggerInfo[dlist.size()]); + } + return new ICDebuggerInfo[0]; + } + + class CDebuggerInfo implements ICDebuggerInfo { + String id; + String name; + String platforms; + + public String getID() { + return id; + } + + public String getName() { + return name; + } + + public String[] getSupportedPlatforms() { + StringTokenizer stoken = new StringTokenizer(platforms, ","); + String[] platforms = new String[stoken.countTokens()]; + for( int i = 0; i < platforms.length; i++ ) { + platforms[i] = stoken.nextToken(); + } + return platforms; + } + } +}