mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Fix test changes in CDI
This commit is contained in:
parent
03f49cac54
commit
277bec9a0d
3 changed files with 110 additions and 90 deletions
|
@ -14,7 +14,9 @@ import junit.framework.TestSuite;
|
|||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILineLocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocator;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||
|
@ -166,7 +168,7 @@ public class BreakpointTests extends TestCase {
|
|||
public void testFunctionBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
||||
ICDISession session;
|
||||
ICDITarget cdiTarget;
|
||||
ICDILocation location;
|
||||
ICDIFunctionLocation location;
|
||||
boolean caught = false;
|
||||
session = CDebugHelper.createSession("main", testProject); //$NON-NLS-1$
|
||||
assertNotNull(session);
|
||||
|
@ -180,17 +182,17 @@ public class BreakpointTests extends TestCase {
|
|||
* Create a break point on a generic function
|
||||
**********************************************************************/
|
||||
|
||||
location = cdiTarget.createLocation(null, "func1", 0); //$NON-NLS-1$
|
||||
location = cdiTarget.createFunctionLocation(null, "func1"); //$NON-NLS-1$
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
|
||||
/***********************************************************************
|
||||
* Create a break point on main
|
||||
**********************************************************************/
|
||||
|
||||
location = cdiTarget.createLocation(null, "main", 0); //$NON-NLS-1$
|
||||
location = cdiTarget.createFunctionLocation(null, "main"); //$NON-NLS-1$
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
|
||||
/***********************************************************************
|
||||
* Try to create a break point on a function name that does not exist We
|
||||
|
@ -198,10 +200,10 @@ public class BreakpointTests extends TestCase {
|
|||
* CDIException
|
||||
**********************************************************************/
|
||||
|
||||
location = cdiTarget.createLocation(null, "badname", 0); //$NON-NLS-1$
|
||||
location = cdiTarget.createFunctionLocation(null, "badname"); //$NON-NLS-1$
|
||||
assertNotNull(location);
|
||||
try {
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
} catch (CDIException e) {
|
||||
caught = true;
|
||||
}
|
||||
|
@ -214,9 +216,9 @@ public class BreakpointTests extends TestCase {
|
|||
* and stop program execution.
|
||||
**********************************************************************/
|
||||
|
||||
location = cdiTarget.createLocation(null, "func1", 0); //$NON-NLS-1$
|
||||
location = cdiTarget.createFunctionLocation(null, "func1"); //$NON-NLS-1$
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
targets = session.getTargets();
|
||||
/*
|
||||
* We better only have one target connected to this session or something
|
||||
|
@ -239,10 +241,10 @@ public class BreakpointTests extends TestCase {
|
|||
Thread.sleep(100);
|
||||
}
|
||||
assertTrue(targets[0].isSuspended());
|
||||
location = targets[0].getCurrentThread().getStackFrames()[0].getLocation();
|
||||
assertTrue(location.getLineNumber() == 6);
|
||||
assertTrue(location.getFunction().equals("func1")); //$NON-NLS-1$
|
||||
assertTrue(location.getFile().equals("main.c")); //$NON-NLS-1$
|
||||
ICDILocator locator = targets[0].getCurrentThread().getStackFrames()[0].getLocator();
|
||||
assertTrue(locator.getLineNumber() == 6);
|
||||
assertTrue(locator.getFunction().equals("func1")); //$NON-NLS-1$
|
||||
assertTrue(locator.getFile().equals("main.c")); //$NON-NLS-1$
|
||||
|
||||
/* clean up the session */
|
||||
targets[0].terminate();
|
||||
|
@ -264,7 +266,7 @@ public class BreakpointTests extends TestCase {
|
|||
*/
|
||||
public void testLineBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
||||
ICDITarget cdiTarget;
|
||||
ICDILocation location;
|
||||
ICDILineLocation location;
|
||||
boolean caught = false;
|
||||
session = CDebugHelper.createSession("main", testProject);
|
||||
assertNotNull(session);
|
||||
|
@ -277,16 +279,16 @@ public class BreakpointTests extends TestCase {
|
|||
/***********************************************************************
|
||||
* Create a break point in a generic function
|
||||
**********************************************************************/
|
||||
location = cdiTarget.createLocation("main.c", null, 7);
|
||||
location = cdiTarget.createLineLocation("main.c", 7);
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setLineBreakpoint(0, location, null, false);
|
||||
|
||||
/***********************************************************************
|
||||
* Create a break point in main
|
||||
**********************************************************************/
|
||||
location = cdiTarget.createLocation("main.c", null, 18);
|
||||
location = cdiTarget.createLineLocation("main.c", 18);
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setLineBreakpoint(0, location, null, false);
|
||||
|
||||
/***********************************************************************
|
||||
* Try to create a break point on a line that does not exist We expect
|
||||
|
@ -294,10 +296,10 @@ public class BreakpointTests extends TestCase {
|
|||
* CDIException
|
||||
**********************************************************************/
|
||||
|
||||
location = cdiTarget.createLocation("main.c", null, 30);
|
||||
location = cdiTarget.createLineLocation("main.c", 30);
|
||||
assertNotNull(location);
|
||||
try {
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setLineBreakpoint(0, location, null, false);
|
||||
} catch (CDIException e) {
|
||||
caught = true;
|
||||
}
|
||||
|
@ -308,9 +310,9 @@ public class BreakpointTests extends TestCase {
|
|||
* Try to create a break point on a line that does not have code on it
|
||||
**********************************************************************/
|
||||
|
||||
location = cdiTarget.createLocation("main.c", null, 11);
|
||||
location = cdiTarget.createLineLocation("main.c", 11);
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setLineBreakpoint(0, location, null, false);
|
||||
|
||||
/***********************************************************************
|
||||
* Create a break point in a generic function without passing the source
|
||||
|
@ -319,14 +321,14 @@ public class BreakpointTests extends TestCase {
|
|||
* and once with an invalid line number, and the first should always
|
||||
* succeed and the second should always throw an exception.
|
||||
**********************************************************************/
|
||||
location = cdiTarget.createLocation(null, null, 7);
|
||||
location = cdiTarget.createLineLocation(null, 7);
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setLineBreakpoint(0, location, null, false);
|
||||
caught = false;
|
||||
location = cdiTarget.createLocation(null, null, 30);
|
||||
location = cdiTarget.createLineLocation(null, 30);
|
||||
assertNotNull(location);
|
||||
try {
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setLineBreakpoint(0, location, null, false);
|
||||
} catch (CDIException e) {
|
||||
caught = true;
|
||||
}
|
||||
|
@ -339,9 +341,9 @@ public class BreakpointTests extends TestCase {
|
|||
* stop program execution.
|
||||
**********************************************************************/
|
||||
|
||||
location = cdiTarget.createLocation(null, null, 7);
|
||||
location = cdiTarget.createLineLocation(null, 7);
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setLineBreakpoint(0, location, null, false);
|
||||
targets = session.getTargets();
|
||||
/*
|
||||
* We better only have one target connected to this session or something
|
||||
|
@ -365,10 +367,10 @@ public class BreakpointTests extends TestCase {
|
|||
}
|
||||
assertTrue("Suspended: " + targets[0].isSuspended() + " Termiunated: " + targets[0].isTerminated(), targets[0]
|
||||
.isSuspended());
|
||||
location = targets[0].getCurrentThread().getStackFrames()[0].getLocation();
|
||||
assertTrue(location.getLineNumber() == 7);
|
||||
assertTrue(location.getFunction().equals("func1"));
|
||||
assertTrue(location.getFile().equals("main.c"));
|
||||
ICDILocator locator = targets[0].getCurrentThread().getStackFrames()[0].getLocator();
|
||||
assertTrue(locator.getLineNumber() == 7);
|
||||
assertTrue(locator.getFunction().equals("func1"));
|
||||
assertTrue(locator.getFile().equals("main.c"));
|
||||
|
||||
/* clean up the session */
|
||||
session.terminate();
|
||||
|
@ -382,7 +384,7 @@ public class BreakpointTests extends TestCase {
|
|||
*/
|
||||
public void testGetBreak() throws CoreException, MIException, IOException, CDIException {
|
||||
ICDITarget cdiTarget;
|
||||
ICDILocation location;
|
||||
ICDIFunctionLocation location;
|
||||
ICDIBreakpoint[] breakpoints;
|
||||
ICDILocationBreakpoint curbreak;
|
||||
session = CDebugHelper.createSession("main", testProject);
|
||||
|
@ -405,9 +407,9 @@ public class BreakpointTests extends TestCase {
|
|||
* from the system
|
||||
**********************************************************************/
|
||||
/* Create a break point on a generic function */
|
||||
location = cdiTarget.createLocation("main.c", "func1", 0);
|
||||
location = cdiTarget.createFunctionLocation("main.c", "func1");
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
|
||||
breakpoints = cdiTarget.getBreakpoints();
|
||||
assertNotNull(breakpoints);
|
||||
|
@ -418,16 +420,23 @@ public class BreakpointTests extends TestCase {
|
|||
curbreak = null;
|
||||
assertNotNull(curbreak);
|
||||
|
||||
assertTrue(curbreak.getLocation().equals(location));
|
||||
//assertTrue(curbreak.getLocator().equals(location));
|
||||
{
|
||||
ICDILocator locator = curbreak.getLocator();
|
||||
String file = locator.getFile();
|
||||
String function = locator.getFunction();
|
||||
assertTrue("main.c".equals(file));
|
||||
assertTrue("func1".equals(function));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Make sure if we create multiple break points that we can still get
|
||||
* them all back from the system,
|
||||
**********************************************************************/
|
||||
/* Create another break point on main */
|
||||
location = cdiTarget.createLocation("main.c", "main", 0);
|
||||
location = cdiTarget.createFunctionLocation("main.c", "main");
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
|
||||
breakpoints = cdiTarget.getBreakpoints();
|
||||
assertNotNull(breakpoints);
|
||||
|
@ -440,7 +449,14 @@ public class BreakpointTests extends TestCase {
|
|||
/*
|
||||
* Make sure the location still looks like we expect it to.. .
|
||||
*/
|
||||
assertTrue(curbreak.getLocation().equals(location));
|
||||
//assertTrue(curbreak.getLocation().equals(location));
|
||||
{
|
||||
ICDILocator locator = curbreak.getLocator();
|
||||
String file = locator.getFile();
|
||||
String function = locator.getFunction();
|
||||
assertTrue("main.c".equals(file));
|
||||
assertTrue("main".equals(function));
|
||||
}
|
||||
|
||||
cdiTarget.deleteAllBreakpoints();
|
||||
|
||||
|
@ -455,7 +471,8 @@ public class BreakpointTests extends TestCase {
|
|||
*/
|
||||
public void testDelBreak() throws CoreException, MIException, IOException, CDIException {
|
||||
ICDITarget cdiTarget;
|
||||
ICDILocation location, savedLocation;
|
||||
ICDIFunctionLocation location;
|
||||
ICDILocator savedLocation;
|
||||
ICDIBreakpoint[] breakpoints, savedbreakpoints;
|
||||
ICDILocationBreakpoint curbreak;
|
||||
|
||||
|
@ -480,9 +497,9 @@ public class BreakpointTests extends TestCase {
|
|||
**********************************************************************/
|
||||
|
||||
/* Create a break point on a generic function */
|
||||
location = cdiTarget.createLocation("main.c", "func1", 0);
|
||||
location = cdiTarget.createFunctionLocation("main.c", "func1");
|
||||
assertNotNull(location);
|
||||
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
curbreak = cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } );
|
||||
pause();
|
||||
/**
|
||||
|
@ -499,14 +516,14 @@ public class BreakpointTests extends TestCase {
|
|||
**********************************************************************/
|
||||
|
||||
/* Create a break point on a generic function */
|
||||
location = cdiTarget.createLocation("main.c", "func1", 0);
|
||||
location = cdiTarget.createFunctionLocation("main.c", "func1");
|
||||
assertNotNull(location);
|
||||
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
savedLocation = curbreak.getLocation();
|
||||
curbreak = cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
savedLocation = curbreak.getLocator();
|
||||
|
||||
location = cdiTarget.createLocation("main.c", "main", 0);
|
||||
location = cdiTarget.createFunctionLocation("main.c", "main");
|
||||
assertNotNull(location);
|
||||
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
curbreak = cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } );
|
||||
pause();
|
||||
breakpoints = cdiTarget.getBreakpoints();
|
||||
|
@ -516,7 +533,7 @@ public class BreakpointTests extends TestCase {
|
|||
assertTrue(breakpoints.length == 1);
|
||||
curbreak = (ICDILocationBreakpoint) breakpoints[0];
|
||||
assertNotNull(curbreak);
|
||||
assertTrue(curbreak.getLocation().equals(savedLocation));
|
||||
assertTrue(curbreak.getLocator().equals(savedLocation));
|
||||
/***********************************************************************
|
||||
* Then delete the other breakpoint.
|
||||
*/
|
||||
|
@ -530,8 +547,8 @@ public class BreakpointTests extends TestCase {
|
|||
**********************************************************************/
|
||||
savedbreakpoints = new ICDIBreakpoint[1];
|
||||
for (int x = 0; x < 10; x++) {
|
||||
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||
savedbreakpoints[0] = cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1);
|
||||
savedbreakpoints[0] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
|
||||
assertNotNull(savedbreakpoints[0]);
|
||||
}
|
||||
cdiTarget.deleteBreakpoints(savedbreakpoints);
|
||||
|
@ -542,7 +559,7 @@ public class BreakpointTests extends TestCase {
|
|||
/* Make sure we have the correct 9 breakpoints left */
|
||||
for (int x = 0; x < breakpoints.length; x++) {
|
||||
curbreak = (ICDILocationBreakpoint) breakpoints[x];
|
||||
assertTrue(curbreak.getLocation().getLineNumber() == x + 1);
|
||||
assertTrue(curbreak.getLocator().getLineNumber() == x + 1);
|
||||
}
|
||||
cdiTarget.deleteAllBreakpoints();
|
||||
pause();
|
||||
|
@ -554,8 +571,8 @@ public class BreakpointTests extends TestCase {
|
|||
**********************************************************************/
|
||||
savedbreakpoints = new ICDIBreakpoint[4];
|
||||
for (int x = 0; x < 10; x++) {
|
||||
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||
savedbreakpoints[x % 4] = cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1);
|
||||
savedbreakpoints[x % 4] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
|
||||
assertNotNull(savedbreakpoints[x % 4]);
|
||||
}
|
||||
cdiTarget.deleteBreakpoints(savedbreakpoints);
|
||||
|
@ -567,7 +584,7 @@ public class BreakpointTests extends TestCase {
|
|||
/* Make sure we have the correct 6 breakpoints left */
|
||||
for (int x = 0; x < breakpoints.length; x++) {
|
||||
curbreak = (ICDILocationBreakpoint) breakpoints[x];
|
||||
assertTrue(curbreak.getLocation().getLineNumber() == x + 1);
|
||||
assertTrue(curbreak.getLocator().getLineNumber() == x + 1);
|
||||
}
|
||||
cdiTarget.deleteAllBreakpoints();
|
||||
pause();
|
||||
|
@ -578,8 +595,8 @@ public class BreakpointTests extends TestCase {
|
|||
**********************************************************************/
|
||||
savedbreakpoints = new ICDIBreakpoint[10];
|
||||
for (int x = 0; x < 10; x++) {
|
||||
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||
savedbreakpoints[x] = cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1);
|
||||
savedbreakpoints[x] = cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
|
||||
assertNotNull(savedbreakpoints[x]);
|
||||
}
|
||||
cdiTarget.deleteBreakpoints(savedbreakpoints);
|
||||
|
@ -593,8 +610,8 @@ public class BreakpointTests extends TestCase {
|
|||
**********************************************************************/
|
||||
|
||||
for (int x = 0; x < 10; x++) {
|
||||
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
ICDILineLocation lineLocation = cdiTarget.createLineLocation("main.c", x + 1);
|
||||
curbreak = cdiTarget.setLineBreakpoint(0, lineLocation, null, false);
|
||||
assertNotNull(curbreak);
|
||||
}
|
||||
cdiTarget.deleteAllBreakpoints();
|
||||
|
@ -627,27 +644,27 @@ public class BreakpointTests extends TestCase {
|
|||
* Create a break point on a generic function with an empty condition
|
||||
**********************************************************************/
|
||||
ICDICondition cond = cdiTarget.createCondition(0, "");
|
||||
ICDILocation location = cdiTarget.createLocation(null, "func1", 0);
|
||||
ICDIFunctionLocation location = cdiTarget.createFunctionLocation(null, "func1");
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, cond, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, cond, false);
|
||||
|
||||
/***********************************************************************
|
||||
* Create a break point on a generic function with an valid condition
|
||||
**********************************************************************/
|
||||
cond = cdiTarget.createCondition(0, "x<10");
|
||||
location = cdiTarget.createLocation(null, "func1", 0);
|
||||
location = cdiTarget.createFunctionLocation(null, "func1");
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, cond, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, cond, false);
|
||||
|
||||
/***********************************************************************
|
||||
* Create a break point on a generic function with an invalid condition
|
||||
* We expect to get a CDIException when we try to set the breakpoint.
|
||||
**********************************************************************/
|
||||
cond = cdiTarget.createCondition(0, "nonexist<10");
|
||||
location = cdiTarget.createLocation(null, "func1", 0);
|
||||
location = cdiTarget.createFunctionLocation(null, "func1");
|
||||
assertNotNull(location);
|
||||
try {
|
||||
cdiTarget.setLocationBreakpoint(0, location, cond, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, cond, false);
|
||||
} catch (CDIException e) {
|
||||
caught = true;
|
||||
}
|
||||
|
@ -659,11 +676,11 @@ public class BreakpointTests extends TestCase {
|
|||
* is true
|
||||
**********************************************************************/
|
||||
cdiTarget.deleteAllBreakpoints();
|
||||
location = cdiTarget.createLocation(null, null, 23);
|
||||
ICDILineLocation lineLocation = cdiTarget.createLineLocation(null, 23);
|
||||
assertNotNull(location);
|
||||
cond = cdiTarget.createCondition(0, "a>10");
|
||||
|
||||
cdiTarget.setLocationBreakpoint(0, location, cond, false);
|
||||
cdiTarget.setLineBreakpoint(0, lineLocation, cond, false);
|
||||
targets = session.getTargets();
|
||||
/*
|
||||
* We better only have one target connected to this session or something
|
||||
|
@ -688,10 +705,10 @@ public class BreakpointTests extends TestCase {
|
|||
assertTrue("Suspended: " + targets[0].isSuspended() + " Termiunated: " + targets[0].isTerminated(), targets[0]
|
||||
.isSuspended());
|
||||
ICDIStackFrame frame = targets[0].getCurrentThread().getStackFrames()[0];
|
||||
location = frame.getLocation();
|
||||
assertTrue(location.getLineNumber() == 23);
|
||||
assertTrue(location.getFunction().equals("main"));
|
||||
assertTrue(location.getFile().equals("main.c"));
|
||||
ICDILocator locator = frame.getLocator();
|
||||
assertTrue(locator.getLineNumber() == 23);
|
||||
assertTrue(locator.getFunction().equals("main"));
|
||||
assertTrue(locator.getFile().equals("main.c"));
|
||||
/* Get the value of a and and make sure it is 11 */
|
||||
assertTrue(targets[0].evaluateExpressionToString(frame, "a"), targets[0].evaluateExpressionToString(frame, "a").equals("11"));
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import junit.framework.TestCase;
|
|||
import junit.framework.TestSuite;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
|
@ -116,7 +117,7 @@ public class DebugTests extends TestCase {
|
|||
*/
|
||||
public void testDebug() throws CoreException, MIException, IOException, CDIException {
|
||||
ICDITarget cdiTarget;
|
||||
ICDILocation location;
|
||||
ICDIFunctionLocation location;
|
||||
|
||||
session=CDebugHelper.createSession("main",testProject);
|
||||
assertNotNull(session);
|
||||
|
@ -125,9 +126,9 @@ public class DebugTests extends TestCase {
|
|||
assertTrue(targets.length > 0);
|
||||
cdiTarget = targets[0];
|
||||
assertNotNull(cdiTarget);
|
||||
location=cdiTarget.createLocation(null, "func1", 0);
|
||||
location=cdiTarget.createFunctionLocation(null, "func1");
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
cdiTarget.setFunctionBreakpoint(0, location, null, false);
|
||||
cdiTarget.resume();
|
||||
session.terminate();
|
||||
session=null;
|
||||
|
|
|
@ -12,7 +12,8 @@ import junit.framework.TestCase;
|
|||
import junit.framework.TestSuite;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDILineLocation;
|
||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||
|
@ -115,7 +116,8 @@ public class LocationTests extends TestCase {
|
|||
*/
|
||||
public void testIsEquals() throws CoreException, MIException, IOException, CDIException {
|
||||
ICDITarget cdiTarget;
|
||||
ICDILocation location, location2;
|
||||
ICDILineLocation lineLocation, lineLocation2;
|
||||
ICDIFunctionLocation functionLocation, functionLocation2;
|
||||
ICDIBreakpoint[] breakpoints;
|
||||
ICDILocationBreakpoint curbreak;
|
||||
session=CDebugHelper.createSession("main",testProject);
|
||||
|
@ -129,15 +131,15 @@ public class LocationTests extends TestCase {
|
|||
/**********************************************************************
|
||||
* Simple test.. this should work.
|
||||
**********************************************************************/
|
||||
location=cdiTarget.createLocation("main.c", "func1", 0);
|
||||
location2=cdiTarget.createLocation("main.c", "func1", 0);
|
||||
assertTrue(location.equals(location2));
|
||||
functionLocation=cdiTarget.createFunctionLocation("main.c", "func1");
|
||||
functionLocation2=cdiTarget.createFunctionLocation("main.c", "func1");
|
||||
assertTrue(functionLocation.equals(functionLocation2));
|
||||
/**********************************************************************
|
||||
* Simple test.. this should work.
|
||||
**********************************************************************/
|
||||
location=cdiTarget.createLocation("main.c", null, 10);
|
||||
location2=cdiTarget.createLocation("main.c", null, 10);
|
||||
assertTrue(location.equals(location2));
|
||||
lineLocation=cdiTarget.createLineLocation("main.c", 10);
|
||||
lineLocation2=cdiTarget.createLineLocation("main.c", 10);
|
||||
assertTrue(lineLocation.equals(lineLocation2));
|
||||
|
||||
/**********************************************************************
|
||||
* make sure that the location returned from getLocation on the
|
||||
|
@ -145,9 +147,9 @@ public class LocationTests extends TestCase {
|
|||
* setLocationBreakpoint is the same as the breakpoint returned from
|
||||
* BreakpointManager.getBreakpoints.getLocation()
|
||||
**********************************************************************/
|
||||
location=cdiTarget.createLocation("main.c", "func1", 0);
|
||||
assertNotNull(location);
|
||||
location2=cdiTarget.setLocationBreakpoint(0, location, null, false).getLocation();
|
||||
functionLocation=cdiTarget.createFunctionLocation("main.c", "func1");
|
||||
assertNotNull(functionLocation);
|
||||
functionLocation2=cdiTarget.setFunctionBreakpoint(0, functionLocation, null, false).getLocator();
|
||||
|
||||
breakpoints=cdiTarget.getBreakpoints();
|
||||
assertNotNull(breakpoints);
|
||||
|
@ -158,15 +160,15 @@ public class LocationTests extends TestCase {
|
|||
curbreak=null;
|
||||
assertNotNull(curbreak);
|
||||
|
||||
assertTrue(curbreak.getLocation().equals(location2));
|
||||
assertTrue(curbreak.getLocator().equals(functionLocation2));
|
||||
cdiTarget.deleteAllBreakpoints();
|
||||
/* Create a break point on a generic function with a file name that
|
||||
* gdb will change to the relitive path of the source file. This
|
||||
* should work, but at the time of writing (Sept 25, 2002) does not.
|
||||
*/
|
||||
location=cdiTarget.createLocation("main.c", "func1", 0);
|
||||
assertNotNull(location);
|
||||
cdiTarget.setLocationBreakpoint(0, location, null, false);
|
||||
functionLocation=cdiTarget.createFunctionLocation("main.c", "func1");
|
||||
assertNotNull(functionLocation);
|
||||
cdiTarget.setFunctionBreakpoint(0, functionLocation, null, false);
|
||||
|
||||
breakpoints=cdiTarget.getBreakpoints();
|
||||
assertNotNull(breakpoints);
|
||||
|
@ -177,7 +179,7 @@ public class LocationTests extends TestCase {
|
|||
curbreak=null;
|
||||
assertNotNull(curbreak);
|
||||
|
||||
assertTrue("PR:23879",curbreak.getLocation().equals(location));
|
||||
assertTrue("PR:23879",curbreak.getLocator().equals(functionLocation));
|
||||
|
||||
|
||||
/* clean up the session */
|
||||
|
|
Loading…
Add table
Reference in a new issue