mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
Bug 320277: JUnit test to make sure we properly view variables of base class in derived class
This commit is contained in:
parent
e378c67b8a
commit
ffd8caf56d
2 changed files with 65 additions and 0 deletions
|
@ -51,6 +51,16 @@ struct childStruct {
|
||||||
public:
|
public:
|
||||||
Z z;
|
Z z;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// For bug 320277
|
||||||
|
class Base {};
|
||||||
|
class BaseTest: public Base {
|
||||||
|
public:
|
||||||
|
BaseTest() {}
|
||||||
|
void test() { return; }
|
||||||
|
};
|
||||||
|
// End bug 320277
|
||||||
|
|
||||||
void locals2() {
|
void locals2() {
|
||||||
// Check that we get the content of local variables with
|
// Check that we get the content of local variables with
|
||||||
// the same name as the calling method
|
// the same name as the calling method
|
||||||
|
@ -300,6 +310,9 @@ int main() {
|
||||||
testUpdateOfPointer();
|
testUpdateOfPointer();
|
||||||
testCanWrite();
|
testCanWrite();
|
||||||
|
|
||||||
|
// For bug 320277
|
||||||
|
BaseTest b; b.test();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,6 +391,58 @@ public class MIExpressionsTest extends BaseTestCase {
|
||||||
assertTrue(wait.getMessage(), wait.isOK());
|
assertTrue(wait.getMessage(), wait.isOK());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test makes sure we properly deal with a GDB display bug.
|
||||||
|
* See bug 320277
|
||||||
|
*
|
||||||
|
* The following code causes a bug in GDB:
|
||||||
|
*
|
||||||
|
* class Base {};
|
||||||
|
* class BaseTest: public Base {
|
||||||
|
* public:
|
||||||
|
* BaseTest() {} // Removing this lines removes GDB's bug
|
||||||
|
* void test() { return; }
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* We see the bug with the following commands:
|
||||||
|
* -var-create - * this
|
||||||
|
* -var-list-children var1
|
||||||
|
* -var-info-path-expression var1.BaseTest
|
||||||
|
* -data-evaluate-expression "(*(Base*) this)"
|
||||||
|
*
|
||||||
|
* which we can reproduce by creating the children of this
|
||||||
|
* and asking for the DETAILS_FORMAT of the var1.BaseTest child.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testBaseChildrenBug() throws Throwable {
|
||||||
|
|
||||||
|
MIStoppedEvent stoppedEvent = SyncUtil.runToLocation("BaseTest::test");
|
||||||
|
|
||||||
|
final IFrameDMContext frameDmc = SyncUtil.getStackFrame(stoppedEvent.getDMContext(), 0);
|
||||||
|
|
||||||
|
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||||
|
|
||||||
|
// First we get 'this' and its children
|
||||||
|
final IExpressionDMContext exprDmc = SyncUtil.createExpression(frameDmc, "this");
|
||||||
|
final IExpressionDMContext[] children = getChildren(exprDmc, new String[] {"Base"});
|
||||||
|
|
||||||
|
fExpService.getExecutor().submit(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
fExpService.getFormattedExpressionValue(
|
||||||
|
fExpService.getFormattedValueContext(children[0], MIExpressions.DETAILS_FORMAT),
|
||||||
|
new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(), null) {
|
||||||
|
@Override
|
||||||
|
protected void handleCompleted() {
|
||||||
|
wait.waitFinished(getStatus());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||||
|
assertTrue(wait.getMessage(), wait.isOK());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This test verifies that the ExpressionService can write to a variable.
|
* This test verifies that the ExpressionService can write to a variable.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue