|
Lines 1238-1243
Link Here
|
| 1238 |
((MIBreakpointHitEvent)event).getNumber() == ref.getReference()); |
1238 |
((MIBreakpointHitEvent)event).getNumber() == ref.getReference()); |
| 1239 |
} |
1239 |
} |
| 1240 |
|
1240 |
|
|
|
1241 |
// ------------------------------------------------------------------------ |
| 1242 |
// insertInvalidBreakpoint_WhileTargetRunning |
| 1243 |
// Set an invalid breakpoint while the target is running, then set a valid |
| 1244 |
// breakpoint and make sure the second breakpoints eventually gets hit. |
| 1245 |
// |
| 1246 |
// We had a problem where an invalid breakpoint set when the target was running |
| 1247 |
// would leave us in a bad state (Bug 314628) |
| 1248 |
// ------------------------------------------------------------------------ |
| 1249 |
@Test |
| 1250 |
public void insertInvalidBreakpoint_WhileTargetRunning() throws Throwable { |
| 1251 |
|
| 1252 |
// Create a line breakpoint |
| 1253 |
Map<String, Object> breakpoint = new HashMap<String, Object>(); |
| 1254 |
breakpoint.put(BREAKPOINT_TYPE_TAG, BREAKPOINT_TAG); |
| 1255 |
breakpoint.put(FILE_NAME_TAG, "Bad file name"); |
| 1256 |
breakpoint.put(LINE_NUMBER_TAG, LINE_NUMBER_5); |
| 1257 |
|
| 1258 |
// Run the program. It will make a two second sleep() call, during which time... |
| 1259 |
SyncUtil.resume(); |
| 1260 |
|
| 1261 |
// ...we install the bad breakpoint and check that it failed |
| 1262 |
insertBreakpoint(fBreakpointsDmc, breakpoint); |
| 1263 |
assertTrue(fWait.getMessage(), !fWait.isOK()); |
| 1264 |
|
| 1265 |
// Now install a proper breakpoint an see that it hits without having to resume |
| 1266 |
// the target. This will show that the target was still properly running. |
| 1267 |
breakpoint.put(FILE_NAME_TAG, SOURCE_FILE); |
| 1268 |
MIBreakpointDMContext ref = (MIBreakpointDMContext) insertBreakpoint(fBreakpointsDmc, breakpoint); |
| 1269 |
|
| 1270 |
// Wait for breakpoint to hit. |
| 1271 |
MIStoppedEvent event = waitForBreakpointEventsAfterBreakpointOperationWhileTargetRunning(true, 2); |
| 1272 |
|
| 1273 |
// Ensure the correct BreakpointEvent was received |
| 1274 |
MIBreakpointDMData breakpoint1 = (MIBreakpointDMData) getBreakpoint(ref); |
| 1275 |
assertTrue("BreakpointEvent problem: expected " + 2 + " BREAKPOINT event(s), received " |
| 1276 |
+ fBreakpointEventCount, fBreakpointEventCount == 2); |
| 1277 |
assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_HIT event(s), received " |
| 1278 |
+ getBreakpointEventCount(BP_HIT), getBreakpointEventCount(BP_HIT) == 1); |
| 1279 |
assertTrue("BreakpointService problem: breakpoint mismatch", |
| 1280 |
fBreakpointRef == breakpoint1.getNumber()); |
| 1281 |
clearEventCounters(); |
| 1282 |
|
| 1283 |
assertTrue("Did not stop because of breakpoint, but stopped because of: " + |
| 1284 |
event.getClass().getCanonicalName(), event instanceof MIBreakpointHitEvent); |
| 1285 |
assertTrue("Did not stop because of the correct breakpoint at line " + LINE_NUMBER_5, |
| 1286 |
((MIBreakpointHitEvent)event).getNumber() == ref.getReference()); |
| 1287 |
} |
| 1288 |
|
| 1241 |
/////////////////////////////////////////////////////////////////////////// |
1289 |
/////////////////////////////////////////////////////////////////////////// |
| 1242 |
// Add Watchpoint tests |
1290 |
// Add Watchpoint tests |
| 1243 |
/////////////////////////////////////////////////////////////////////////// |
1291 |
/////////////////////////////////////////////////////////////////////////// |