diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index f1b4432131d..b01a4bc85be 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -1,3 +1,9 @@
+2002-11-13
+ * schema/CDebugger.exsd
+ * src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
+ * src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
+ Added supported CPU to Debugger extension.
+
2002-11-07 Mikhail Khodjaiants
When a referenced project is deleted it's location is null. The source locator should
check this when it returns the path array.
diff --git a/debug/org.eclipse.cdt.debug.core/schema/CDebugger.exsd b/debug/org.eclipse.cdt.debug.core/schema/CDebugger.exsd
index 67ba1cec7ee..2b6865949f8 100644
--- a/debug/org.eclipse.cdt.debug.core/schema/CDebugger.exsd
+++ b/debug/org.eclipse.cdt.debug.core/schema/CDebugger.exsd
@@ -72,6 +72,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
index 03ee81ff06c..bb72c012256 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
@@ -7,9 +7,12 @@ package org.eclipse.cdt.debug.core;
import org.eclipse.core.runtime.CoreException;
public interface ICDebugConfiguration {
- public ICDebugger getDebugger() throws CoreException;
- public String getName();
- public String getID();
- public String[] getPlatforms();
- public boolean supportsMode(String mode);
+ ICDebugger getDebugger() throws CoreException;
+ String getName();
+ String getID();
+ String getPlatform();
+ String[] getCPUList();
+ String[] getModeList();
+ boolean supportsCPU(String cpu);
+ boolean supportsMode(String mode);
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
index 94f247f0732..a420c8f565b 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
@@ -10,6 +10,7 @@ import java.util.StringTokenizer;
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
import org.eclipse.cdt.debug.core.ICDebugger;
+import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -19,17 +20,19 @@ public class DebugConfiguration implements ICDebugConfiguration {
*/
private IConfigurationElement fElement;
private HashSet fModes;
+ private HashSet fCPUs;
+ public static final String NATIVE = "native";
public DebugConfiguration(IConfigurationElement element) {
fElement = element;
}
-
+
private IConfigurationElement getConfigurationElement() {
return fElement;
- }
-
+ }
+
public ICDebugger getDebugger() throws CoreException {
- return (ICDebugger)getConfigurationElement().createExecutableExtension("class");
+ return (ICDebugger) getConfigurationElement().createExecutableExtension("class");
}
public String getName() {
@@ -41,23 +44,33 @@ public class DebugConfiguration implements ICDebugConfiguration {
return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
}
- public String[] getPlatforms() {
+ public String getPlatform() {
String platform = getConfigurationElement().getAttribute("platform");
- if ( platform == null ) {
- return new String[] {"local"};
+ if (platform == null) {
+ return NATIVE;
}
- StringTokenizer stoken = new StringTokenizer(platform, ",");
- String[] platforms = new String[stoken.countTokens()];
- for( int i = 0; i < platforms.length; i++ ) {
- platforms[i] = stoken.nextToken();
- }
- return platforms;
+ return platform;
}
-
+
+ public String[] getCPUList() {
+ return (String[]) getCPUs().toArray(new String[0]);
+ }
+
+ public String[] getModeList() {
+ return (String[]) getModes().toArray(new String[0]);
+ }
+
public boolean supportsMode(String mode) {
return getModes().contains(mode);
}
+ public boolean supportsCPU(String cpu) {
+ String nativeCPU = BootLoader.getOSArch();
+ if ( nativeCPU.startsWith(cpu) ) {
+ cpu = NATIVE;
+ }
+ return getCPUs().contains(cpu);
+ }
/**
* Returns the set of modes specified in the configuration data.
*
@@ -65,11 +78,11 @@ public class DebugConfiguration implements ICDebugConfiguration {
*/
protected Set getModes() {
if (fModes == null) {
- String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
+ String modes = getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
if (modes == null) {
return new HashSet(0);
}
- StringTokenizer tokenizer= new StringTokenizer(modes, ","); //$NON-NLS-1$
+ StringTokenizer tokenizer = new StringTokenizer(modes, ","); //$NON-NLS-1$
fModes = new HashSet(tokenizer.countTokens());
while (tokenizer.hasMoreTokens()) {
fModes.add(tokenizer.nextToken().trim());
@@ -78,4 +91,27 @@ public class DebugConfiguration implements ICDebugConfiguration {
return fModes;
}
+ protected Set getCPUs() {
+ if (fCPUs == null) {
+ String cpus = getConfigurationElement().getAttribute("cpu"); //$NON-NLS-1$
+ if (cpus == null) {
+ fCPUs = new HashSet(1);
+ fCPUs.add(NATIVE);
+ }
+ else {
+ String nativeCPU = BootLoader.getOSArch();
+ StringTokenizer tokenizer = new StringTokenizer(cpus, ","); //$NON-NLS-1$
+ fCPUs = new HashSet(tokenizer.countTokens());
+ while (tokenizer.hasMoreTokens()) {
+ String cpu = tokenizer.nextToken().trim();
+ fCPUs.add(cpu);
+ if (nativeCPU.startsWith(cpu)) { // os arch be cpu{le/be}
+ fCPUs.add(NATIVE);
+ }
+ }
+ }
+ }
+ return fCPUs;
+ }
+
}