Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] CDT debug core update

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.48
diff -u -r1.48 ChangeLog
--- ChangeLog	7 Nov 2002 21:54:40 -0000	1.48
+++ ChangeLog	13 Nov 2002 13:57:35 -0000
@@ -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.
Index: schema/CDebugger.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/schema/CDebugger.exsd,v
retrieving revision 1.1
diff -u -r1.1 CDebugger.exsd
--- schema/CDebugger.exsd	18 Sep 2002 13:35:35 -0000	1.1
+++ schema/CDebugger.exsd	13 Nov 2002 13:57:35 -0000
@@ -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>

Index: src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java,v
retrieving revision 1.2
diff -u -r1.2 ICDebugConfiguration.java
--- src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java	28 Aug 2002 20:35:41 -0000	1.2
+++ src/org/eclipse/cdt/debug/core/ICDebugConfiguration.java	13 Nov 2002 13:57:35 -0000
@@ -7,9 +7,12 @@
 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);
 }
Index: src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java,v
retrieving revision 1.4
diff -u -r1.4 DebugConfiguration.java
--- src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java	23 Sep 2002 17:15:30 -0000	1.4
+++ src/org/eclipse/cdt/debug/internal/core/DebugConfiguration.java	13 Nov 2002 13:57:35 -0000
@@ -10,6 +10,7 @@

 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 @@
 	 */
 	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 @@
 		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"};
-		}
-		StringTokenizer stoken = new StringTokenizer(platform, ",");
-		String[] platforms = new String[stoken.countTokens()];
-		for( int i = 0; i < platforms.length; i++ ) {
-			platforms[i] = stoken.nextToken();
+		if (platform == null) {
+			return NATIVE;
 		}
-		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,17 +78,40 @@
 	 */
 	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());
 			}
 		}
 		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;
 	}

 }



Back to the top