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:
parent
0b999fef42
commit
2abb649ea3
4 changed files with 80 additions and 21 deletions
|
@ -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.
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -29,7 +32,7 @@ public class DebugConfiguration implements ICDebugConfiguration {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue