Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc23
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java21
2 files changed, 31 insertions, 13 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc
index 7037087b009..aa4ef2089dc 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/ExpressionTestApp.cc
@@ -283,18 +283,23 @@ int testConcurrentUpdateOutOfScopeChildThenParent() {
int testUpdateOfPointer() {
struct {
- int a;
- int* b;
- }z;
+ int value;
+ int* ptr;
+ } z;
- int c = 3;
+ int otherValue = 3;
- z.b = &(z.a);
- z.a = 1;
+ z.ptr = &z.value;
+ z.value = 1;
+
+ /* testUpdateOfPointer_1 */
- z.b = &c;
- z.a = 2;
- z.a = 2; // this redundant line is here to ensure 6 steps after running to this func leaves locals visible
+ z.ptr = &otherValue;
+ z.value = 2;
+
+ /* testUpdateOfPointer_2 */
+
+ return 0;
}
int testCanWrite() {
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
index 64407ed9090..8f8691ccfcb 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIExpressionsTest.java
@@ -70,6 +70,7 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class MIExpressionsTest extends BaseParametrizedTestCase {
private static final String EXEC_NAME = "ExpressionTestApp.exe";
+ private static final String SOURCE_NAME = "ExpressionTestApp.cc";
private DsfSession fSession;
@@ -91,10 +92,19 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXEC_PATH + EXEC_NAME);
}
+ /* Line tags in the source file. */
+ private static final String[] LINE_TAGS = new String[] {
+ "testUpdateOfPointer_1",
+ "testUpdateOfPointer_2",
+ };
+
@Override
public void doBeforeTest() throws Exception {
super.doBeforeTest();
+ /* Resolve line tags in source file. */
+ resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
+
fSession = getGDBLaunch().getSession();
Runnable runnable = new Runnable() {
@Override
@@ -2579,8 +2589,11 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
*/
@Test
public void testUpdateOfPointer() throws Throwable {
- SyncUtil.runToLocation("testUpdateOfPointer");
- MIStoppedEvent stoppedEvent = SyncUtil.step(3, StepType.STEP_OVER);
+ /* Places we're going to run to. */
+ String tag1 = String.format("%s:%d", SOURCE_NAME, getLineForTag("testUpdateOfPointer_1"));
+ String tag2 = String.format("%s:%d", SOURCE_NAME, getLineForTag("testUpdateOfPointer_2"));
+
+ MIStoppedEvent stoppedEvent = SyncUtil.runToLocation(tag1);
IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
/* Create expression for the structure. */
@@ -2602,8 +2615,8 @@ public class MIExpressionsTest extends BaseParametrizedTestCase {
String pointeeActualValue = SyncUtil.getExpressionValue(pointeeDmc, IFormattedValues.NATURAL_FORMAT);
assertThat(pointeeActualValue, is("1"));
- /* Now, step to change the values of all the children. */
- SyncUtil.step(2, StepType.STEP_OVER);
+ /* Run to the second tag. */
+ SyncUtil.runToLocation(tag2);
/* Get the value of the integer. */
integerValue = SyncUtil.getExpressionValue(fieldsDmc[0], IFormattedValues.NATURAL_FORMAT);

Back to the top