Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 314628 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/cdt/dsf/gdb/service/GDBRunControl_7_0_NS.java (+5 lines)
Lines 994-999 Link Here
994
				rm.done();
994
				rm.done();
995
			}
995
			}
996
		}
996
		}
997
		@Override
998
		public void rollBack(RequestMonitor rm) {
999
		    Sequence.Step restoreStep = new RestoreTargetStateStep();
1000
		    restoreStep.execute(rm);
1001
		}
997
	};
1002
	};
998
1003
999
	/**
1004
	/**
(-)src/org/eclipse/cdt/dsf/mi/service/IMIRunControl.java (-1 / +1 lines)
Lines 28-34 Link Here
28
	 * to receive commands.  Once the specified steps are executed, the target should be
28
	 * to receive commands.  Once the specified steps are executed, the target should be
29
	 * returned to its original availability.
29
	 * returned to its original availability.
30
	 * 
30
	 * 
31
	 * This can is of value for breakpoints commands; e.g., breakpoints need to be inserted
31
	 * This is of value for breakpoints commands; e.g., breakpoints need to be inserted
32
	 * even when the target is running, so this call would suspend the target, insert the
32
	 * even when the target is running, so this call would suspend the target, insert the
33
	 * breakpoint, and resume the target again.
33
	 * breakpoint, and resume the target again.
34
	 * 
34
	 * 
(-)src/org/eclipse/cdt/dsf/mi/service/MIRunControl.java (+5 lines)
Lines 1012-1017 Link Here
1012
				rm.done();
1012
				rm.done();
1013
			}
1013
			}
1014
		}
1014
		}
1015
		@Override
1016
		public void rollBack(RequestMonitor rm) {
1017
		    Sequence.Step restoreStep = new RestoreTargetStateStep();
1018
		    restoreStep.execute(rm);
1019
		}
1015
	};
1020
	};
1016
1021
1017
	/**
1022
	/**
(-)src/org/eclipse/cdt/tests/dsf/gdb/tests/MIBreakpointsTest.java (+48 lines)
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
	///////////////////////////////////////////////////////////////////////////

Return to bug 314628