diff options
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.tests.dsf.gdb')
21 files changed, 627 insertions, 18 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/bin/.cvsignore b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/bin/.cvsignore index a9a223ba93b..8df4a122df9 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/bin/.cvsignore +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/bin/.cvsignore @@ -6,4 +6,5 @@ LaunchConfigurationAndRestartTestApp.exe MemoryTestApp.exe MultiThread.exe SpecialTestApp.exe -TracepointTestApp.exe
\ No newline at end of file +TracepointTestApp.exe +core
\ No newline at end of file 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 b3ea48c2ef3..3ac4e9a2ff9 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 @@ -12,3 +12,6 @@ all: target=`basename $$target .cc` ; \ g++ $(GCCFLAGS) $$file -o $(destDir)/$$target.exe ; \ done +# Now generate the core file that we need for the post-mortem core-file tests + @gdb --nx --batch -ex "b testLocals" -ex run -ex "next 16" -ex "gcore ../bin/core" \ + ../bin/ExpressionTestApp.exe > /dev/null 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 6a9c4c5daea..0baded31f22 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 @@ -70,7 +70,7 @@ public class BaseTestCase { // This allows a Suite to set an attribute // The suite is reponsible for clearing those attributes // once it is finished - private static Map<String, Object> globalLaunchAttributes; + private static Map<String, Object> globalLaunchAttributes = new HashMap<String, Object>(); private static Process gdbserverProc; @@ -90,16 +90,11 @@ public class BaseTestCase { } public static void setGlobalLaunchAttribute(String key, Object value) { - if (globalLaunchAttributes == null) { - globalLaunchAttributes = new HashMap<String, Object>(); - } globalLaunchAttributes.put(key, value); } public static void removeGlobalLaunchAttribute(String key) { - if (globalLaunchAttributes != null) { - globalLaunchAttributes.remove(key); - } + globalLaunchAttributes.remove(key); } public synchronized MIStoppedEvent getInitialStoppedEvent() { return fInitialStoppedEvent; } @@ -174,6 +169,9 @@ public class BaseTestCase { System.out.println("Running test: " + testName.getMethodName() + " using GDB: " + launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME)); System.out.println("===================================================================================================="); + boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE) + .equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE); + // First check if we should launch gdbserver in the case of a remote session launchGdbServer(); @@ -210,7 +208,7 @@ public class BaseTestCase { // proceeding. All tests assume that stable initial state. Two // seconds is plenty; we typically get to that state in a few // hundred milliseconds with the tiny test programs we use. - if (!fTargetSuspended) { + if (!postMortemLaunch && !fTargetSuspended) { synchronized (fTargetSuspendedSem) { fTargetSuspendedSem.wait(TestsPlugin.massageTimeout(2000)); Assert.assertTrue(fTargetSuspended); @@ -218,8 +216,10 @@ public class BaseTestCase { } // This should be a given if the above check passes - synchronized(this) { - Assert.assertNotNull(fInitialStoppedEvent); + if (!postMortemLaunch) { + synchronized(this) { + Assert.assertNotNull(fInitialStoppedEvent); + } } // If we started a gdbserver add it to the launch to make sure it is killed at the end diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java index 997ce670643..2a7bfc09791 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/SyncUtil.java @@ -584,7 +584,49 @@ public class SyncUtil { } return null; } - + + /** + * Utility method to return the execution DM context. + */ + @ThreadSafeAndProhibitedFromDsfExecutor("fSession.getExecutor()") + public static IMIExecutionDMContext getExecutionContext(final int threadIndex) throws InterruptedException { + assert !fProcessesService.getExecutor().isInExecutorThread(); + + final IContainerDMContext containerDmc = SyncUtil.getContainerContext(); + + Query<IMIExecutionDMContext> query = new Query<IMIExecutionDMContext>() { + @Override + protected void execute(final DataRequestMonitor<IMIExecutionDMContext> rm) { + fProcessesService.getProcessesBeingDebugged( + containerDmc, + new DataRequestMonitor<IDMContext[]>(ImmediateExecutor.getInstance(), null) { + @Override + protected void handleCompleted() { + if (isSuccess()) { + IDMContext[] threads = getData(); + Assert.assertNotNull("invalid return value from service", threads); + Assert.assertTrue("unexpected number of threads", threadIndex < threads.length); + IDMContext thread = threads[threadIndex]; + Assert.assertNotNull("unexpected thread context type ", thread); + rm.setData((IMIExecutionDMContext)thread); + } else { + rm.setStatus(getStatus()); + } + rm.done(); + } + }); + } + }; + + fGdbControl.getExecutor().execute(query); + try { + return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); + } catch (Exception e) { + fail(e.getMessage()); + } + return null; + } + /** * Restart the program. */ diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuitesRemote.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuitesRemote.java index 78ed63c9c6f..95e0000a21c 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuitesRemote.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/AllSuitesRemote.java @@ -31,13 +31,13 @@ import org.junit.runners.Suite; @RunWith(Suite.class) @Suite.SuiteClasses({ - Suite_Remote_6_6.class, - Suite_Remote_6_7.class, - Suite_Remote_6_8.class, - Suite_Remote_7_0.class, - Suite_Remote_7_1.class, - Suite_Remote_7_2.class, Suite_Remote_7_3.class, + Suite_Remote_7_2.class, + Suite_Remote_7_1.class, + Suite_Remote_7_0.class, + Suite_Remote_6_8.class, + Suite_Remote_6_7.class, + Suite_Remote_6_6.class, /* Add your suite class here */ }) 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 141cae39e2a..6f0319c88cf 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 @@ -37,6 +37,7 @@ import org.junit.runners.Suite; GDBProcessesTest.class, LaunchConfigurationAndRestartTest.class, OperationsWhileTargetIsRunningTest.class, + PostMortemCoreTest.class, Suite_Sessionless_Tests.class, /* Add your suite class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java new file mode 100644 index 00000000000..df927f820f6 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/PostMortemCoreTest.java @@ -0,0 +1,380 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.Query; +import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.debug.service.IExpressions; +import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext; +import org.eclipse.cdt.dsf.debug.service.IFormattedValues; +import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext; +import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData; +import org.eclipse.cdt.dsf.debug.service.IMemory; +import org.eclipse.cdt.dsf.debug.service.IMemory.IMemoryDMContext; +import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.mi.service.MIExpressions; +import org.eclipse.cdt.dsf.service.DsfServicesTracker; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor; +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.cdt.utils.Addr64; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.model.MemoryByte; +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest extends BaseTestCase { + + private DsfSession fSession; + + private DsfServicesTracker fServicesTracker; + + private IExpressions fExpService; + private IMemory fMemoryService; + + private IMemoryDMContext fMemoryDmc; + + + @BeforeClass + public static void beforeClassMethod() { + setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "data/launch/bin/ExpressionTestApp.exe"); + + // Set post-mortem launch + setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, + ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE); + // Set post-mortem type to core file + setLaunchAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_POST_MORTEM_TYPE, + IGDBLaunchConfigurationConstants.DEBUGGER_POST_MORTEM_CORE_FILE); + // Set core file path + setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, "data/launch/bin/core"); + } + + @Before + public void init() throws Exception { + fSession = getGDBLaunch().getSession(); + + fMemoryDmc = (IMemoryDMContext)SyncUtil.getContainerContext(); + assert(fMemoryDmc != null); + + Runnable runnable = new Runnable() { + public void run() { + fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); + fExpService = fServicesTracker.getService(IExpressions.class); + fMemoryService = fServicesTracker.getService(IMemory.class); + } + }; + fSession.getExecutor().submit(runnable).get(); + } + + @After + public void shutdown() throws Exception { + Runnable runnable = new Runnable() { + public void run() { + fSession.removeServiceEventListener(PostMortemCoreTest.this); + } + }; + fSession.getExecutor().submit(runnable).get(); + fExpService = null; + fMemoryService = null; + fServicesTracker.dispose(); + } + + /** + * Test that we can correctly evaluate integer expressions. + */ + @Test + public void testLiteralIntegerExpressions() throws Throwable { + // Create a map of expressions and their expected values. + Map<String, String[]> tests = new HashMap<String, String[]>(); + + tests.put("0 + 0 - 0", new String[] { "0x0", "0", "0", "0", "0", "0" }); + tests.put("3 + 4", new String[] { "0x7", "07", "111", "7", "7", "7" }); + tests.put("3 + 4 * 5", new String[] { "0x17", "027", "10111", "23", "23", "23" }); + tests.put("5 * 3 + 4", new String[] { "0x13", "023", "10011", "19", "19", "19" }); + tests.put("5 * (3 + 4)", new String[] { "0x23", "043", "100011", "35", "35", "35" }); + tests.put("10 - 15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5", + "-5", "-5" }); + tests.put("10 + -15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5", + "-5", "-5" }); + + executeExpressionSubTests(tests, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0)); + } + + /** + * Test that we can correctly evaluate floating-point expressions. + */ + @Test + public void testLiteralFloatingPointExpressions() throws Throwable { + // Create a map of expressions and their expected values. + Map<String, String[]> tests = new HashMap<String, String[]>(); + + tests.put("3.14159 + 1.1111", new String[] { "0x4", "04", "100", "4", "4.2526", "4.2526" }); + tests.put("100.0 / 3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" }); + tests.put("-100.0 / 3.0", new String[] { "0xffffffffffffffdf", "01777777777777777777737", + "1111111111111111111111111111111111111111111111111111111111011111", "-33", "-33.3333", "-33.3333" }); + tests.put("-100.0 / -3.0", new String[] { "0x21", "041", "100001", "33", "33.3333", "33.3333" }); + executeExpressionSubTests(tests, false, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0)); + + tests.clear(); + tests.put("100.0 / 0.5", new String[] { "0xc8", "0310", "11001000", "200", "200", "200" }); + executeExpressionSubTests(tests, true, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0)); + + } + + /** + * Test that we can correctly evaluate C expressions involving local + * variables. + */ + @Test + public void testLocalVariables() throws Throwable { + // Create a map of expressions to expected values. + Map<String, String[]> tests1 = new HashMap<String, String[]>(); + + tests1.put("lIntVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" }); + tests1.put("lDoubleVar", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" }); + tests1.put("lCharVar", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" }); + tests1.put("lBoolVar", new String[] { "0x0", "0", "0", "0", "false", "false" }); + + tests1.put("lIntArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" }); + tests1.put("lDoubleArray[1]", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" }); + tests1.put("lCharArray[1]", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" }); + tests1.put("lBoolArray[1]", new String[] { "0x0", "0", "0", "0", "false", "false" }); + + tests1.put("*lIntPtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345", "12345" }); + tests1.put("*lDoublePtr", new String[] { "0x3039", "030071", "11000000111001", "12345", "12345.123449999999", "12345.123449999999" }); + tests1.put("*lCharPtr", new String[] { "0x6d", "0155", "1101101", "109", "109 'm'", "109 'm'" }); + tests1.put("*lBoolPtr", new String[] { "0x0", "0", "0", "0", "false", "false" }); + + tests1.put("lIntPtr2", new String[] { "0x1", "01", "1", "1", "0x1", "0x1" }); + tests1.put("lDoublePtr2", new String[] { "0x2345", "021505", "10001101000101", "9029", "0x2345", "0x2345" }); + // GDB says a char* is out of bounds, but not the other pointers??? + // tests1.put("CharPtr2", new String[] { "0x1234", "011064", + // "1001000110100", "4660", "0x1234" }); + tests1.put("lBoolPtr2", new String[] { "0x123ABCDE", "02216536336", "10010001110101011110011011110", "305839326", "0x123ABCDE", "0x123ABCDE" }); + + executeExpressionSubTests(tests1, SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0)); + } + + @Test + public void readMemoryArray() throws Throwable { + IAddress address = evaluateExpression(SyncUtil.getStackFrame(SyncUtil.getExecutionContext(0), 0), "&lBoolPtr2"); + + final int LENGTH = 4; + + // Get the memory block + MemoryByte[] buffer = readMemory(fMemoryDmc, address, 0, 1, LENGTH); + + assertEquals(LENGTH, buffer.length); + + assertEquals(buffer[0].getValue(), 0xffffffde); + assertEquals(buffer[1].getValue(), 0xffffffbc); + assertEquals(buffer[2].getValue(), 0x3a); + assertEquals(buffer[3].getValue(), 0x12); + } + + private IAddress evaluateExpression(IDMContext ctx, String expression) throws Throwable + { + // Create the expression and format contexts + final IExpressionDMContext expressionDMC = SyncUtil.createExpression(ctx, expression); + final FormattedValueDMContext formattedValueDMC = SyncUtil.getFormattedValue(fExpService, expressionDMC, IFormattedValues.HEX_FORMAT); + + Query<FormattedValueDMData> query = new Query<FormattedValueDMData>() { + @Override + protected void execute(final DataRequestMonitor<FormattedValueDMData> rm) { + fExpService.getFormattedExpressionValue(formattedValueDMC, rm); + } + }; + + fSession.getExecutor().execute(query); + FormattedValueDMData value = null; + try { + value = query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); + } catch (Exception e) { + fail(e.getMessage()); + return null; + } + + return new Addr64(value.getFormattedValue()); + } + + + private MemoryByte[] readMemory(final IMemoryDMContext dmc, final IAddress address, + final long offset, final int word_size, final int count) throws InterruptedException + { + Query<MemoryByte[]> query = new Query<MemoryByte[]>() { + @Override + protected void execute(final DataRequestMonitor<MemoryByte[]> rm) { + fMemoryService.getMemory(dmc, address, offset, word_size, count, rm); + } + }; + + fSession.getExecutor().execute(query); + try { + return query.get(TestsPlugin.massageTimeout(2000), TimeUnit.MILLISECONDS); + } catch (Exception e) { + fail(e.getMessage()); + } + return null; + } + + /** + * Executes a group of sub-tests. + * + * @param tests + * A Map in which the key is an expression to evaluate and the + * value is an array of expected values, one for each of the + * formats supported by the Expressions service (hex, octal, + * binary, decimal, natural, details). + * @param exact + * Indicates whether the natural and details format should + * require an exact match to the expected value, or whether the + * comparison should match only up to the number of characters + * provided in the expected value. Where this is used is in + * expressions that involve floating point calculation. Such + * calculations are not exact (even when you'd think they should + * be) and these tests cannot predict what exactly the result + * will be. When this param is false, then we consider it a match + * if, e.g., the gdb expression resolves to "1.23456789", but the + * caller only supplied "1.2345". + */ + private void executeExpressionSubTests(final Map<String, String[]> tests, final boolean exact, IDMContext dmc) + throws Throwable + { + + // Now evaluate each of the above expressions and compare the actual + // value against + // the expected value. + for (final String expressionToEvaluate : tests.keySet()) { + + // Get an IExpressionDMContext object representing the expression to + // be evaluated. + final IExpressionDMContext exprDMC = SyncUtil.createExpression(dmc, expressionToEvaluate); + + final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); + + // Get the list of available format IDs for this expression and for + // each one, + // get the value of the expression + fExpService.getExecutor().submit(new Runnable() { + public void run() { + fExpService.getAvailableFormats(exprDMC, new DataRequestMonitor<String[]>( + fExpService.getExecutor(), null) { + @Override + protected void handleCompleted() { + if (!isSuccess()) { + wait.waitFinished(getStatus()); + } else { + final String[] formatIds = getData(); + + // Now run the current sub-test using each of + // the formats available for the type of + // the expression in the sub-test. + + for (final String formatId : formatIds) { + // Get a FormattedValueCMContext object for + // the expression-formatID pair. + final FormattedValueDMContext valueDmc = fExpService.getFormattedValueContext( + exprDMC, formatId); + + // Increment the number of completed + // requests to wait for, since we will send + // multiple concurrent requests + wait.increment(); + + // Evaluate the expression represented by + // the FormattedValueDMContext object + // This actually evaluates the expression. + fExpService.getFormattedExpressionValue(valueDmc, + new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) { + @Override + protected void handleCompleted() { + if (!isSuccess()) { + wait.waitFinished(getStatus()); + } else { + + // Get the + // FormattedValueDMData + // object from the waiter. + FormattedValueDMData exprValueDMData = getData(); + + final String[] expectedValues = tests.get(expressionToEvaluate); + + // Check the value of the expression for correctness. + String actualValue = exprValueDMData.getFormattedValue(); + String expectedValue; + + if (formatId.equals(IFormattedValues.HEX_FORMAT)) + expectedValue = expectedValues[0]; + else if (formatId.equals(IFormattedValues.OCTAL_FORMAT)) + expectedValue = expectedValues[1]; + else if (formatId.equals(IFormattedValues.BINARY_FORMAT)) + expectedValue = expectedValues[2]; + else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT)) + expectedValue = expectedValues[3]; + else if (formatId.equals(IFormattedValues.NATURAL_FORMAT)) + expectedValue = expectedValues[4]; + else if (formatId.equals(MIExpressions.DETAILS_FORMAT)) + expectedValue = expectedValues[5]; + else + expectedValue = "[Unrecognized format ID: " + formatId + "]"; + + if ((exact == false) && + (formatId.equals(IFormattedValues.NATURAL_FORMAT) || formatId.equals(MIExpressions.DETAILS_FORMAT)) && + (expectedValue.length() < actualValue.length())) { + actualValue = actualValue.substring(0, expectedValue.length()); + } + + if (actualValue.equalsIgnoreCase(expectedValue)) { + wait.waitFinished(); + } else { + String errorMsg = "Failed to correctly evalutate '" + + expressionToEvaluate + "': expected '" + expectedValue + + "', got '" + actualValue + "'"; + wait.waitFinished(new Status(IStatus.ERROR, + TestsPlugin.PLUGIN_ID, errorMsg, null)); + } + } + } + }); + } + } + } + }); + } + }); + wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); + assertTrue(wait.getMessage(), wait.isOK()); + } + } + + private void executeExpressionSubTests(final Map<String, String[]> tests, IDMContext dmc) throws Throwable { + executeExpressionSubTests(tests, true, dmc); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/PostMortemCoreTest_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/PostMortemCoreTest_6_6.java new file mode 100644 index 00000000000..533159110b5 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/PostMortemCoreTest_6_6.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6; + +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.PostMortemCoreTest; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest_6_6 extends PostMortemCoreTest { + @BeforeClass + public static void beforeClassMethod_6_6() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_6); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java index cce8c17bd6b..987092d6b6b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java @@ -37,6 +37,7 @@ import org.junit.runners.Suite; GDBProcessesTest_6_6.class, LaunchConfigurationAndRestartTest_6_6.class, OperationsWhileTargetIsRunningTest_6_6.class, + PostMortemCoreTest_6_6.class, Suite_Sessionless_Tests.class /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/PostMortemCoreTest_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/PostMortemCoreTest_6_7.java new file mode 100644 index 00000000000..06fb552bd12 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/PostMortemCoreTest_6_7.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7; + +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.PostMortemCoreTest; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest_6_7 extends PostMortemCoreTest { + @BeforeClass + public static void beforeClassMethod_6_7() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_7); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java index d9ed9021279..3a58408147a 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java @@ -37,6 +37,7 @@ import org.junit.runners.Suite; GDBProcessesTest_6_7.class, LaunchConfigurationAndRestartTest_6_7.class, OperationsWhileTargetIsRunningTest_6_7.class, + PostMortemCoreTest_6_7.class, Suite_Sessionless_Tests.class /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/PostMortemCoreTest_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/PostMortemCoreTest_6_8.java new file mode 100644 index 00000000000..2d6cac74dd2 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/PostMortemCoreTest_6_8.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8; + +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.PostMortemCoreTest; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest_6_8 extends PostMortemCoreTest { + @BeforeClass + public static void beforeClassMethod_6_8() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_6_8); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java index 9834a494975..6b2b75c984a 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java @@ -37,6 +37,7 @@ import org.junit.runners.Suite; GDBProcessesTest_6_8.class, LaunchConfigurationAndRestartTest_6_8.class, OperationsWhileTargetIsRunningTest_6_8.class, + PostMortemCoreTest_6_8.class, Suite_Sessionless_Tests.class /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/PostMortemCoreTest_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/PostMortemCoreTest_7_0.java new file mode 100644 index 00000000000..55e16d65535 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/PostMortemCoreTest_7_0.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0; + +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.PostMortemCoreTest; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest_7_0 extends PostMortemCoreTest { + @BeforeClass + public static void beforeClassMethod_7_0() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_0); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java index 1c745e14039..176b45b84f4 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java @@ -39,6 +39,7 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest_7_0.class, OperationsWhileTargetIsRunningTest_7_0.class, OperationsWhileTargetIsRunningNonStopTest_7_0.class, + PostMortemCoreTest_7_0.class, Suite_Sessionless_Tests.class /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/PostMortemCoreTest_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/PostMortemCoreTest_7_1.java new file mode 100644 index 00000000000..2aa1821f281 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/PostMortemCoreTest_7_1.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1; + +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.PostMortemCoreTest; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest_7_1 extends PostMortemCoreTest { + @BeforeClass + public static void beforeClassMethod_7_1() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_1); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java index afff3d316cc..c8717d34335 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java @@ -39,6 +39,7 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest_7_1.class, OperationsWhileTargetIsRunningTest_7_1.class, OperationsWhileTargetIsRunningNonStopTest_7_1.class, + PostMortemCoreTest_7_1.class, Suite_Sessionless_Tests.class /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/PostMortemCoreTest_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/PostMortemCoreTest_7_2.java new file mode 100644 index 00000000000..46b5cdc838a --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/PostMortemCoreTest_7_2.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2; + +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.PostMortemCoreTest; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest_7_2 extends PostMortemCoreTest { + @BeforeClass + public static void beforeClassMethod_7_2() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_2); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java index cbea4aa9895..45deeaa2853 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java @@ -39,6 +39,7 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest_7_2.class, OperationsWhileTargetIsRunningTest_7_2.class, OperationsWhileTargetIsRunningNonStopTest_7_2.class, + PostMortemCoreTest_7_2.class, Suite_Sessionless_Tests.class /* Add your test class here */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/PostMortemCoreTest_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/PostMortemCoreTest_7_3.java new file mode 100644 index 00000000000..23b92bffd70 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/PostMortemCoreTest_7_3.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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: + * Ericsson - Initial Implementation + *******************************************************************************/ +package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3; + +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.PostMortemCoreTest; +import org.junit.BeforeClass; +import org.junit.runner.RunWith; + +@RunWith(BackgroundRunner.class) +public class PostMortemCoreTest_7_3 extends PostMortemCoreTest { + @BeforeClass + public static void beforeClassMethod_7_3() { + setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_3); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java index 14568f887e7..66843ec2753 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/Suite_7_3.java @@ -39,6 +39,7 @@ import org.junit.runners.Suite; LaunchConfigurationAndRestartTest_7_3.class, OperationsWhileTargetIsRunningTest_7_3.class, OperationsWhileTargetIsRunningNonStopTest_7_3.class, + PostMortemCoreTest_7_3.class, Suite_Sessionless_Tests.class /* Add your test class here */ }) |