1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Trying to fix del break point failure

This commit is contained in:
Alena Laskavaia 2010-05-25 00:10:40 +00:00
parent 43c75ac89f
commit e69005fbaa

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.preference.ListEditor;
/** /**
* @author Peter Graves * @author Peter Graves
@ -396,22 +397,24 @@ public class BreakpointTests extends AbstractDebugTest {
* Make sure deleteBreakpoints works when given 1 breakpoint to delete * Make sure deleteBreakpoints works when given 1 breakpoint to delete
**********************************************************************/ **********************************************************************/
savedbreakpoints = new ICDIBreakpoint[1]; savedbreakpoints = new ICDIBreakpoint[1];
for (int x = 0; x < 10; x++) { int lineStart = 6;
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1); int maxBreakpoints = 5;
for (int x = 0; x < maxBreakpoints; x++) {
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart);
ICDILocationBreakpoint bp = (ICDILocationBreakpoint) cdiTarget.setLineBreakpoint(0, lineLocation, null, false); ICDILocationBreakpoint bp = (ICDILocationBreakpoint) cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
assertNotNull(bp); assertNotNull(bp);
assertEquals(x + 1, (bp.getLocator().getLineNumber())); assertEquals(x + lineStart, (bp.getLocator().getLineNumber()));
savedbreakpoints[0] = bp; savedbreakpoints[0] = bp;
} }
cdiTarget.deleteBreakpoints(savedbreakpoints); cdiTarget.deleteBreakpoints(savedbreakpoints);
pause(); pause();
/* We should now have 9 breakpoints left. */ /* We should now have N-1 breakpoints left. */
breakpoints = cdiTarget.getBreakpoints(); breakpoints = cdiTarget.getBreakpoints();
assertTrue(breakpoints.length == 9); assertTrue(breakpoints.length == maxBreakpoints-1);
/* Make sure we have the correct 9 breakpoints left, we deleted one at line 10 */ /* Make sure we have the correct N-1 breakpoints left, we deleted one at line N */
for (int x = 0; x < breakpoints.length; x++) { for (int x = 0; x < breakpoints.length; x++) {
curbreak = (ICDILocationBreakpoint) breakpoints[x]; curbreak = (ICDILocationBreakpoint) breakpoints[x];
assertNotEquals(10, curbreak.getLocator().getLineNumber()); assertNotEquals(lineStart + x, curbreak.getLocator().getLineNumber());
} }
cdiTarget.deleteAllBreakpoints(); cdiTarget.deleteAllBreakpoints();
pause(); pause();
@ -421,22 +424,22 @@ public class BreakpointTests extends AbstractDebugTest {
* Make sure deleteBreakpoints works when given more then 1 but less * Make sure deleteBreakpoints works when given more then 1 but less
* then all breakpoints to delete * then all breakpoints to delete
**********************************************************************/ **********************************************************************/
savedbreakpoints = new ICDIBreakpoint[4]; savedbreakpoints = new ICDIBreakpoint[2];
for (int x = 0; x < 10; x++) { for (int x = 0; x < maxBreakpoints; x++) {
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1); ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart);
savedbreakpoints[x % 4] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false); savedbreakpoints[x % 2] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
assertNotNull(savedbreakpoints[x % 4]); assertNotNull(savedbreakpoints[x % 2]);
} }
cdiTarget.deleteBreakpoints(savedbreakpoints); cdiTarget.deleteBreakpoints(savedbreakpoints);
pause(); pause();
/* We should now have 6 breakpoints left. */ /* We should now have 6 breakpoints left. */
breakpoints = cdiTarget.getBreakpoints(); breakpoints = cdiTarget.getBreakpoints();
assertTrue(breakpoints.length == 6); assertTrue(breakpoints.length == maxBreakpoints/2);
/* Make sure we have the correct 6 breakpoints left */ /* Make sure we have the correct 6 breakpoints left */
for (int x = 0; x < breakpoints.length; x++) { for (int x = 0; x < breakpoints.length; x++) {
curbreak = (ICDILocationBreakpoint) breakpoints[x]; curbreak = (ICDILocationBreakpoint) breakpoints[x];
assertEquals(x+1, curbreak.getLocator().getLineNumber()); assertEquals(x+lineStart, curbreak.getLocator().getLineNumber());
} }
cdiTarget.deleteAllBreakpoints(); cdiTarget.deleteAllBreakpoints();
pause(); pause();
@ -445,9 +448,9 @@ public class BreakpointTests extends AbstractDebugTest {
/*********************************************************************** /***********************************************************************
* Make sure deleteBreakpoints works when given all the breakpoints * Make sure deleteBreakpoints works when given all the breakpoints
**********************************************************************/ **********************************************************************/
savedbreakpoints = new ICDIBreakpoint[10]; savedbreakpoints = new ICDIBreakpoint[maxBreakpoints];
for (int x = 0; x < 10; x++) { for (int x = 0; x < maxBreakpoints; x++) {
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1); ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart);
savedbreakpoints[x] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false); savedbreakpoints[x] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
assertNotNull(savedbreakpoints[x]); assertNotNull(savedbreakpoints[x]);
} }
@ -461,8 +464,8 @@ public class BreakpointTests extends AbstractDebugTest {
* Make sure deleteAllBreakpoints works * Make sure deleteAllBreakpoints works
**********************************************************************/ **********************************************************************/
for (int x = 0; x < 10; x++) { for (int x = 0; x < maxBreakpoints; x++) {
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1); ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + lineStart);
curbreak = cdiTarget.setLineBreakpoint(0, lineLocation, null, false); curbreak = cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
assertNotNull(curbreak); assertNotNull(curbreak);
} }