1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 04:15:35 +02:00

Bug 244385 Fixes all the tests except the Memory tests.

The problem was actually that the tests were not using the proper context when
querying the services.
This commit is contained in:
Marc Khouzam 2008-08-18 17:37:18 +00:00
parent cd9ffceeef
commit 1516391033
7 changed files with 160 additions and 107 deletions

View file

@ -400,7 +400,6 @@ public class ExpressionService extends AbstractDsfService implements IExpression
} }
} }
// This field holds a reference to to the data model context for this service.
private CommandCache fExpressionCache; private CommandCache fExpressionCache;
private MIVariableManager varManager; private MIVariableManager varManager;

View file

@ -126,6 +126,8 @@ public class ExpressionServiceTest extends BaseTestCase {
*/ */
@Test @Test
public void testLiteralIntegerExpressions() throws Throwable { public void testLiteralIntegerExpressions() throws Throwable {
MIStoppedEvent stoppedEvent = SyncUtil.SyncRunToLocation("testLocals");
// Create a map of expressions and their expected values. // Create a map of expressions and their expected values.
Map<String, String[]> tests = new HashMap<String, String[]>(); Map<String, String[]> tests = new HashMap<String, String[]>();
@ -139,7 +141,7 @@ public class ExpressionServiceTest extends BaseTestCase {
tests.put("10 + -15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5", tests.put("10 + -15", new String[] { "0xFFFFFFFB", "037777777773", "11111111111111111111111111111011", "-5",
"-5" }); "-5" });
executeExpressionSubTests(tests, fGdbControl.getControlDMContext()); executeExpressionSubTests(tests, SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0));
} }
/** /**
@ -147,6 +149,8 @@ public class ExpressionServiceTest extends BaseTestCase {
*/ */
@Test @Test
public void testLiteralFloatingPointExpressions() throws Throwable { public void testLiteralFloatingPointExpressions() throws Throwable {
MIStoppedEvent stoppedEvent = SyncUtil.SyncRunToLocation("testLocals");
// Create a map of expressions and their expected values. // Create a map of expressions and their expected values.
Map<String, String[]> tests = new HashMap<String, String[]>(); Map<String, String[]> tests = new HashMap<String, String[]>();
@ -157,7 +161,7 @@ public class ExpressionServiceTest extends BaseTestCase {
tests.put("-100.0 / -3.0", new String[] { "0x21", "041", "100001", "33", "33.333333333333336" }); tests.put("-100.0 / -3.0", new String[] { "0x21", "041", "100001", "33", "33.333333333333336" });
tests.put("100.0 / 0.5", new String[] { "0xc8", "0310", "11001000", "200", "200" }); tests.put("100.0 / 0.5", new String[] { "0xc8", "0310", "11001000", "200", "200" });
executeExpressionSubTests(tests, fGdbControl.getControlDMContext()); executeExpressionSubTests(tests, SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0));
} }
/** /**

View file

@ -34,6 +34,7 @@ import org.eclipse.dd.dsf.debug.service.IBreakpoints.IBreakpointsUpdatedEvent;
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext; import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMContext; import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMData; import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfServicesTracker;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
@ -44,6 +45,7 @@ import org.eclipse.dd.mi.service.MIBreakpoints;
import org.eclipse.dd.mi.service.MIRunControl; import org.eclipse.dd.mi.service.MIRunControl;
import org.eclipse.dd.mi.service.MIBreakpoints.MIBreakpointDMContext; import org.eclipse.dd.mi.service.MIBreakpoints.MIBreakpointDMContext;
import org.eclipse.dd.mi.service.command.events.MIBreakpointHitEvent; import org.eclipse.dd.mi.service.command.events.MIBreakpointHitEvent;
import org.eclipse.dd.mi.service.command.events.MIStoppedEvent;
import org.eclipse.dd.mi.service.command.events.MIWatchpointScopeEvent; import org.eclipse.dd.mi.service.command.events.MIWatchpointScopeEvent;
import org.eclipse.dd.mi.service.command.events.MIWatchpointTriggerEvent; import org.eclipse.dd.mi.service.command.events.MIWatchpointTriggerEvent;
import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor; import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor;
@ -333,13 +335,13 @@ public class MIBreakpointsTest extends BaseTestCase {
* @throws InterruptedException * @throws InterruptedException
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
private BigInteger evaluateExpression(String expression) throws Throwable { private BigInteger evaluateExpression(IDMContext ctx, String expression) throws Throwable {
final IExpressions fExpressionService = fServicesTracker.getService(IExpressions.class); final IExpressions fExpressionService = fServicesTracker.getService(IExpressions.class);
assert (fExpressionService != null); assert (fExpressionService != null);
// Get a stack context (temporary - should be an MIcontainerDMC) // Get a stack context (temporary - should be an MIcontainerDMC)
final IExpressionDMContext expressionDMC = SyncUtil.SyncCreateExpression(fGdbControlDmc, expression); final IExpressionDMContext expressionDMC = SyncUtil.SyncCreateExpression(ctx, expression);
final FormattedValueDMContext formattedValueDMC = SyncUtil.SyncGetFormattedValue(fExpressionService, final FormattedValueDMContext formattedValueDMC = SyncUtil.SyncGetFormattedValue(fExpressionService,
expressionDMC, IFormattedValues.DECIMAL_FORMAT); expressionDMC, IFormattedValues.DECIMAL_FORMAT);
@ -2302,7 +2304,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2316,7 +2319,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int i = evaluateExpression("i").intValue(); int i = evaluateExpression(frameDmc, "i").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == 128); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == 128);
} }
@ -2362,7 +2365,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2376,7 +2380,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int i = evaluateExpression("i").intValue(); int i = evaluateExpression(frameDmc, "i").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == 128); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == 128);
} }
@ -2409,7 +2413,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2423,7 +2428,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int i = evaluateExpression("i").intValue(); int i = evaluateExpression(frameDmc, "i").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2);
} }
@ -2469,7 +2474,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2483,7 +2489,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int i = evaluateExpression("i").intValue(); int i = evaluateExpression(frameDmc, "i").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2);
} }
@ -2514,7 +2520,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2528,7 +2535,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int i = evaluateExpression("i").intValue(); int i = evaluateExpression(frameDmc, "i").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2);
} }
@ -2559,7 +2566,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2573,7 +2581,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int i = evaluateExpression("i").intValue(); int i = evaluateExpression(frameDmc, "i").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2);
} }
@ -2605,7 +2613,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2619,7 +2628,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int i = evaluateExpression("i").intValue(); int i = evaluateExpression(frameDmc, "i").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", i == IGNORE_COUNT_2);
} }
@ -2670,7 +2679,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2684,7 +2694,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int j = evaluateExpression("j").intValue(); int j = evaluateExpression(frameDmc, "j").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", j == IGNORE_COUNT_2); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", j == IGNORE_COUNT_2);
} }
@ -2736,7 +2746,8 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Run until the breakpoint is hit and the event generated // Run until the breakpoint is hit and the event generated
SyncUtil.SyncResumeUntilStopped(); MIStoppedEvent stoppedEvent = SyncUtil.SyncResumeUntilStopped();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Ensure the correct BreakpointEvent was received // Ensure the correct BreakpointEvent was received
waitForBreakpointEvent(); waitForBreakpointEvent();
@ -2750,7 +2761,7 @@ public class MIBreakpointsTest extends BaseTestCase {
clearEventCounters(); clearEventCounters();
// Verify that the condition is met // Verify that the condition is met
int j = evaluateExpression("j").intValue(); int j = evaluateExpression(frameDmc, "j").intValue();
assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", j == IGNORE_COUNT_2); assertTrue("BreakpointEvent problem: breakpoint mismatch (wrong condition)", j == IGNORE_COUNT_2);
} }

View file

@ -28,11 +28,13 @@ import org.eclipse.dd.dsf.debug.service.IDisassembly.IDisassemblyDMContext;
import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext; import org.eclipse.dd.dsf.debug.service.IExpressions.IExpressionDMContext;
import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMContext; import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMContext;
import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMData; import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfServicesTracker;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext;
import org.eclipse.dd.mi.service.MIDisassembly; import org.eclipse.dd.mi.service.MIDisassembly;
import org.eclipse.dd.mi.service.command.events.MIStoppedEvent;
import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor; import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor;
import org.eclipse.dd.tests.gdb.framework.BackgroundRunner; import org.eclipse.dd.tests.gdb.framework.BackgroundRunner;
import org.eclipse.dd.tests.gdb.framework.BaseTestCase; import org.eclipse.dd.tests.gdb.framework.BaseTestCase;
@ -136,8 +138,11 @@ public class MIDisassemblyTest extends BaseTestCase {
*/ */
private IAddress evaluateExpression(String expression) throws Throwable private IAddress evaluateExpression(String expression) throws Throwable
{ {
MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Create the expression and format contexts // Create the expression and format contexts
final IExpressionDMContext expressionDMC = SyncUtil.SyncCreateExpression(fGdbControlDmc, expression); final IExpressionDMContext expressionDMC = SyncUtil.SyncCreateExpression(frameDmc, expression);
final FormattedValueDMContext formattedValueDMC = SyncUtil.SyncGetFormattedValue(fExpressionService, expressionDMC, IFormattedValues.HEX_FORMAT); final FormattedValueDMContext formattedValueDMC = SyncUtil.SyncGetFormattedValue(fExpressionService, expressionDMC, IFormattedValues.HEX_FORMAT);
// Create the DataRequestMonitor which will store the operation result in the wait object // Create the DataRequestMonitor which will store the operation result in the wait object

View file

@ -18,6 +18,7 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.utils.Addr64; import org.eclipse.cdt.utils.Addr64;
import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor;
import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.debug.service.IExpressions; import org.eclipse.dd.dsf.debug.service.IExpressions;
import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.debug.service.IMemory; import org.eclipse.dd.dsf.debug.service.IMemory;
@ -27,12 +28,14 @@ import org.eclipse.dd.dsf.debug.service.IFormattedValues.FormattedValueDMData;
import org.eclipse.dd.dsf.debug.service.IMemory.IMemoryChangedEvent; import org.eclipse.dd.dsf.debug.service.IMemory.IMemoryChangedEvent;
import org.eclipse.dd.dsf.debug.service.IMemory.IMemoryDMContext; import org.eclipse.dd.dsf.debug.service.IMemory.IMemoryDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.StepType; import org.eclipse.dd.dsf.debug.service.IRunControl.StepType;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.dsf.service.DsfServiceEventHandler; import org.eclipse.dd.dsf.service.DsfServiceEventHandler;
import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfServicesTracker;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext;
import org.eclipse.dd.mi.service.MIRunControl; import org.eclipse.dd.mi.service.MIRunControl;
import org.eclipse.dd.mi.service.command.events.MIStoppedEvent;
import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor; import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor;
import org.eclipse.dd.tests.gdb.framework.BackgroundRunner; import org.eclipse.dd.tests.gdb.framework.BackgroundRunner;
import org.eclipse.dd.tests.gdb.framework.BaseTestCase; import org.eclipse.dd.tests.gdb.framework.BaseTestCase;
@ -202,10 +205,10 @@ public class MIMemoryTest extends BaseTestCase {
* @throws InterruptedException * @throws InterruptedException
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
private IAddress evaluateExpression(String expression) throws Throwable private IAddress evaluateExpression(IDMContext ctx, String expression) throws Throwable
{ {
// Create the expression and format contexts // Create the expression and format contexts
final IExpressionDMContext expressionDMC = SyncUtil.SyncCreateExpression(fGdbControlDmc, expression); final IExpressionDMContext expressionDMC = SyncUtil.SyncCreateExpression(ctx, expression);
final FormattedValueDMContext formattedValueDMC = SyncUtil.SyncGetFormattedValue(fExpressionService, expressionDMC, IFormattedValues.HEX_FORMAT); final FormattedValueDMContext formattedValueDMC = SyncUtil.SyncGetFormattedValue(fExpressionService, expressionDMC, IFormattedValues.HEX_FORMAT);
// Create the DataRequestMonitor which will store the operation result in the wait object // Create the DataRequestMonitor which will store the operation result in the wait object
@ -438,14 +441,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
IMemoryDMContext dmc = null; IMemoryDMContext dmc = null;
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = 1; int count = 1;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Unknown context type"; String expected = "Unknown context type";
@ -503,12 +507,13 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int count = -1; int count = -1;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Word size not supported (!= 1)"; String expected = "Word size not supported (!= 1)";
@ -540,13 +545,14 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = -1; int count = -1;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Invalid word count (< 0)"; String expected = "Invalid word count (< 0)";
@ -571,13 +577,14 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = 1; int count = 1;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Verify that all bytes are '0' // Verify that all bytes are '0'
for (int i = 0; i < BLOCK_SIZE; i++) { for (int i = 0; i < BLOCK_SIZE; i++) {
@ -622,12 +629,13 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the array is zeroed // Run to the point where the array is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
int word_size = 1; int word_size = 1;
int count = 1; int count = 1;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Verify that all bytes are '0' // Verify that all bytes are '0'
for (int offset = 0; offset < BLOCK_SIZE; offset++) { for (int offset = 0; offset < BLOCK_SIZE; offset++) {
@ -670,13 +678,14 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = BLOCK_SIZE; int count = BLOCK_SIZE;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Get the memory block // Get the memory block
fWait.waitReset(); fWait.waitReset();
@ -727,14 +736,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = 1; int count = 1;
byte[] buffer = new byte[count]; byte[] buffer = new byte[count];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Unknown context type"; String expected = "Unknown context type";
@ -791,13 +801,14 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int count = -1; int count = -1;
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Word size not supported (!= 1)"; String expected = "Word size not supported (!= 1)";
@ -829,14 +840,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = -1; int count = -1;
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Invalid word count (< 0)"; String expected = "Invalid word count (< 0)";
@ -861,14 +873,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = 10; int count = 10;
byte[] buffer = new byte[count - 1]; byte[] buffer = new byte[count - 1];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Buffer too short"; String expected = "Buffer too short";
@ -893,14 +906,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = BLOCK_SIZE; int count = BLOCK_SIZE;
byte[] buffer = new byte[count]; byte[] buffer = new byte[count];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
@ -956,12 +970,13 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
int word_size = 1; int word_size = 1;
int count = BLOCK_SIZE; int count = BLOCK_SIZE;
byte[] buffer = new byte[count]; byte[] buffer = new byte[count];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
for (int offset = 0; offset < count; offset++) { for (int offset = 0; offset < count; offset++) {
@ -1015,13 +1030,14 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = BLOCK_SIZE; int count = BLOCK_SIZE;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Make sure that the memory block is zeroed // Make sure that the memory block is zeroed
fWait.waitReset(); fWait.waitReset();
@ -1076,14 +1092,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = 1; int count = 1;
byte[] pattern = new byte[count]; byte[] pattern = new byte[count];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Unknown context type"; String expected = "Unknown context type";
@ -1140,13 +1157,14 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int count = 1; int count = 1;
byte[] pattern = new byte[1]; byte[] pattern = new byte[1];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Word size not supported (!= 1)"; String expected = "Word size not supported (!= 1)";
@ -1178,14 +1196,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = -1; int count = -1;
byte[] pattern = new byte[1]; byte[] pattern = new byte[1];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Invalid repeat count (< 0)"; String expected = "Invalid repeat count (< 0)";
@ -1210,14 +1229,15 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = 1; int count = 1;
byte[] pattern = new byte[0]; byte[] pattern = new byte[0];
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Perform the test // Perform the test
String expected = "Empty pattern"; String expected = "Empty pattern";
@ -1242,7 +1262,8 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
@ -1251,7 +1272,7 @@ public class MIMemoryTest extends BaseTestCase {
int length = 4; int length = 4;
byte[] pattern = new byte[length]; byte[] pattern = new byte[length];
for (int i = 0; i < length; i++) pattern[i] = (byte) i; for (int i = 0; i < length; i++) pattern[i] = (byte) i;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Ensure that the memory is zeroed // Ensure that the memory is zeroed
fWait.waitReset(); fWait.waitReset();
@ -1302,7 +1323,8 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
@ -1311,7 +1333,7 @@ public class MIMemoryTest extends BaseTestCase {
int length = 4; int length = 4;
byte[] pattern = new byte[length]; byte[] pattern = new byte[length];
for (int i = 0; i < length; i++) pattern[i] = (byte) i; for (int i = 0; i < length; i++) pattern[i] = (byte) i;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Ensure that the memory is zeroed // Ensure that the memory is zeroed
fWait.waitReset(); fWait.waitReset();
@ -1362,7 +1384,8 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is zeroed // Run to the point where the variable is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
@ -1371,7 +1394,7 @@ public class MIMemoryTest extends BaseTestCase {
int length = 4; int length = 4;
byte[] pattern = new byte[length]; byte[] pattern = new byte[length];
for (int i = 0; i < length; i++) pattern[i] = (byte) i; for (int i = 0; i < length; i++) pattern[i] = (byte) i;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Ensure that the memory is zeroed // Ensure that the memory is zeroed
fWait.waitReset(); fWait.waitReset();
@ -1419,12 +1442,13 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the array is zeroed // Run to the point where the array is zeroed
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:zeroBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
int word_size = 1; int word_size = 1;
int count = 1; int count = 1;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Verify asynchronously that all bytes are '0' // Verify asynchronously that all bytes are '0'
fWait.waitReset(); fWait.waitReset();
@ -1481,13 +1505,14 @@ public class MIMemoryTest extends BaseTestCase {
// Run to the point where the variable is initialized // Run to the point where the variable is initialized
SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:setBlocks", true); SyncUtil.SyncAddBreakpoint("MemoryTestApp.cc:setBlocks", true);
SyncUtil.SyncResumeUntilStopped(); SyncUtil.SyncResumeUntilStopped();
SyncUtil.SyncStep(StepType.STEP_RETURN); MIStoppedEvent stoppedEvent = SyncUtil.SyncStep(StepType.STEP_RETURN);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
// Setup call parameters // Setup call parameters
long offset = 0; long offset = 0;
int word_size = 1; int word_size = 1;
int count = BLOCK_SIZE; int count = BLOCK_SIZE;
fBaseAddress = evaluateExpression("&charBlock"); fBaseAddress = evaluateExpression(frameDmc, "&charBlock");
// Get the 'reference' memory block // Get the 'reference' memory block
fWait.waitReset(); fWait.waitReset();

View file

@ -13,6 +13,7 @@ import org.eclipse.dd.dsf.concurrent.ImmediateExecutor;
import org.eclipse.dd.dsf.concurrent.Query; import org.eclipse.dd.dsf.concurrent.Query;
import org.eclipse.dd.dsf.concurrent.RequestMonitor; import org.eclipse.dd.dsf.concurrent.RequestMonitor;
import org.eclipse.dd.dsf.datamodel.CompositeDMContext; import org.eclipse.dd.dsf.datamodel.CompositeDMContext;
import org.eclipse.dd.dsf.datamodel.DMContexts;
import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.service.IFormattedValues;
import org.eclipse.dd.dsf.debug.service.IRegisters; import org.eclipse.dd.dsf.debug.service.IRegisters;
@ -22,12 +23,14 @@ import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMContext;
import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMData; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMData;
import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterGroupDMContext; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterGroupDMContext;
import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterGroupDMData; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterGroupDMData;
import org.eclipse.dd.dsf.debug.service.IRunControl.IContainerDMContext;
import org.eclipse.dd.dsf.debug.service.IRunControl.IExecutionDMContext;
import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext; import org.eclipse.dd.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfServicesTracker;
import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.service.DsfSession;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl;
import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControlDMContext;
import org.eclipse.dd.mi.service.IMIExecutionDMContext; import org.eclipse.dd.mi.service.command.events.MIStoppedEvent;
import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor; import org.eclipse.dd.tests.gdb.framework.AsyncCompletionWaitor;
import org.eclipse.dd.tests.gdb.framework.BackgroundRunner; import org.eclipse.dd.tests.gdb.framework.BackgroundRunner;
import org.eclipse.dd.tests.gdb.framework.BaseTestCase; import org.eclipse.dd.tests.gdb.framework.BaseTestCase;
@ -191,8 +194,8 @@ public class MIRegistersTest extends BaseTestCase {
@Test @Test
public void getRegistersLength() throws Throwable { public void getRegistersLength() throws Throwable {
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
final IRegisterDMContext[] regDMCs = getRegisters(frameDmc); final IRegisterDMContext[] regDMCs = getRegisters(frameDmc);
assertTrue("The number of registers should have been " + NUMBER_OF_REGISTERS + assertTrue("The number of registers should have been " + NUMBER_OF_REGISTERS +
" instead of " + regDMCs.length, " instead of " + regDMCs.length,
@ -202,8 +205,8 @@ public class MIRegistersTest extends BaseTestCase {
@Test @Test
public void getRegisters() throws Throwable { public void getRegisters() throws Throwable {
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
final IRegisterDMContext[] regDMCs = getRegisters(frameDmc); final IRegisterDMContext[] regDMCs = getRegisters(frameDmc);
List<String> regNames = 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"); List<String> regNames = 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");
@ -276,8 +279,8 @@ public class MIRegistersTest extends BaseTestCase {
private static String REGISTER_VALUE = ""; private static String REGISTER_VALUE = "";
@Test @Test
public void getModelDataForRegisterDataValueInDifferentNumberFormats() throws Throwable { public void getModelDataForRegisterDataValueInDifferentNumberFormats() throws Throwable {
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
String val = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 0); String val = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 0);
REGISTER_VALUE = val; REGISTER_VALUE = val;
assertTrue("Register Value is not in NATURAL format " , Integer.parseInt(val)== Integer.parseInt(REGISTER_VALUE)); assertTrue("Register Value is not in NATURAL format " , Integer.parseInt(val)== Integer.parseInt(REGISTER_VALUE));
@ -298,30 +301,32 @@ public class MIRegistersTest extends BaseTestCase {
@Test @Test
public void compareRegisterForMultipleExecutionContexts() throws Throwable { public void compareRegisterForMultipleExecutionContexts() throws Throwable {
SyncUtil.SyncRunToLine(SRC_NAME, "22"); MIStoppedEvent stoppedEvent = SyncUtil.SyncRunToLine(SRC_NAME, "22");
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 2); IContainerDMContext containerDmc = DMContexts.getAncestorOfType(stoppedEvent.getDMContext(), IContainerDMContext.class);
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0);
String thread2RegVal0 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 0);
String thread2RegVal1 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 1);
String thread2RegVal2 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 2);
String thread2RegVal3 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 3);
String thread2RegVal4 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 4);
String thread2RegVal5 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 5);
// Set execution context to 1 // Get execution context to thread 2
execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); IExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(containerDmc, 2);
frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc2 = SyncUtil.SyncGetStackFrame(execDmc, 0);
getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 0);
String thread2RegVal0 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 0);
String thread2RegVal1 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 1);
String thread2RegVal2 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 2);
String thread2RegVal3 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 3);
String thread2RegVal4 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 4);
String thread2RegVal5 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 5);
// Get execution context to thread 1
execDmc = SyncUtil.SyncCreateExecutionContext(containerDmc, 2);
IFrameDMContext frameDmc1 = SyncUtil.SyncGetStackFrame(execDmc, 0);
getModelDataForRegisterDataValue(frameDmc1, IFormattedValues.NATURAL_FORMAT, 0);
// Re-set the execution context to 2 and Fetch from the Cache // Re-set the execution context to 2 and Fetch from the Cache
execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 2); String dupliThread2RegVal0 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 0);
frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); String dupliThread2RegVal1 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 1);
String dupliThread2RegVal0 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 0); String dupliThread2RegVal2 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 2);
String dupliThread2RegVal1 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 1); String dupliThread2RegVal3 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 3);
String dupliThread2RegVal2 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 2); String dupliThread2RegVal4 = getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 4);
String dupliThread2RegVal3 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 3); String dupliThread2RegVal5= getModelDataForRegisterDataValue(frameDmc2, IFormattedValues.NATURAL_FORMAT, 5);
String dupliThread2RegVal4 = getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 4);
String dupliThread2RegVal5= getModelDataForRegisterDataValue(frameDmc, IFormattedValues.NATURAL_FORMAT, 5);
// If Values not equal , then context haven't been re-set properly // If Values not equal , then context haven't been re-set properly
assertTrue("Multiple context not working. Execution Context is not reset to 2", thread2RegVal0.equals(dupliThread2RegVal0)); assertTrue("Multiple context not working. Execution Context is not reset to 2", thread2RegVal0.equals(dupliThread2RegVal0));
@ -360,8 +365,8 @@ public class MIRegistersTest extends BaseTestCase {
@Test @Test
public void writeRegisterNaturalFormat() throws Throwable{ public void writeRegisterNaturalFormat() throws Throwable{
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
String regValue = "10"; String regValue = "10";
int regIndex = 3; int regIndex = 3;
writeRegister(frameDmc, 3, regValue, IFormattedValues.NATURAL_FORMAT); writeRegister(frameDmc, 3, regValue, IFormattedValues.NATURAL_FORMAT);
@ -371,8 +376,8 @@ public class MIRegistersTest extends BaseTestCase {
@Test @Test
public void writeRegisterHEXFormat() throws Throwable{ public void writeRegisterHEXFormat() throws Throwable{
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
String regValue = "0x10"; String regValue = "0x10";
int regIndex = 3; int regIndex = 3;
writeRegister(frameDmc, 3, regValue, IFormattedValues.HEX_FORMAT); writeRegister(frameDmc, 3, regValue, IFormattedValues.HEX_FORMAT);
@ -383,8 +388,8 @@ public class MIRegistersTest extends BaseTestCase {
@Test @Test
@Ignore @Ignore
public void writeRegisterBinaryFormat() throws Throwable{ public void writeRegisterBinaryFormat() throws Throwable{
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
//String regValue = "0100101001"; //String regValue = "0100101001";
String regValue = "10"; String regValue = "10";
int regIndex = 3; int regIndex = 3;
@ -395,8 +400,8 @@ public class MIRegistersTest extends BaseTestCase {
@Test @Test
public void writeRegisterOctalFormat() throws Throwable{ public void writeRegisterOctalFormat() throws Throwable{
IMIExecutionDMContext execDmc = SyncUtil.SyncCreateExecutionContext(fGdbControlDmc, 1); MIStoppedEvent stoppedEvent = getInitialStoppedEvent();
IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(execDmc, 0); IFrameDMContext frameDmc = SyncUtil.SyncGetStackFrame(stoppedEvent.getDMContext(), 0);
//String regValue = "10"; //String regValue = "10";
String regValue = "012"; String regValue = "012";
int regIndex = 3; int regIndex = 3;

View file

@ -43,12 +43,16 @@ public class BaseTestCase {
private static GdbLaunch fLaunch; private static GdbLaunch fLaunch;
private static Map<String, Object> attrs = new HashMap<String, Object>(); private static Map<String, Object> attrs = new HashMap<String, Object>();
private MIStoppedEvent fInitialStoppedEvent = null;
public GdbLaunch getGDBLaunch() { return fLaunch; } public GdbLaunch getGDBLaunch() { return fLaunch; }
public static void setLaunchAttribute(String key, Object value) { public static void setLaunchAttribute(String key, Object value) {
attrs.put(key, value); attrs.put(key, value);
} }
public MIStoppedEvent getInitialStoppedEvent() { return fInitialStoppedEvent; }
@BeforeClass @BeforeClass
public static void baseBeforeClassMethod() { public static void baseBeforeClassMethod() {
// Setup information for the launcher // Setup information for the launcher
@ -93,7 +97,7 @@ public class BaseTestCase {
new ServiceEventWaitor<MIStoppedEvent>( new ServiceEventWaitor<MIStoppedEvent>(
fLaunch.getSession(), fLaunch.getSession(),
MIStoppedEvent.class); MIStoppedEvent.class);
eventWaitor.waitForEvent(10000); fInitialStoppedEvent = eventWaitor.waitForEvent(10000);
} catch (Exception e) {} } catch (Exception e) {}
} }