diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties
index 5d3e3b9ad20..90d7029058c 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/build.properties
@@ -9,9 +9,10 @@
# Wind River Systems - initial API and implementation
# IBM Corporation
###############################################################################
-output.tests.jar = bin/
bin.includes = fragment.xml,\
META-INF/,\
- .
+ .,\
+ data/,\
+ about.html
source.. = src/
src.includes = about.html
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile
index 3ac4e9a2ff9..e67f6e886e9 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile
@@ -1,6 +1,6 @@
src = $(wildcard *.cc *.c)
destDir = ../bin
-GCCFLAGS = -gdwarf-2 -pthread -m32
+GCCFLAGS = -gdwarf-2 -pthread
all:
@mkdir -p $(destDir)
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc
index e4d390d5a14..db0bd9ff5d1 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThread.cc
@@ -21,8 +21,8 @@ unsigned int __stdcall PrintHello(void *threadid)
void *PrintHello(void *threadid)
#endif
{
- int tid = (int)threadid;
- printf("Hello World! It's me, thread #%d!\n", tid);
+ long tid = (long)threadid;
+ printf("Hello World! It's me, thread #%ld!\n", tid);
SLEEP(2); // keep this thread around for a bit; the tests will check for its existence while the main thread is stopped at a breakpoint
#ifdef __MINGW32__
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc
index f30714744ea..4556b07b6dd 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/MultiThreadRunControl.cc
@@ -14,9 +14,9 @@ typedef pthread_t TID;
#endif
// Set a breakpoint here so that both threads stop.
-void firstBreakpoint(int id)
+void firstBreakpoint(long id)
{
- printf("First breakpoint method from thread %d\n", id);
+ printf("First breakpoint method from thread %ld\n", id);
}
@@ -26,7 +26,7 @@ unsigned int __stdcall PrintHello(void *threadid)
void *PrintHello(void *threadId)
#endif
{
- int tId = (int)threadId;
+ long tId = (long)threadId;
firstBreakpoint(tId); // Stop a first time
SLEEP(1); // Keep state running a little
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc
index 5bfe8649f95..ae8acdff923 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc
@@ -73,8 +73,8 @@ unsigned int __stdcall testTracepoints(void *threadid)
void *testTracepoints(void *threadid)
#endif
{
- int tid = (int)threadid;
- printf("Hello World! It's me, thread #%d!\n", tid);
+ long tid = (long)threadid;
+ printf("Hello World! It's me, thread #%ld!\n", tid);
int lIntVar = 12345;
double lDoubleVar = 12345.12345;
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml
index 5423cfb4202..9b9554e9b4e 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/pom.xml
@@ -24,15 +24,53 @@
-->
+
+
+ production
+
+ -Dcdt.tests.dsf.gdb.path=/opt/public/download-staging.priv/tools/cdt/gdb
+
+
+
+
+
+ maven-antrun-plugin
+
+
+ clean
+ clean
+
+
+
+
+
+
+ run
+
+
+
+ prepare
+ validate
+
+
+
+
+
+
+ run
+
+
+
+
org.eclipse.tycho
tycho-surefire-plugin
${tycho-version}
true
- -Xms256m -Xmx512m -XX:MaxPermSize=256M
+ -Xms256m -Xmx512m -XX:MaxPermSize=256M ${gdbPathOption}
**/AutomatedSuite.*
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
index 8ba587e339c..9d0bffb8ccf 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
@@ -21,6 +21,8 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
+import org.eclipse.cdt.dsf.gdb.internal.GdbDebugOptions;
+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent;
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
@@ -218,10 +220,10 @@ public class BaseTestCase {
protected void doLaunch() throws Exception {
boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
- System.out.println("====================================================================================================");
- System.out.println(String.format("Running test: %s using GDB: %s remote %s",
- testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "on" : "off"));
- System.out.println("====================================================================================================");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
+ System.out.println(String.format("%s \"%s\" launching %s %s",
+ GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "with gdbserver" : ""));
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
@@ -320,7 +322,7 @@ public class BaseTestCase {
BufferedReader reader = new BufferedReader(r);
String line;
while ((line = reader.readLine()) != null) {
- System.out.println(line);
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(line + "\n");
line = line.trim();
if (line.startsWith("Listening on port")) {
break;
@@ -351,8 +353,15 @@ public class BaseTestCase {
public static void setGdbProgramNamesLaunchAttributes(String version) {
// See bugzilla 303811 for why we have to append ".exe" on Windows
boolean isWindows = Platform.getOS().equals(Platform.OS_WIN32);
- setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb." + version + (isWindows ? ".exe" : ""));
- setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, "gdbserver." + version + (isWindows ? ".exe" : ""));
+ String gdbPath = System.getProperty("cdt.tests.dsf.gdb.path");
+ String debugName = "gdb." + version + (isWindows ? ".exe" : "");
+ String debugServerName = "gdbserver." + version + (isWindows ? ".exe" : "");
+ if (gdbPath != null) {
+ debugName = gdbPath + "/" + debugName;
+ debugServerName = gdbPath + "/" + debugServerName;
+ }
+ setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, debugName);
+ setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, debugServerName);
}
protected void setGdbVersion() {
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java
index b1dd875c211..64f7246de54 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AutomatedSuite.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
-import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4.Suite_7_4;
+import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_5.Suite_7_5;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -21,7 +21,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
- Suite_7_4.class,
+ Suite_7_5.class,
// Can't run the Remote test just yet because they
// have the same names on the local tests, which is
// not handled by JUnit (https://bugs.eclipse.org/172256)
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
index 37dee117646..08fd209f524 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java
@@ -37,7 +37,8 @@ import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContex
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
-import org.eclipse.cdt.dsf.internal.DsfPlugin;
+import org.eclipse.cdt.dsf.gdb.internal.GdbDebugOptions;
+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
@@ -240,7 +241,7 @@ public class MIBreakpointsTest extends BaseTestCase {
@DsfServiceEventHandler
public void eventDispatched(IBreakpointsAddedEvent e) {
synchronized (lock) {
- System.out.println(DsfPlugin.getDebugTime() + " Got bp added event");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event\n");
fBreakpointEvents[BP_ADDED]++;
fBreakpointEventCount++;
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
@@ -251,7 +252,7 @@ public class MIBreakpointsTest extends BaseTestCase {
@DsfServiceEventHandler
public void eventDispatched(IBreakpointsUpdatedEvent e) {
synchronized (lock) {
- System.out.println(DsfPlugin.getDebugTime() + " Got bp updated event");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event\n");
fBreakpointEvents[BP_UPDATED]++;
fBreakpointEventCount++;
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
@@ -262,7 +263,7 @@ public class MIBreakpointsTest extends BaseTestCase {
@DsfServiceEventHandler
public void eventDispatched(IBreakpointsRemovedEvent e) {
synchronized (lock) {
- System.out.println(DsfPlugin.getDebugTime() + " Got bp removed event");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event\n");
fBreakpointEvents[BP_REMOVED]++;
fBreakpointEventCount++;
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
@@ -273,7 +274,7 @@ public class MIBreakpointsTest extends BaseTestCase {
@DsfServiceEventHandler
public void eventDispatched(MIBreakpointHitEvent e) {
synchronized (lock) {
- System.out.println(DsfPlugin.getDebugTime() + " Got bp hit event");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event\n");
fBreakpointEvents[BP_HIT]++;
fBreakpointEventCount++;
fBreakpointRef = e.getNumber();
@@ -284,7 +285,7 @@ public class MIBreakpointsTest extends BaseTestCase {
@DsfServiceEventHandler
public void eventDispatched(MIWatchpointTriggerEvent e) {
synchronized (lock) {
- System.out.println(DsfPlugin.getDebugTime() + " Got wp hit event");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp hit event\n");
fBreakpointEvents[WP_HIT]++;
fBreakpointEventCount++;
fBreakpointRef = e.getNumber();
@@ -295,7 +296,7 @@ public class MIBreakpointsTest extends BaseTestCase {
@DsfServiceEventHandler
public void eventDispatched(MIWatchpointScopeEvent e) {
synchronized (lock) {
- System.out.println(DsfPlugin.getDebugTime() + " Got wp scope event");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got wp scope event\n");
fBreakpointEvents[WP_OOS]++;
fBreakpointEventCount++;
fBreakpointRef = e.getNumber();
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
index b205d223238..f3e548d4440 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MICatchpointsTest.java
@@ -43,7 +43,8 @@ import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContex
import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
-import org.eclipse.cdt.dsf.internal.DsfPlugin;
+import org.eclipse.cdt.dsf.gdb.internal.GdbDebugOptions;
+import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointDMData;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
@@ -225,7 +226,7 @@ public class MICatchpointsTest extends BaseTestCase {
synchronized (fEventHandlerLock) {
fBreakpointEvents[BP_ADDED]++;
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
- System.out.println(DsfPlugin.getDebugTime() + " Got bp added event (#" + fBreakpointRef + ")");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp added event (#" + fBreakpointRef + ")\n");
fEventHandlerLock.notifyAll();
}
}
@@ -235,7 +236,7 @@ public class MICatchpointsTest extends BaseTestCase {
synchronized (fEventHandlerLock) {
fBreakpointEvents[BP_UPDATED]++;
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
- System.out.println(DsfPlugin.getDebugTime() + " Got bp updated event (#" + fBreakpointRef + ")");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp updated event (#" + fBreakpointRef + ")\n");
fEventHandlerLock.notifyAll();
}
}
@@ -245,7 +246,7 @@ public class MICatchpointsTest extends BaseTestCase {
synchronized (fEventHandlerLock) {
fBreakpointEvents[BP_REMOVED]++;
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
- System.out.println(DsfPlugin.getDebugTime() + " Got bp removed event (#" + fBreakpointRef + ")");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp removed event (#" + fBreakpointRef + ")\n");
fEventHandlerLock.notifyAll();
}
}
@@ -255,7 +256,7 @@ public class MICatchpointsTest extends BaseTestCase {
synchronized (fEventHandlerLock) {
fBreakpointEvents[BP_HIT]++;
fBreakpointRef = e.getNumber();
- System.out.println(DsfPlugin.getDebugTime() + " Got bp hit event (#" + fBreakpointRef + ")");
+ if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(GdbPlugin.getDebugTime() + " Got bp hit event (#" + fBreakpointRef + ")\n");
fEventHandlerLock.notifyAll();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
index bffe6680735..770c169db83 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIRegistersTest.java
@@ -14,7 +14,6 @@ package org.eclipse.cdt.tests.dsf.gdb.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -43,10 +42,12 @@ import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.cdt.dsf.debug.service.IRunControl.StepType;
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
+import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
+import org.eclipse.cdt.dsf.mi.service.command.output.MIDataListRegisterNamesInfo;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor;
@@ -54,7 +55,6 @@ import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
-import org.eclipse.core.runtime.Platform;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
@@ -62,18 +62,40 @@ import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
public class MIRegistersTest extends BaseTestCase {
+ // Static list of register names as obtained directly from GDB.
+ // We make it static it does not get re-set for every test
+ protected static List fRegisterNames = null;
- protected List get_X86_REGS() {
- List list = new LinkedList(Arrays.asList("eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags",
- "cs","ss","ds","es","fs","gs","st0","st1","st2","st3",
- "st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg",
- "fooff","fop","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7",
- "mxcsr","orig_eax","mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7"));
- // On Windows, gdb doesn't report "orig_eax" as a register. Apparently it does on Linux
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- list.remove("orig_eax");
- }
- return list;
+ protected List get_X86_REGS() throws Throwable {
+ if (fRegisterNames == null) {
+ // The tests must run on different machines, so the set of registers can change.
+ // To deal with this we ask GDB for the list of registers.
+ // Note that we send an MI Command in this code and do not use the IRegister service;
+ // this is because we want to test the service later, comparing it to what we find
+ // by asking GDB directly.
+ Query query = new Query() {
+ @Override
+ protected void execute(DataRequestMonitor rm) {
+ IMICommandControl controlService = fServicesTracker.getService(IMICommandControl.class);
+ controlService.queueCommand(
+ controlService.getCommandFactory().createMIDataListRegisterNames(fContainerDmc), rm);
+ }
+ };
+ fSession.getExecutor().execute(query);
+
+ MIDataListRegisterNamesInfo data = query.get();
+ String[] names = data.getRegisterNames();
+
+ // Remove registers with empty names since the service also
+ // remove them. I don't know why GDB returns such empty names.
+ fRegisterNames = new LinkedList();
+ for (String name : names) {
+ if (!name.isEmpty()) {
+ fRegisterNames.add(name);
+ }
+ }
+ }
+ return fRegisterNames;
}
/*
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java
index a7bcd4d7a8d..d2bac5c558c 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/MIRegistersTest_7_2.java
@@ -10,14 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2;
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1.MIRegistersTest_7_1;
-import org.eclipse.core.runtime.Platform;
import org.junit.runner.RunWith;
@RunWith(BackgroundRunner.class)
@@ -26,23 +21,4 @@ public class MIRegistersTest_7_2 extends MIRegistersTest_7_1 {
protected void setGdbVersion() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2);
}
-
- // GDB's list of registers is different with GDB 7.2
- @Override
- protected List get_X86_REGS() {
- List list = new LinkedList(Arrays.asList("eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags",
- "cs","ss","ds","es","fs","gs","st0","st1","st2","st3",
- "st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg",
- "fooff","fop","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7",
- "mxcsr",/*"","","","","","","","",*/"orig_eax",
- "al","cl","dl","bl","ah","ch","dh","bh","ax","cx",
- "dx","bx",/*"",*/"bp","si","di","mm0","mm1","mm2","mm3",
- "mm4","mm5","mm6","mm7"));
- // On Windows, gdb doesn't report "orig_eax" as a register. Apparently it does on Linux
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- list.remove("orig_eax");
- }
- return list;
- }
-
}