Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2010-01-12 14:41:31 +0000
committerMarc Khouzam2010-01-12 14:41:31 +0000
commit0226dc571ae36069cb93549fa64a64886def4be8 (patch)
tree6b10030ed8e729c2ff9950596835e3252d1eb0fe
parentd989982488a253a9bfc75ef80dfb5af48ce9681d (diff)
downloadorg.eclipse.cdt-0226dc571ae36069cb93549fa64a64886def4be8.tar.gz
org.eclipse.cdt-0226dc571ae36069cb93549fa64a64886def4be8.tar.xz
org.eclipse.cdt-0226dc571ae36069cb93549fa64a64886def4be8.zip
[299292] Added version support for Fedora and Red Hat, as well as unit tests for those
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java7
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java3
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchUtilsTest.java50
3 files changed, 57 insertions, 3 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
index e10fef993f4..f81d42b24e0 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/LaunchUtils.java
@@ -218,11 +218,14 @@ public class LaunchUtils {
// GNU gdb 6.8.50.20080730
// GNU gdb (GDB) 6.8.50.20080730-cvs
// GNU gdb (Ericsson GDB 1.0-10) 6.8.50.20080730-cvs
- Pattern pattern = Pattern.compile(" gdb( \\(.*?\\))? (\\d*(\\.\\d*)*)", Pattern.MULTILINE); //$NON-NLS-1$
+ // GNU gdb (GDB) Fedora (7.0-3.fc12)
+ // GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)
+
+ Pattern pattern = Pattern.compile(" gdb( \\(.*?\\))? (\\w* )*\\(?(\\d*(\\.\\d*)*)", Pattern.MULTILINE); //$NON-NLS-1$
Matcher matcher = pattern.matcher(versionOutput);
if (matcher.find()) {
- version = matcher.group(2);
+ version = matcher.group(3);
// Temporary for cygwin, until GDB 7 is released
// Any cygwin GDB staring with 6.8 should be treated as plain 6.8
if (versionOutput.toLowerCase().indexOf("cygwin") != -1 && //$NON-NLS-1$
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java
index 164813e364a..e96e51b7ea9 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Ericsson and others.
+ * Copyright (c) 2009, 2010 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,6 +24,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
+ LaunchUtilsTest.class,
MIRegistersTest.class,
MIRunControlTest.class,
MIExpressionsTest.class,
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchUtilsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchUtilsTest.java
new file mode 100644
index 00000000000..e0eccb2952c
--- /dev/null
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/LaunchUtilsTest.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Ericsson and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc-Andre Laperle - Added test for the gdb version string converter
+ *******************************************************************************/
+package org.eclipse.cdt.tests.dsf.gdb.tests;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class LaunchUtilsTest extends TestCase {
+
+ @Before
+ public void init() {
+ }
+
+ @After
+ public void shutdown() {
+ }
+
+ @Test
+ public void testGetGDBVersionFromText(){
+ Map<String, String> versions = new HashMap<String, String>(10);
+
+ versions.put("GNU gdb 6.8.50.20080730", "6.8.50.20080730");
+ versions.put("GNU gdb (GDB) 6.8.50.20080730-cvs", "6.8.50.20080730");
+ versions.put("GNU gdb (Ericsson GDB 1.0-10) 6.8.50.20080730-cvs", "6.8.50.20080730");
+ versions.put("GNU gdb (GDB) Fedora (7.0-3.fc12)", "7.0");
+ versions.put("GNU gdb 6.8.0.20080328-cvs (cygwin-special)", "6.8"); // Special for cygwin
+ versions.put("GNU gdb 7.0", "7.0");
+ versions.put("GNU gdb Fedora (6.8-27.el5)", "6.8");
+ versions.put("GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)", "6.3.0.0");
+
+ for (String key : versions.keySet()) {
+ assertEquals("From \"" + key + "\"", versions.get(key), LaunchUtils.getGDBVersionFromText(key));
+ }
+ }
+}

Back to the top