1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-05 15:25:49 +02:00

added supported cpu list to debugger extension

This commit is contained in:
David Inglis 2002-11-13 14:00:33 +00:00
parent 0b999fef42
commit 2abb649ea3
4 changed files with 80 additions and 21 deletions

View file

@ -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.

View file

@ -72,6 +72,20 @@
</documentation>
</annotation>
</attribute>
<attribute name="platform" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="cpu" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>

View file

@ -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);
}

View file

@ -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,6 +20,8 @@ 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;
@ -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"};
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 platform;
}
return platforms;
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.
*
@ -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;
}
}