mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Bug 476432 - GDB version comparison fails for GDB 7.10
Change-Id: I51366e45deabda29a1a5b00166039bad14a146f8 Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
40ff5f2a66
commit
6272b4e523
7 changed files with 252 additions and 46 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010, 2014 Ericsson and others.
|
* Copyright (c) 2010, 2015 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -13,7 +13,9 @@ package org.eclipse.cdt.dsf.gdb.tests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
|
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
|
||||||
|
@ -23,6 +25,18 @@ import org.junit.Test;
|
||||||
|
|
||||||
public class LaunchUtilsTest {
|
public class LaunchUtilsTest {
|
||||||
|
|
||||||
|
private class Versions {
|
||||||
|
private String version1;
|
||||||
|
private String version2;
|
||||||
|
private int expectedResult;
|
||||||
|
|
||||||
|
public Versions(String v1, String v2, int result) {
|
||||||
|
version1 = v1;
|
||||||
|
version2 = v2;
|
||||||
|
expectedResult = result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void init() {
|
public void init() {
|
||||||
}
|
}
|
||||||
|
@ -32,8 +46,8 @@ public class LaunchUtilsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tesetGDBVersionFromText() {
|
public void testGDBVersionFromText() {
|
||||||
Map<String, String> versions = new HashMap<String, String>(10);
|
Map<String, String> versions = new HashMap<>(10);
|
||||||
|
|
||||||
versions.put("GNU gdb 6.8.50.20080730", "6.8.50.20080730");
|
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 (GDB) 6.8.50.20080730-cvs", "6.8.50.20080730");
|
||||||
|
@ -61,4 +75,118 @@ public class LaunchUtilsTest {
|
||||||
assertEquals("From \"" + key + "\"", versions.get(key), LaunchUtils.getGDBVersionFromText(key));
|
assertEquals("From \"" + key + "\"", versions.get(key), LaunchUtils.getGDBVersionFromText(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that GDB version comparison is done properly.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGDBVersionComparison() {
|
||||||
|
List<Versions> versions = new ArrayList<>(100);
|
||||||
|
|
||||||
|
versions.add(new Versions("7", "6", 1));
|
||||||
|
versions.add(new Versions("7", "6.1", 1));
|
||||||
|
versions.add(new Versions("7", "6.1.1", 1));
|
||||||
|
versions.add(new Versions("7", "7", 0));
|
||||||
|
versions.add(new Versions("7", "7.0", 0));
|
||||||
|
versions.add(new Versions("7", "7.0.0", 0));
|
||||||
|
versions.add(new Versions("7", "7.1", -1));
|
||||||
|
versions.add(new Versions("7", "7.1.1", -1));
|
||||||
|
versions.add(new Versions("7", "8", -1));
|
||||||
|
versions.add(new Versions("7", "8.0", -1));
|
||||||
|
versions.add(new Versions("7", "8.1", -1));
|
||||||
|
versions.add(new Versions("7", "8.1.1", -1));
|
||||||
|
versions.add(new Versions("7", "10", -1));
|
||||||
|
versions.add(new Versions("7", "10.0", -1));
|
||||||
|
versions.add(new Versions("7", "10.1", -1));
|
||||||
|
versions.add(new Versions("7", "10.1.1", -1));
|
||||||
|
versions.add(new Versions("7", "70", -1));
|
||||||
|
versions.add(new Versions("7", "70.1", -1));
|
||||||
|
versions.add(new Versions("7", "70.1.1", -1));
|
||||||
|
versions.add(new Versions("7", "72", -1));
|
||||||
|
versions.add(new Versions("7", "72.1", -1));
|
||||||
|
versions.add(new Versions("7", "72.1.1", -1));
|
||||||
|
|
||||||
|
versions.add(new Versions("7.3", "6", 1));
|
||||||
|
versions.add(new Versions("7.3", "6.4", 1));
|
||||||
|
versions.add(new Versions("7.3", "6.4.4", 1));
|
||||||
|
versions.add(new Versions("7.3", "7", 1));
|
||||||
|
versions.add(new Versions("7.3", "7.0", 1));
|
||||||
|
versions.add(new Versions("7.3", "7.3", 0));
|
||||||
|
versions.add(new Versions("7.3", "7.3.0", 0));
|
||||||
|
versions.add(new Versions("7.0", "7.0", 0));
|
||||||
|
versions.add(new Versions("7.3", "7.3.3", -1));
|
||||||
|
versions.add(new Versions("7.3", "7.30", -1));
|
||||||
|
versions.add(new Versions("7.3", "7.30.3", -1));
|
||||||
|
versions.add(new Versions("7.3", "8", -1));
|
||||||
|
versions.add(new Versions("7.3", "8.0", -1));
|
||||||
|
versions.add(new Versions("7.3", "8.1", -1));
|
||||||
|
versions.add(new Versions("7.3", "8.1.1", -1));
|
||||||
|
versions.add(new Versions("7.3", "8.4", -1));
|
||||||
|
versions.add(new Versions("7.3", "8.4.4", -1));
|
||||||
|
versions.add(new Versions("7.3", "10", -1));
|
||||||
|
versions.add(new Versions("7.3", "10.0", -1));
|
||||||
|
versions.add(new Versions("7.3", "10.1", -1));
|
||||||
|
versions.add(new Versions("7.3", "10.1.1", -1));
|
||||||
|
versions.add(new Versions("7.3", "10.4", -1));
|
||||||
|
versions.add(new Versions("7.3", "10.4.4", -1));
|
||||||
|
versions.add(new Versions("7.3", "70", -1));
|
||||||
|
versions.add(new Versions("7.3", "70.1", -1));
|
||||||
|
versions.add(new Versions("7.3", "70.1.1", -1));
|
||||||
|
versions.add(new Versions("7.3", "72", -1));
|
||||||
|
versions.add(new Versions("7.3", "72.1", -1));
|
||||||
|
versions.add(new Versions("7.3", "72.1.1", -1));
|
||||||
|
|
||||||
|
versions.add(new Versions("7.5.4", "6", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "6.4", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "6.4.4", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "6.5", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "6.5.4", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "7", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.0", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.3", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.3.0", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.5", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.5.3", 1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.5.4", 0));
|
||||||
|
versions.add(new Versions("7.0.0", "7.0.0", 0));
|
||||||
|
versions.add(new Versions("7.5.4", "7.7", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.7.6", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.50", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.50.3", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.50.4", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "8", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "8.0", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "8.1", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "8.1.1", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "8.5", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "8.5.4", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "10", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "10.0", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "10.1", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "10.1.1", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "10.5", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "10.5.4", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "10.7.4", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.10", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.10.1", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "7.10.5", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "72", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "72.1", -1));
|
||||||
|
versions.add(new Versions("7.5.4", "72.1.1", -1));
|
||||||
|
|
||||||
|
versions.add(new Versions("6.8.51", "6.8.50.20080730", 1));
|
||||||
|
versions.add(new Versions("6.9.4", "6.8.50.20080730", 1));
|
||||||
|
versions.add(new Versions("6.8.50.20080730", "6.8.50.20080730", 0));
|
||||||
|
versions.add(new Versions("6.5.4", "6.8.50.20080730", -1));
|
||||||
|
versions.add(new Versions("6.8.50", "6.8.50.20080730", -1));
|
||||||
|
|
||||||
|
for (Versions v : versions) {
|
||||||
|
assertEquals("Comparing " + v.version1 + " and " + v.version2,
|
||||||
|
v.expectedResult,
|
||||||
|
LaunchUtils.compareVersions(v.version1, v.version2));
|
||||||
|
assertEquals("Comparing " + v.version2 + " and " + v.version1,
|
||||||
|
-v.expectedResult,
|
||||||
|
LaunchUtils.compareVersions(v.version2, v.version1));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,6 +363,70 @@ public class LaunchUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two version numbers.
|
||||||
|
* Returns -1, 0, or 1 if v1 is less than, equal to, or greater than v2, respectively.
|
||||||
|
* @param v1 The first version
|
||||||
|
* @param v2 The second version
|
||||||
|
* @return -1, 0, or 1 if v1 is less than, equal to, or greater than v2, respectively.
|
||||||
|
* @since 4.8
|
||||||
|
*/
|
||||||
|
public static int compareVersions(String v1, String v2) {
|
||||||
|
if (v1 == null || v2 == null) throw new NullPointerException();
|
||||||
|
|
||||||
|
String[] v1Parts = v1.split("\\."); //$NON-NLS-1$
|
||||||
|
String[] v2Parts = v2.split("\\."); //$NON-NLS-1$
|
||||||
|
for (int i = 0; i < v1Parts.length && i < v2Parts.length; i++) {
|
||||||
|
try {
|
||||||
|
int v1PartValue = Integer.parseInt(v1Parts[i]);
|
||||||
|
int v2PartValue = Integer.parseInt(v2Parts[i]);
|
||||||
|
|
||||||
|
if (v1PartValue > v2PartValue) {
|
||||||
|
return 1;
|
||||||
|
} else if (v1PartValue < v2PartValue) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Non-integer part, ignore it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we get here is means the versions are still equal
|
||||||
|
// but there could be extra parts to examine
|
||||||
|
|
||||||
|
if (v1Parts.length < v2Parts.length) {
|
||||||
|
// v2 has extra parts, which implies v1 is a lower version (e.g., v1 = 7.9 v2 = 7.9.1)
|
||||||
|
// unless each extra part is 0, in which case the two versions are equal (e.g., v1 = 7.9 v2 = 7.9.0)
|
||||||
|
for (int i = v1Parts.length; i < v2Parts.length; i++) {
|
||||||
|
try {
|
||||||
|
if (Integer.parseInt(v2Parts[i]) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Non-integer part, ignore it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v1Parts.length > v2Parts.length) {
|
||||||
|
// v1 has extra parts, which implies v1 is a higher version (e.g., v1 = 7.9.1 v2 = 7.9)
|
||||||
|
// unless each extra part is 0, in which case the two versions are equal (e.g., v1 = 7.9.0 v2 = 7.9)
|
||||||
|
for (int i = v2Parts.length; i < v1Parts.length; i++) {
|
||||||
|
try {
|
||||||
|
if (Integer.parseInt(v1Parts[i]) != 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Non-integer part, ignore it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read from the specified stream and return what was read.
|
* Read from the specified stream and return what was read.
|
||||||
*
|
*
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.eclipse.cdt.dsf.debug.service.IStack;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
|
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
|
||||||
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
|
||||||
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
|
||||||
|
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.CommandFactory_6_8;
|
import org.eclipse.cdt.dsf.gdb.service.command.CommandFactory_6_8;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl;
|
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl;
|
||||||
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_0;
|
import org.eclipse.cdt.dsf.gdb.service.command.GDBControl_7_0;
|
||||||
|
@ -136,10 +137,10 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MIBreakpointsManager createBreakpointManagerService(DsfSession session) {
|
protected MIBreakpointsManager createBreakpointManagerService(DsfSession session) {
|
||||||
if (GDB_7_2_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||||
return new GDBBreakpointsManager_7_2(session, CDebugCorePlugin.PLUGIN_ID);
|
return new GDBBreakpointsManager_7_2(session, CDebugCorePlugin.PLUGIN_ID);
|
||||||
}
|
}
|
||||||
if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBBreakpointsManager_7_0(session, CDebugCorePlugin.PLUGIN_ID);
|
return new GDBBreakpointsManager_7_0(session, CDebugCorePlugin.PLUGIN_ID);
|
||||||
}
|
}
|
||||||
return new MIBreakpointsManager(session, CDebugCorePlugin.PLUGIN_ID);
|
return new MIBreakpointsManager(session, CDebugCorePlugin.PLUGIN_ID);
|
||||||
|
@ -147,40 +148,40 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IBreakpoints createBreakpointService(DsfSession session) {
|
protected IBreakpoints createBreakpointService(DsfSession session) {
|
||||||
if (GDB_7_7_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_7_VERSION) >= 0) {
|
||||||
return new GDBBreakpoints_7_7(session);
|
return new GDBBreakpoints_7_7(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_6_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_6_VERSION) >= 0) {
|
||||||
return new GDBBreakpoints_7_6(session);
|
return new GDBBreakpoints_7_6(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_4_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
|
||||||
return new GDBBreakpoints_7_4(session);
|
return new GDBBreakpoints_7_4(session);
|
||||||
}
|
}
|
||||||
// This service is available for GDB 7.2 but there is a pre-release of GDB that
|
// This service is available for GDB 7.2 but there is a pre-release of GDB that
|
||||||
// supports the same features and has version of 6.8.50.20090414
|
// supports the same features and has version of 6.8.50.20090414
|
||||||
if (GDB_7_2_VERSION.compareTo(fVersion) <= 0 || "6.8.50.20090414".equals(fVersion)) { //$NON-NLS-1$
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0 || "6.8.50.20090414".equals(fVersion)) { //$NON-NLS-1$
|
||||||
return new GDBBreakpoints_7_2(session);
|
return new GDBBreakpoints_7_2(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBBreakpoints_7_0(session);
|
return new GDBBreakpoints_7_0(session);
|
||||||
}
|
}
|
||||||
return new MIBreakpoints(session);
|
return new MIBreakpoints(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
||||||
if (GDB_7_7_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_7_VERSION) >= 0) {
|
||||||
return new GDBControl_7_7(session, config, new CommandFactory_6_8());
|
return new GDBControl_7_7(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_4_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
|
||||||
return new GDBControl_7_4(session, config, new CommandFactory_6_8());
|
return new GDBControl_7_4(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_2_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||||
return new GDBControl_7_2(session, config, new CommandFactory_6_8());
|
return new GDBControl_7_2(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBControl_7_0(session, config, new CommandFactory_6_8());
|
return new GDBControl_7_0(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_6_8_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_6_8_VERSION) >= 0) {
|
||||||
return new GDBControl(session, config, new CommandFactory_6_8());
|
return new GDBControl(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
return new GDBControl(session, config, new CommandFactory());
|
return new GDBControl(session, config, new CommandFactory());
|
||||||
|
@ -192,7 +193,7 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IDisassembly createDisassemblyService(DsfSession session) {
|
protected IDisassembly createDisassemblyService(DsfSession session) {
|
||||||
if (GDB_7_3_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_3_VERSION) >= 0) {
|
||||||
return new GDBDisassembly_7_3(session);
|
return new GDBDisassembly_7_3(session);
|
||||||
}
|
}
|
||||||
return new MIDisassembly(session);
|
return new MIDisassembly(session);
|
||||||
|
@ -210,11 +211,11 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IMemory createMemoryService(DsfSession session) {
|
protected IMemory createMemoryService(DsfSession session) {
|
||||||
if (GDB_7_6_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_6_VERSION) >= 0) {
|
||||||
return new GDBMemory_7_6(session);
|
return new GDBMemory_7_6(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBMemory_7_0(session);
|
return new GDBMemory_7_0(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,22 +229,22 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProcesses createProcessesService(DsfSession session) {
|
protected IProcesses createProcessesService(DsfSession session) {
|
||||||
if (GDB_7_4_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
|
||||||
return new GDBProcesses_7_4(session);
|
return new GDBProcesses_7_4(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_3_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_3_VERSION) >= 0) {
|
||||||
return new GDBProcesses_7_3(session);
|
return new GDBProcesses_7_3(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_2_1_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_2_1_VERSION) >= 0) {
|
||||||
return new GDBProcesses_7_2_1(session);
|
return new GDBProcesses_7_2_1(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_2_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||||
return new GDBProcesses_7_2(session);
|
return new GDBProcesses_7_2(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_1_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_1_VERSION) >= 0) {
|
||||||
return new GDBProcesses_7_1(session);
|
return new GDBProcesses_7_1(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBProcesses_7_0(session);
|
return new GDBProcesses_7_0(session);
|
||||||
}
|
}
|
||||||
return new GDBProcesses(session);
|
return new GDBProcesses(session);
|
||||||
|
@ -256,10 +257,10 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IRunControl createRunControlService(DsfSession session) {
|
protected IRunControl createRunControlService(DsfSession session) {
|
||||||
if (GDB_7_6_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_6_VERSION) >= 0) {
|
||||||
return new GDBRunControl_7_6(session);
|
return new GDBRunControl_7_6(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_0_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBRunControl_7_0(session);
|
return new GDBRunControl_7_0(session);
|
||||||
}
|
}
|
||||||
return new GDBRunControl(session);
|
return new GDBRunControl(session);
|
||||||
|
@ -277,12 +278,12 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
/** @since 3.0 */
|
/** @since 3.0 */
|
||||||
protected IGDBTraceControl createTraceControlService(DsfSession session, ILaunchConfiguration config) {
|
protected IGDBTraceControl createTraceControlService(DsfSession session, ILaunchConfiguration config) {
|
||||||
if (GDB_7_4_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
|
||||||
return new GDBTraceControl_7_4(session, config);
|
return new GDBTraceControl_7_4(session, config);
|
||||||
}
|
}
|
||||||
// This service is available for GDB 7.2 but there is a pre-release of GDB that
|
// This service is available for GDB 7.2 but there is a pre-release of GDB that
|
||||||
// supports the same features and has version of 6.8.50.20090414
|
// supports the same features and has version of 6.8.50.20090414
|
||||||
if (GDB_7_2_VERSION.compareTo(fVersion) <= 0 || "6.8.50.20090414".equals(fVersion)) { //$NON-NLS-1$
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0 || "6.8.50.20090414".equals(fVersion)) { //$NON-NLS-1$
|
||||||
return new GDBTraceControl_7_2(session, config);
|
return new GDBTraceControl_7_2(session, config);
|
||||||
}
|
}
|
||||||
// There is currently no implementation of the TraceControl service before GDB 7.2
|
// There is currently no implementation of the TraceControl service before GDB 7.2
|
||||||
|
@ -294,10 +295,10 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
|
|
||||||
/** @since 4.1 */
|
/** @since 4.1 */
|
||||||
protected IGDBHardwareAndOS createHardwareAndOSService(DsfSession session, ILaunchConfiguration config) {
|
protected IGDBHardwareAndOS createHardwareAndOSService(DsfSession session, ILaunchConfiguration config) {
|
||||||
if (GDB_7_10_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_10_VERSION) >= 0) {
|
||||||
return new GDBHardwareAndOS_7_10(session);
|
return new GDBHardwareAndOS_7_10(session);
|
||||||
}
|
}
|
||||||
if (GDB_7_5_VERSION.compareTo(fVersion) <= 0) {
|
if (compareVersionWith(GDB_7_5_VERSION) >= 0) {
|
||||||
return new GDBHardwareAndOS_7_5(session);
|
return new GDBHardwareAndOS_7_5(session);
|
||||||
}
|
}
|
||||||
return new GDBHardwareAndOS(session);
|
return new GDBHardwareAndOS(session);
|
||||||
|
@ -310,6 +311,19 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
return new MIBreakpointsSynchronizer(session);
|
return new MIBreakpointsSynchronizer(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the GDB version of the current debug session with the one specified by
|
||||||
|
* parameter 'version'. Returns -1, 0, or 1 if the current version is less than,
|
||||||
|
* equal to, or greater than the specified version, respectively.
|
||||||
|
* @param version The version to compare with
|
||||||
|
* @return -1, 0, or 1 if the current version is less than, equal to, or greater than
|
||||||
|
* the specified version, respectively.
|
||||||
|
* @since 4.8
|
||||||
|
*/
|
||||||
|
public int compareVersionWith(String version) {
|
||||||
|
return LaunchUtils.compareVersions(getVersion(), version);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A static method that will compare the version of GDB for the specified session and
|
* A static method that will compare the version of GDB for the specified session and
|
||||||
* the minimum GDB version required by the caller. A warning will be logged if the
|
* the minimum GDB version required by the caller. A warning will be logged if the
|
||||||
|
@ -327,7 +341,7 @@ public class GdbDebugServicesFactory extends AbstractDsfDebugServicesFactory {
|
||||||
IDsfDebugServicesFactory servicesFactory = ((GdbLaunch)launch).getServiceFactory();
|
IDsfDebugServicesFactory servicesFactory = ((GdbLaunch)launch).getServiceFactory();
|
||||||
if (servicesFactory instanceof GdbDebugServicesFactory) {
|
if (servicesFactory instanceof GdbDebugServicesFactory) {
|
||||||
String version = ((GdbDebugServicesFactory)servicesFactory).getVersion();
|
String version = ((GdbDebugServicesFactory)servicesFactory).getVersion();
|
||||||
if (minVersion.compareTo(version) > 0) {
|
if (LaunchUtils.compareVersions(minVersion, version) > 0) {
|
||||||
assert false;
|
assert false;
|
||||||
|
|
||||||
GdbPlugin.log(
|
GdbPlugin.log(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2011 Ericsson and others.
|
* Copyright (c) 2008, 2015 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -26,7 +26,7 @@ public class GdbDebugServicesFactoryNS extends GdbDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IRunControl createRunControlService(DsfSession session) {
|
protected IRunControl createRunControlService(DsfSession session) {
|
||||||
if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||||
return new GDBRunControl_7_2_NS(session);
|
return new GDBRunControl_7_2_NS(session);
|
||||||
}
|
}
|
||||||
return new GDBRunControl_7_0_NS(session);
|
return new GDBRunControl_7_0_NS(session);
|
||||||
|
|
|
@ -38,19 +38,19 @@ public class GdbExtendedDebugServicesFactory extends GdbDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
||||||
if (GDB_7_7_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_7_VERSION) >= 0) {
|
||||||
return new GDBExtendedControl(session, config, new GdbExtendedCommandFactory_6_8());
|
return new GDBExtendedControl(session, config, new GdbExtendedCommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_4_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
|
||||||
return new GDBControl_7_4(session, config, new GdbExtendedCommandFactory_6_8());
|
return new GDBControl_7_4(session, config, new GdbExtendedCommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||||
return new GDBControl_7_2(session, config, new GdbExtendedCommandFactory_6_8());
|
return new GDBControl_7_2(session, config, new GdbExtendedCommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_0_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBControl_7_0(session, config, new GdbExtendedCommandFactory_6_8());
|
return new GDBControl_7_0(session, config, new GdbExtendedCommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_6_8_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_6_8_VERSION) >= 0) {
|
||||||
return new GDBControl(session, config, new GdbExtendedCommandFactory_6_8());
|
return new GDBControl(session, config, new GdbExtendedCommandFactory_6_8());
|
||||||
}
|
}
|
||||||
return new GDBControl(session, config, new CommandFactory());
|
return new GDBControl(session, config, new CommandFactory());
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2014 Ericsson and others.
|
* Copyright (c) 2014, 2015 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -23,7 +23,7 @@ public class GdbExtendedDebugServicesFactoryNS extends GdbExtendedDebugServicesF
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IRunControl createRunControlService(DsfSession session) {
|
protected IRunControl createRunControlService(DsfSession session) {
|
||||||
if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||||
return new GDBRunControl_7_2_NS(session);
|
return new GDBRunControl_7_2_NS(session);
|
||||||
}
|
}
|
||||||
return new GDBRunControl_7_0_NS(session);
|
return new GDBRunControl_7_0_NS(session);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011,2014 Ericsson and others.
|
* Copyright (c) 2011,2015 Ericsson and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -30,19 +30,19 @@ public class GdbJtagDebugServicesFactory extends GdbDebugServicesFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
protected ICommandControl createCommandControl(DsfSession session, ILaunchConfiguration config) {
|
||||||
if (GDB_7_7_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_7_VERSION) >= 0) {
|
||||||
return new GDBJtagControl_7_7(session, config, new CommandFactory_6_8());
|
return new GDBJtagControl_7_7(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_4_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_4_VERSION) >= 0) {
|
||||||
return new GDBJtagControl_7_4(session, config, new CommandFactory_6_8());
|
return new GDBJtagControl_7_4(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_2_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_2_VERSION) >= 0) {
|
||||||
return new GDBJtagControl_7_2(session, config, new CommandFactory_6_8());
|
return new GDBJtagControl_7_2(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_7_0_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_7_0_VERSION) >= 0) {
|
||||||
return new GDBJtagControl_7_0(session, config, new CommandFactory_6_8());
|
return new GDBJtagControl_7_0(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
if (GDB_6_8_VERSION.compareTo(getVersion()) <= 0) {
|
if (compareVersionWith(GDB_6_8_VERSION) >= 0) {
|
||||||
return new GDBJtagControl(session, config, new CommandFactory_6_8());
|
return new GDBJtagControl(session, config, new CommandFactory_6_8());
|
||||||
}
|
}
|
||||||
return new GDBJtagControl(session, config, new CommandFactory());
|
return new GDBJtagControl(session, config, new CommandFactory());
|
||||||
|
|
Loading…
Add table
Reference in a new issue