mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Bug 378834 - Update Debug JUnit tests to run on Hudson
Change-Id: Ie93ef3b2401b6823afd96504de1b5b5c577f1da4 Reviewed-on: https://git.eclipse.org/r/9656 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
3222ba63ed
commit
9e6ee807a9
12 changed files with 117 additions and 69 deletions
|
@ -9,9 +9,10 @@
|
||||||
# Wind River Systems - initial API and implementation
|
# Wind River Systems - initial API and implementation
|
||||||
# IBM Corporation
|
# IBM Corporation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
output.tests.jar = bin/
|
|
||||||
bin.includes = fragment.xml,\
|
bin.includes = fragment.xml,\
|
||||||
META-INF/,\
|
META-INF/,\
|
||||||
.
|
.,\
|
||||||
|
data/,\
|
||||||
|
about.html
|
||||||
source.. = src/
|
source.. = src/
|
||||||
src.includes = about.html
|
src.includes = about.html
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
src = $(wildcard *.cc *.c)
|
src = $(wildcard *.cc *.c)
|
||||||
destDir = ../bin
|
destDir = ../bin
|
||||||
GCCFLAGS = -gdwarf-2 -pthread -m32
|
GCCFLAGS = -gdwarf-2 -pthread
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@mkdir -p $(destDir)
|
@mkdir -p $(destDir)
|
||||||
|
|
|
@ -21,8 +21,8 @@ unsigned int __stdcall PrintHello(void *threadid)
|
||||||
void *PrintHello(void *threadid)
|
void *PrintHello(void *threadid)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int tid = (int)threadid;
|
long tid = (long)threadid;
|
||||||
printf("Hello World! It's me, thread #%d!\n", tid);
|
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
|
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__
|
#ifdef __MINGW32__
|
||||||
|
|
|
@ -14,9 +14,9 @@ typedef pthread_t TID;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set a breakpoint here so that both threads stop.
|
// 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)
|
void *PrintHello(void *threadId)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int tId = (int)threadId;
|
long tId = (long)threadId;
|
||||||
firstBreakpoint(tId); // Stop a first time
|
firstBreakpoint(tId); // Stop a first time
|
||||||
|
|
||||||
SLEEP(1); // Keep state running a little
|
SLEEP(1); // Keep state running a little
|
||||||
|
|
|
@ -73,8 +73,8 @@ unsigned int __stdcall testTracepoints(void *threadid)
|
||||||
void *testTracepoints(void *threadid)
|
void *testTracepoints(void *threadid)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int tid = (int)threadid;
|
long tid = (long)threadid;
|
||||||
printf("Hello World! It's me, thread #%d!\n", tid);
|
printf("Hello World! It's me, thread #%ld!\n", tid);
|
||||||
|
|
||||||
int lIntVar = 12345;
|
int lIntVar = 12345;
|
||||||
double lDoubleVar = 12345.12345;
|
double lDoubleVar = 12345.12345;
|
||||||
|
|
|
@ -24,15 +24,53 @@
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>-->
|
</repositories>-->
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>production</id>
|
||||||
|
<properties>
|
||||||
|
<gdbPathOption>-Dcdt.tests.dsf.gdb.path=/opt/public/download-staging.priv/tools/cdt/gdb</gdbPathOption>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>clean</id>
|
||||||
|
<phase>clean</phase>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<ant antfile="TestAppBuilder.xml" target="clean"/>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>prepare</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<configuration>
|
||||||
|
<tasks>
|
||||||
|
<ant antfile="TestAppBuilder.xml" target="makeTestApps"/>
|
||||||
|
</tasks>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>tycho-surefire-plugin</artifactId>
|
<artifactId>tycho-surefire-plugin</artifactId>
|
||||||
<version>${tycho-version}</version>
|
<version>${tycho-version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<useUIHarness>true</useUIHarness>
|
<useUIHarness>true</useUIHarness>
|
||||||
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M</argLine>
|
<argLine>-Xms256m -Xmx512m -XX:MaxPermSize=256M ${gdbPathOption}</argLine>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/AutomatedSuite.*</include>
|
<include>**/AutomatedSuite.*</include>
|
||||||
</includes>
|
</includes>
|
||||||
|
|
|
@ -21,6 +21,8 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
import org.eclipse.cdt.dsf.datamodel.IDMEvent;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.ISuspendedDMEvent;
|
||||||
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
|
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.gdb.launching.GdbLaunch;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent;
|
import org.eclipse.cdt.dsf.mi.service.command.events.IMIDMEvent;
|
||||||
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
|
||||||
|
@ -218,10 +220,10 @@ public class BaseTestCase {
|
||||||
protected void doLaunch() throws Exception {
|
protected void doLaunch() throws Exception {
|
||||||
boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
|
||||||
|
|
||||||
System.out.println("====================================================================================================");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
|
||||||
System.out.println(String.format("Running test: %s using GDB: %s remote %s",
|
System.out.println(String.format("%s \"%s\" launching %s %s",
|
||||||
testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "on" : "off"));
|
GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "with gdbserver" : ""));
|
||||||
System.out.println("====================================================================================================");
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n");
|
||||||
|
|
||||||
boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
|
boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
|
||||||
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
|
||||||
|
@ -320,7 +322,7 @@ public class BaseTestCase {
|
||||||
BufferedReader reader = new BufferedReader(r);
|
BufferedReader reader = new BufferedReader(r);
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
System.out.println(line);
|
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace(line + "\n");
|
||||||
line = line.trim();
|
line = line.trim();
|
||||||
if (line.startsWith("Listening on port")) {
|
if (line.startsWith("Listening on port")) {
|
||||||
break;
|
break;
|
||||||
|
@ -351,8 +353,15 @@ public class BaseTestCase {
|
||||||
public static void setGdbProgramNamesLaunchAttributes(String version) {
|
public static void setGdbProgramNamesLaunchAttributes(String version) {
|
||||||
// See bugzilla 303811 for why we have to append ".exe" on Windows
|
// See bugzilla 303811 for why we have to append ".exe" on Windows
|
||||||
boolean isWindows = Platform.getOS().equals(Platform.OS_WIN32);
|
boolean isWindows = Platform.getOS().equals(Platform.OS_WIN32);
|
||||||
setGlobalLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb." + version + (isWindows ? ".exe" : ""));
|
String gdbPath = System.getProperty("cdt.tests.dsf.gdb.path");
|
||||||
setGlobalLaunchAttribute(ATTR_DEBUG_SERVER_NAME, "gdbserver." + version + (isWindows ? ".exe" : ""));
|
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() {
|
protected void setGdbVersion() {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.tests.dsf.gdb.tests;
|
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.runner.RunWith;
|
||||||
import org.junit.runners.Suite;
|
import org.junit.runners.Suite;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import org.junit.runners.Suite;
|
||||||
|
|
||||||
@RunWith(Suite.class)
|
@RunWith(Suite.class)
|
||||||
@Suite.SuiteClasses({
|
@Suite.SuiteClasses({
|
||||||
Suite_7_4.class,
|
Suite_7_5.class,
|
||||||
// Can't run the Remote test just yet because they
|
// Can't run the Remote test just yet because they
|
||||||
// have the same names on the local tests, which is
|
// have the same names on the local tests, which is
|
||||||
// not handled by JUnit (https://bugs.eclipse.org/172256)
|
// not handled by JUnit (https://bugs.eclipse.org/172256)
|
||||||
|
|
|
@ -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.IFormattedValues.FormattedValueDMData;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
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.MIBreakpointDMData;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
||||||
|
@ -240,7 +241,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IBreakpointsAddedEvent e) {
|
public void eventDispatched(IBreakpointsAddedEvent e) {
|
||||||
synchronized (lock) {
|
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]++;
|
fBreakpointEvents[BP_ADDED]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
|
@ -251,7 +252,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IBreakpointsUpdatedEvent e) {
|
public void eventDispatched(IBreakpointsUpdatedEvent e) {
|
||||||
synchronized (lock) {
|
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]++;
|
fBreakpointEvents[BP_UPDATED]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
|
@ -262,7 +263,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(IBreakpointsRemovedEvent e) {
|
public void eventDispatched(IBreakpointsRemovedEvent e) {
|
||||||
synchronized (lock) {
|
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]++;
|
fBreakpointEvents[BP_REMOVED]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
||||||
|
@ -273,7 +274,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(MIBreakpointHitEvent e) {
|
public void eventDispatched(MIBreakpointHitEvent e) {
|
||||||
synchronized (lock) {
|
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]++;
|
fBreakpointEvents[BP_HIT]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = e.getNumber();
|
fBreakpointRef = e.getNumber();
|
||||||
|
@ -284,7 +285,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(MIWatchpointTriggerEvent e) {
|
public void eventDispatched(MIWatchpointTriggerEvent e) {
|
||||||
synchronized (lock) {
|
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]++;
|
fBreakpointEvents[WP_HIT]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = e.getNumber();
|
fBreakpointRef = e.getNumber();
|
||||||
|
@ -295,7 +296,7 @@ public class MIBreakpointsTest extends BaseTestCase {
|
||||||
@DsfServiceEventHandler
|
@DsfServiceEventHandler
|
||||||
public void eventDispatched(MIWatchpointScopeEvent e) {
|
public void eventDispatched(MIWatchpointScopeEvent e) {
|
||||||
synchronized (lock) {
|
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]++;
|
fBreakpointEvents[WP_OOS]++;
|
||||||
fBreakpointEventCount++;
|
fBreakpointEventCount++;
|
||||||
fBreakpointRef = e.getNumber();
|
fBreakpointRef = e.getNumber();
|
||||||
|
|
|
@ -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.IFormattedValues.FormattedValueDMData;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
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.MIBreakpointDMData;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
import org.eclipse.cdt.dsf.mi.service.MIBreakpoints.MIBreakpointDMContext;
|
||||||
|
@ -225,7 +226,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_ADDED]++;
|
fBreakpointEvents[BP_ADDED]++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
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();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +236,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_UPDATED]++;
|
fBreakpointEvents[BP_UPDATED]++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
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();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +246,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_REMOVED]++;
|
fBreakpointEvents[BP_REMOVED]++;
|
||||||
fBreakpointRef = ((MIBreakpointDMContext) e.getBreakpoints()[0]).getReference();
|
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();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +256,7 @@ public class MICatchpointsTest extends BaseTestCase {
|
||||||
synchronized (fEventHandlerLock) {
|
synchronized (fEventHandlerLock) {
|
||||||
fBreakpointEvents[BP_HIT]++;
|
fBreakpointEvents[BP_HIT]++;
|
||||||
fBreakpointRef = e.getNumber();
|
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();
|
fEventHandlerLock.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.tests.dsf.gdb.tests;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.IRunControl.StepType;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
|
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.IMIExecutionDMContext;
|
||||||
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
|
||||||
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
|
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.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.DsfServicesTracker;
|
||||||
import org.eclipse.cdt.dsf.service.DsfSession;
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor;
|
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.BaseTestCase;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
|
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -62,18 +62,40 @@ import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@RunWith(BackgroundRunner.class)
|
@RunWith(BackgroundRunner.class)
|
||||||
public class MIRegistersTest extends BaseTestCase {
|
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<String> fRegisterNames = null;
|
||||||
|
|
||||||
protected List<String> get_X86_REGS() {
|
protected List<String> get_X86_REGS() throws Throwable {
|
||||||
List<String> list = new LinkedList<String>(Arrays.asList("eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags",
|
if (fRegisterNames == null) {
|
||||||
"cs","ss","ds","es","fs","gs","st0","st1","st2","st3",
|
// The tests must run on different machines, so the set of registers can change.
|
||||||
"st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg",
|
// To deal with this we ask GDB for the list of registers.
|
||||||
"fooff","fop","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7",
|
// Note that we send an MI Command in this code and do not use the IRegister service;
|
||||||
"mxcsr","orig_eax","mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7"));
|
// this is because we want to test the service later, comparing it to what we find
|
||||||
// On Windows, gdb doesn't report "orig_eax" as a register. Apparently it does on Linux
|
// by asking GDB directly.
|
||||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
Query<MIDataListRegisterNamesInfo> query = new Query<MIDataListRegisterNamesInfo>() {
|
||||||
list.remove("orig_eax");
|
@Override
|
||||||
}
|
protected void execute(DataRequestMonitor<MIDataListRegisterNamesInfo> rm) {
|
||||||
return list;
|
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<String>();
|
||||||
|
for (String name : names) {
|
||||||
|
if (!name.isEmpty()) {
|
||||||
|
fRegisterNames.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fRegisterNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -10,14 +10,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2;
|
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.framework.BackgroundRunner;
|
||||||
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
|
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.cdt.tests.dsf.gdb.tests.tests_7_1.MIRegistersTest_7_1;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@RunWith(BackgroundRunner.class)
|
@RunWith(BackgroundRunner.class)
|
||||||
|
@ -26,23 +21,4 @@ public class MIRegistersTest_7_2 extends MIRegistersTest_7_1 {
|
||||||
protected void setGdbVersion() {
|
protected void setGdbVersion() {
|
||||||
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2);
|
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GDB's list of registers is different with GDB 7.2
|
|
||||||
@Override
|
|
||||||
protected List<String> get_X86_REGS() {
|
|
||||||
List<String> list = new LinkedList<String>(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue