mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-09 19:43:27 +02:00
Moved to the new breakpoint management API.
This commit is contained in:
parent
e452d260ff
commit
a315994318
6 changed files with 145 additions and 145 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2004-09-07 Mikhail Khodjaiants
|
||||||
|
Moved to the new breakpoint management API.
|
||||||
|
* CBreakpointManager.java
|
||||||
|
|
||||||
2004-09-07 Alain Magloire
|
2004-09-07 Alain Magloire
|
||||||
New interfaces to Target.
|
New interfaces to Target.
|
||||||
* ICDITarget.java
|
* ICDITarget.java
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
||||||
|
@ -30,6 +29,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
|
||||||
|
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
|
||||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||||
|
@ -160,8 +160,8 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
fDebugTarget = target;
|
fDebugTarget = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICDIBreakpointManager getCDIBreakpointManager() {
|
protected ICDITarget getCDITarget() {
|
||||||
return getDebugTarget().getCDISession().getBreakpointManager();
|
return getDebugTarget().getCDITarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICSourceLocator getCSourceLocator() {
|
protected ICSourceLocator getCSourceLocator() {
|
||||||
|
@ -314,9 +314,9 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
protected void doRemoveBreakpoint( ICBreakpoint breakpoint ) throws DebugException {
|
protected void doRemoveBreakpoint( ICBreakpoint breakpoint ) throws DebugException {
|
||||||
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
|
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
|
||||||
if ( cdiBreakpoint != null ) {
|
if ( cdiBreakpoint != null ) {
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
try {
|
try {
|
||||||
bm.deleteBreakpoints( new ICDIBreakpoint[]{ cdiBreakpoint } );
|
cdiTarget.deleteBreakpoints( new ICDIBreakpoint[]{ cdiBreakpoint } );
|
||||||
breakpoint.removeTargetFilter( getDebugTarget() );
|
breakpoint.removeTargetFilter( getDebugTarget() );
|
||||||
}
|
}
|
||||||
catch( CDIException e ) {
|
catch( CDIException e ) {
|
||||||
|
@ -336,7 +336,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
|
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
|
||||||
if ( cdiBreakpoint == null )
|
if ( cdiBreakpoint == null )
|
||||||
return;
|
return;
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
try {
|
try {
|
||||||
boolean enabled = breakpoint.isEnabled();
|
boolean enabled = breakpoint.isEnabled();
|
||||||
boolean oldEnabled = delta.getAttribute( IBreakpoint.ENABLED, true );
|
boolean oldEnabled = delta.getAttribute( IBreakpoint.ENABLED, true );
|
||||||
|
@ -348,7 +348,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
cdiBreakpoint.setEnabled( enabled );
|
cdiBreakpoint.setEnabled( enabled );
|
||||||
}
|
}
|
||||||
if ( ignoreCount != oldIgnoreCount || !condition.equals( oldCondition ) ) {
|
if ( ignoreCount != oldIgnoreCount || !condition.equals( oldCondition ) ) {
|
||||||
ICDICondition cdiCondition = bm.createCondition( ignoreCount, condition );
|
ICDICondition cdiCondition = cdiTarget.createCondition( ignoreCount, condition );
|
||||||
cdiBreakpoint.setCondition( cdiCondition );
|
cdiBreakpoint.setCondition( cdiCondition );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -452,10 +452,10 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
|
|
||||||
private void removeAllBreakpoints() {
|
private void removeAllBreakpoints() {
|
||||||
ICDIBreakpoint[] cdiBreakpoints = getBreakpointMap().getAllCDIBreakpoints();
|
ICDIBreakpoint[] cdiBreakpoints = getBreakpointMap().getAllCDIBreakpoints();
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
if ( cdiBreakpoints.length > 0 ) {
|
if ( cdiBreakpoints.length > 0 ) {
|
||||||
try {
|
try {
|
||||||
bm.deleteBreakpoints( cdiBreakpoints );
|
cdiTarget.deleteBreakpoints( cdiBreakpoints );
|
||||||
}
|
}
|
||||||
catch( CDIException e ) {
|
catch( CDIException e ) {
|
||||||
CDebugCorePlugin.log( e.getMessage() );
|
CDebugCorePlugin.log( e.getMessage() );
|
||||||
|
@ -473,49 +473,49 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICDIBreakpoint setFunctionBreakpoint( ICFunctionBreakpoint breakpoint ) throws CDIException, CoreException {
|
private ICDIBreakpoint setFunctionBreakpoint( ICFunctionBreakpoint breakpoint ) throws CDIException, CoreException {
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
String function = breakpoint.getFunction();
|
String function = breakpoint.getFunction();
|
||||||
String fileName = (function != null && function.indexOf( "::" ) == -1) ? breakpoint.getFileName() : null; //$NON-NLS-1$
|
String fileName = (function != null && function.indexOf( "::" ) == -1) ? breakpoint.getFileName() : null; //$NON-NLS-1$
|
||||||
ICDILocation location = bm.createLocation( fileName, function, -1 );
|
ICDILocation location = cdiTarget.createLocation( fileName, function, -1 );
|
||||||
ICDIBreakpoint cdiBreakpoint = null;
|
ICDIBreakpoint cdiBreakpoint = null;
|
||||||
synchronized ( getBreakpointMap() ) {
|
synchronized ( getBreakpointMap() ) {
|
||||||
cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
||||||
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
||||||
}
|
}
|
||||||
return cdiBreakpoint;
|
return cdiBreakpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
|
private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) );
|
ICDILocation location = cdiTarget.createLocation( Long.parseLong( breakpoint.getAddress() ) );
|
||||||
ICDIBreakpoint cdiBreakpoint = null;
|
ICDIBreakpoint cdiBreakpoint = null;
|
||||||
synchronized ( getBreakpointMap() ) {
|
synchronized ( getBreakpointMap() ) {
|
||||||
cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
||||||
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
||||||
}
|
}
|
||||||
return cdiBreakpoint;
|
return cdiBreakpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICDIBreakpoint setLineBreakpoint( ICLineBreakpoint breakpoint ) throws CDIException, CoreException {
|
private ICDIBreakpoint setLineBreakpoint( ICLineBreakpoint breakpoint ) throws CDIException, CoreException {
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
|
ICDILocation location = cdiTarget.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
|
||||||
ICDIBreakpoint cdiBreakpoint = null;
|
ICDIBreakpoint cdiBreakpoint = null;
|
||||||
synchronized ( getBreakpointMap() ) {
|
synchronized ( getBreakpointMap() ) {
|
||||||
cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
||||||
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
||||||
}
|
}
|
||||||
return cdiBreakpoint;
|
return cdiBreakpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICDIBreakpoint setWatchpoint( ICWatchpoint watchpoint ) throws CDIException, CoreException {
|
private ICDIBreakpoint setWatchpoint( ICWatchpoint watchpoint ) throws CDIException, CoreException {
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
int accessType = 0;
|
int accessType = 0;
|
||||||
accessType |= (watchpoint.isWriteType()) ? ICDIWatchpoint.WRITE : 0;
|
accessType |= (watchpoint.isWriteType()) ? ICDIWatchpoint.WRITE : 0;
|
||||||
accessType |= (watchpoint.isReadType()) ? ICDIWatchpoint.READ : 0;
|
accessType |= (watchpoint.isReadType()) ? ICDIWatchpoint.READ : 0;
|
||||||
String expression = watchpoint.getExpression();
|
String expression = watchpoint.getExpression();
|
||||||
ICDIWatchpoint cdiWatchpoint = null;
|
ICDIWatchpoint cdiWatchpoint = null;
|
||||||
synchronized ( getBreakpointMap() ) {
|
synchronized ( getBreakpointMap() ) {
|
||||||
cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, null );
|
cdiWatchpoint = cdiTarget.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, null );
|
||||||
getBreakpointMap().put( watchpoint, cdiWatchpoint );
|
getBreakpointMap().put( watchpoint, cdiWatchpoint );
|
||||||
}
|
}
|
||||||
return cdiWatchpoint;
|
return cdiWatchpoint;
|
||||||
|
@ -523,8 +523,8 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
|
|
||||||
private void setBreakpointCondition( ICBreakpoint breakpoint ) throws CoreException, CDIException {
|
private void setBreakpointCondition( ICBreakpoint breakpoint ) throws CoreException, CDIException {
|
||||||
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
|
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
|
||||||
ICDIBreakpointManager bm = getCDIBreakpointManager();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
|
ICDICondition condition = cdiTarget.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
|
||||||
cdiBreakpoint.setCondition( condition );
|
cdiBreakpoint.setCondition( condition );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2004-09-07 Mikhail Khodjaiants
|
||||||
|
Moved to the new breakpoint management API.
|
||||||
|
* core/org/eclipse/cdt/debug/core/tests/BreakpointTests.java
|
||||||
|
* core/org/eclipse/cdt/debug/core/tests/DebugTests.java
|
||||||
|
* core/org/eclipse/cdt/debug/core/tests/LocationTests.java
|
||||||
|
|
||||||
2003-07-03 Peter Graves
|
2003-07-03 Peter Graves
|
||||||
|
|
||||||
Major cleanup. Pulled all resouces out of the source tree, and fixed the
|
Major cleanup. Pulled all resouces out of the source tree, and fixed the
|
||||||
|
|
|
@ -7,15 +7,12 @@ package org.eclipse.cdt.debug.core.tests;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import junit.extensions.TestSetup;
|
import junit.extensions.TestSetup;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
|
@ -167,29 +164,29 @@ public class BreakpointTests extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testFunctionBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
public void testFunctionBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
||||||
ICDISession session;
|
ICDISession session;
|
||||||
ICDIBreakpointManager breaks;
|
ICDITarget cdiTarget;
|
||||||
ICDILocation location;
|
ICDILocation location;
|
||||||
boolean caught = false;
|
boolean caught = false;
|
||||||
session = CDebugHelper.createSession("main", testProject);
|
session = CDebugHelper.createSession("main", testProject);
|
||||||
assertNotNull(session);
|
assertNotNull(session);
|
||||||
breaks = session.getBreakpointManager();
|
cdiTarget = session.getCurrentTarget();
|
||||||
assertNotNull(breaks);
|
assertNotNull(cdiTarget);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point on a generic function
|
* Create a break point on a generic function
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
location = breaks.createLocation(null, "func1", 0);
|
location = cdiTarget.createLocation(null, "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point on main
|
* Create a break point on main
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
location = breaks.createLocation(null, "main", 0);
|
location = cdiTarget.createLocation(null, "main", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Try to create a break point on a function name that does not exist We
|
* Try to create a break point on a function name that does not exist We
|
||||||
|
@ -197,25 +194,25 @@ public class BreakpointTests extends TestCase {
|
||||||
* CDIException
|
* CDIException
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
location = breaks.createLocation(null, "badname", 0);
|
location = cdiTarget.createLocation(null, "badname", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
try {
|
try {
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
caught = true;
|
caught = true;
|
||||||
}
|
}
|
||||||
assertTrue(caught);
|
assertTrue(caught);
|
||||||
|
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point on a generic function and see if it will get hit
|
* Create a break point on a generic function and see if it will get hit
|
||||||
* and stop program execution.
|
* and stop program execution.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
location = breaks.createLocation(null, "func1", 0);
|
location = cdiTarget.createLocation(null, "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
targets = session.getTargets();
|
targets = session.getTargets();
|
||||||
/*
|
/*
|
||||||
* We better only have one target connected to this session or something
|
* We better only have one target connected to this session or something
|
||||||
|
@ -262,27 +259,27 @@ public class BreakpointTests extends TestCase {
|
||||||
* expected.
|
* expected.
|
||||||
*/
|
*/
|
||||||
public void testLineBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
public void testLineBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
||||||
ICDIBreakpointManager breaks;
|
ICDITarget cdiTarget;
|
||||||
ICDILocation location;
|
ICDILocation location;
|
||||||
boolean caught = false;
|
boolean caught = false;
|
||||||
session = CDebugHelper.createSession("main", testProject);
|
session = CDebugHelper.createSession("main", testProject);
|
||||||
assertNotNull(session);
|
assertNotNull(session);
|
||||||
breaks = session.getBreakpointManager();
|
cdiTarget = session.getCurrentTarget();
|
||||||
assertNotNull(breaks);
|
assertNotNull(cdiTarget);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point in a generic function
|
* Create a break point in a generic function
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
location = breaks.createLocation("main.c", null, 7);
|
location = cdiTarget.createLocation("main.c", null, 7);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point in main
|
* Create a break point in main
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
location = breaks.createLocation("main.c", null, 18);
|
location = cdiTarget.createLocation("main.c", null, 18);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Try to create a break point on a line that does not exist We expect
|
* Try to create a break point on a line that does not exist We expect
|
||||||
|
@ -290,10 +287,10 @@ public class BreakpointTests extends TestCase {
|
||||||
* CDIException
|
* CDIException
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
location = breaks.createLocation("main.c", null, 30);
|
location = cdiTarget.createLocation("main.c", null, 30);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
try {
|
try {
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
caught = true;
|
caught = true;
|
||||||
}
|
}
|
||||||
|
@ -304,9 +301,9 @@ public class BreakpointTests extends TestCase {
|
||||||
* Try to create a break point on a line that does not have code on it
|
* Try to create a break point on a line that does not have code on it
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
location = breaks.createLocation("main.c", null, 11);
|
location = cdiTarget.createLocation("main.c", null, 11);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point in a generic function without passing the source
|
* Create a break point in a generic function without passing the source
|
||||||
|
@ -315,29 +312,29 @@ public class BreakpointTests extends TestCase {
|
||||||
* and once with an invalid line number, and the first should always
|
* and once with an invalid line number, and the first should always
|
||||||
* succeed and the second should always throw an exception.
|
* succeed and the second should always throw an exception.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
location = breaks.createLocation(null, null, 7);
|
location = cdiTarget.createLocation(null, null, 7);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
caught = false;
|
caught = false;
|
||||||
location = breaks.createLocation(null, null, 30);
|
location = cdiTarget.createLocation(null, null, 30);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
try {
|
try {
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
caught = true;
|
caught = true;
|
||||||
}
|
}
|
||||||
assertTrue("Ignoring line numbers with no file specified?", caught);
|
assertTrue("Ignoring line numbers with no file specified?", caught);
|
||||||
|
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point on a line number and see if it will get hit and
|
* Create a break point on a line number and see if it will get hit and
|
||||||
* stop program execution.
|
* stop program execution.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
location = breaks.createLocation(null, null, 7);
|
location = cdiTarget.createLocation(null, null, 7);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
targets = session.getTargets();
|
targets = session.getTargets();
|
||||||
/*
|
/*
|
||||||
* We better only have one target connected to this session or something
|
* We better only have one target connected to this session or something
|
||||||
|
@ -377,19 +374,19 @@ public class BreakpointTests extends TestCase {
|
||||||
* A couple tests to make sure getting breakpoints works as expected
|
* A couple tests to make sure getting breakpoints works as expected
|
||||||
*/
|
*/
|
||||||
public void testGetBreak() throws CoreException, MIException, IOException, CDIException {
|
public void testGetBreak() throws CoreException, MIException, IOException, CDIException {
|
||||||
ICDIBreakpointManager breaks;
|
ICDITarget cdiTarget;
|
||||||
ICDILocation location;
|
ICDILocation location;
|
||||||
ICDIBreakpoint[] breakpoints;
|
ICDIBreakpoint[] breakpoints;
|
||||||
ICDILocationBreakpoint curbreak;
|
ICDILocationBreakpoint curbreak;
|
||||||
session = CDebugHelper.createSession("main", testProject);
|
session = CDebugHelper.createSession("main", testProject);
|
||||||
assertNotNull(session);
|
assertNotNull(session);
|
||||||
breaks = session.getBreakpointManager();
|
cdiTarget = session.getCurrentTarget();
|
||||||
assertNotNull(breaks);
|
assertNotNull(cdiTarget);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Make sure initially we don't have any breakpoints
|
* Make sure initially we don't have any breakpoints
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertNotNull(breakpoints);
|
assertNotNull(breakpoints);
|
||||||
assertTrue(breakpoints.length == 0);
|
assertTrue(breakpoints.length == 0);
|
||||||
|
|
||||||
|
@ -398,11 +395,11 @@ public class BreakpointTests extends TestCase {
|
||||||
* from the system
|
* from the system
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/* Create a break point on a generic function */
|
/* Create a break point on a generic function */
|
||||||
location = breaks.createLocation("main.c", "func1", 0);
|
location = cdiTarget.createLocation("main.c", "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertNotNull(breakpoints);
|
assertNotNull(breakpoints);
|
||||||
assertTrue(breakpoints.length == 1);
|
assertTrue(breakpoints.length == 1);
|
||||||
if (breakpoints[0] instanceof ICDILocationBreakpoint) {
|
if (breakpoints[0] instanceof ICDILocationBreakpoint) {
|
||||||
|
@ -418,11 +415,11 @@ public class BreakpointTests extends TestCase {
|
||||||
* them all back from the system,
|
* them all back from the system,
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/* Create another break point on main */
|
/* Create another break point on main */
|
||||||
location = breaks.createLocation("main.c", "main", 0);
|
location = cdiTarget.createLocation("main.c", "main", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertNotNull(breakpoints);
|
assertNotNull(breakpoints);
|
||||||
assertTrue(breakpoints.length == 2);
|
assertTrue(breakpoints.length == 2);
|
||||||
if (breakpoints[1] instanceof ICDILocationBreakpoint) {
|
if (breakpoints[1] instanceof ICDILocationBreakpoint) {
|
||||||
|
@ -435,7 +432,7 @@ public class BreakpointTests extends TestCase {
|
||||||
*/
|
*/
|
||||||
assertTrue(curbreak.getLocation().equals(location));
|
assertTrue(curbreak.getLocation().equals(location));
|
||||||
|
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
|
|
||||||
/* clean up the session */
|
/* clean up the session */
|
||||||
session.terminate();
|
session.terminate();
|
||||||
|
@ -447,18 +444,18 @@ public class BreakpointTests extends TestCase {
|
||||||
* A couple tests to make sure deleting breakpoints works as expected
|
* A couple tests to make sure deleting breakpoints works as expected
|
||||||
*/
|
*/
|
||||||
public void testDelBreak() throws CoreException, MIException, IOException, CDIException {
|
public void testDelBreak() throws CoreException, MIException, IOException, CDIException {
|
||||||
ICDIBreakpointManager breaks;
|
ICDITarget cdiTarget;
|
||||||
ICDILocation location, savedLocation;
|
ICDILocation location, savedLocation;
|
||||||
ICDIBreakpoint[] breakpoints, savedbreakpoints;
|
ICDIBreakpoint[] breakpoints, savedbreakpoints;
|
||||||
ICDILocationBreakpoint curbreak;
|
ICDILocationBreakpoint curbreak;
|
||||||
|
|
||||||
session = CDebugHelper.createSession("main", testProject);
|
session = CDebugHelper.createSession("main", testProject);
|
||||||
assertNotNull(session);
|
assertNotNull(session);
|
||||||
breaks = session.getBreakpointManager();
|
cdiTarget = session.getCurrentTarget();
|
||||||
assertNotNull(breaks);
|
assertNotNull(cdiTarget);
|
||||||
|
|
||||||
/* Make sure initially we don't have any breakpoints */
|
/* Make sure initially we don't have any breakpoints */
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertNotNull(breakpoints);
|
assertNotNull(breakpoints);
|
||||||
assertTrue(breakpoints.length == 0);
|
assertTrue(breakpoints.length == 0);
|
||||||
|
|
||||||
|
@ -470,15 +467,15 @@ public class BreakpointTests extends TestCase {
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
/* Create a break point on a generic function */
|
/* Create a break point on a generic function */
|
||||||
location = breaks.createLocation("main.c", "func1", 0);
|
location = cdiTarget.createLocation("main.c", "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
curbreak = breaks.setLocationBreakpoint(0, location, null, null);
|
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
breaks.deleteBreakpoint(curbreak);
|
cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } );
|
||||||
pause();
|
pause();
|
||||||
/**
|
/**
|
||||||
* we should not have any breakpoints left.
|
* we should not have any breakpoints left.
|
||||||
*/
|
*/
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertTrue(breakpoints.length == 0);
|
assertTrue(breakpoints.length == 0);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -489,17 +486,17 @@ public class BreakpointTests extends TestCase {
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
/* Create a break point on a generic function */
|
/* Create a break point on a generic function */
|
||||||
location = breaks.createLocation("main.c", "func1", 0);
|
location = cdiTarget.createLocation("main.c", "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
curbreak = breaks.setLocationBreakpoint(0, location, null, null);
|
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
savedLocation = curbreak.getLocation();
|
savedLocation = curbreak.getLocation();
|
||||||
|
|
||||||
location = breaks.createLocation("main.c", "main", 0);
|
location = cdiTarget.createLocation("main.c", "main", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
curbreak = breaks.setLocationBreakpoint(0, location, null, null);
|
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
breaks.deleteBreakpoint(curbreak);
|
cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } );
|
||||||
pause();
|
pause();
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Make sure there is only 1 breakpoint left, and it's the one we expect
|
* Make sure there is only 1 breakpoint left, and it's the one we expect
|
||||||
*/
|
*/
|
||||||
|
@ -510,9 +507,9 @@ public class BreakpointTests extends TestCase {
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Then delete the other breakpoint.
|
* Then delete the other breakpoint.
|
||||||
*/
|
*/
|
||||||
breaks.deleteBreakpoint(curbreak);
|
cdiTarget.deleteBreakpoints( new ICDIBreakpoint[] { curbreak } );
|
||||||
pause();
|
pause();
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertTrue(breakpoints.length == 0);
|
assertTrue(breakpoints.length == 0);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -520,23 +517,23 @@ public class BreakpointTests extends TestCase {
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
savedbreakpoints = new ICDIBreakpoint[1];
|
savedbreakpoints = new ICDIBreakpoint[1];
|
||||||
for (int x = 0; x < 10; x++) {
|
for (int x = 0; x < 10; x++) {
|
||||||
location = breaks.createLocation("main.c", null, x + 1);
|
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||||
savedbreakpoints[0] = breaks.setLocationBreakpoint(0, location, null, null);
|
savedbreakpoints[0] = cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
assertNotNull(savedbreakpoints[0]);
|
assertNotNull(savedbreakpoints[0]);
|
||||||
}
|
}
|
||||||
breaks.deleteBreakpoints(savedbreakpoints);
|
cdiTarget.deleteBreakpoints(savedbreakpoints);
|
||||||
pause();
|
pause();
|
||||||
/* We should now have 9 breakpoints left. */
|
/* We should now have 9 breakpoints left. */
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertTrue(breakpoints.length == 9);
|
assertTrue(breakpoints.length == 9);
|
||||||
/* Make sure we have the correct 9 breakpoints left */
|
/* Make sure we have the correct 9 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];
|
||||||
assertTrue(curbreak.getLocation().getLineNumber() == x + 1);
|
assertTrue(curbreak.getLocation().getLineNumber() == x + 1);
|
||||||
}
|
}
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
pause();
|
pause();
|
||||||
assertTrue(breaks.getBreakpoints().length == 0);
|
assertTrue(cdiTarget.getBreakpoints().length == 0);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Make sure deleteBreakpoints works when given more then 1 but less
|
* Make sure deleteBreakpoints works when given more then 1 but less
|
||||||
|
@ -544,38 +541,38 @@ public class BreakpointTests extends TestCase {
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
savedbreakpoints = new ICDIBreakpoint[4];
|
savedbreakpoints = new ICDIBreakpoint[4];
|
||||||
for (int x = 0; x < 10; x++) {
|
for (int x = 0; x < 10; x++) {
|
||||||
location = breaks.createLocation("main.c", null, x + 1);
|
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||||
savedbreakpoints[x % 4] = breaks.setLocationBreakpoint(0, location, null, null);
|
savedbreakpoints[x % 4] = cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
assertNotNull(savedbreakpoints[x % 4]);
|
assertNotNull(savedbreakpoints[x % 4]);
|
||||||
}
|
}
|
||||||
breaks.deleteBreakpoints(savedbreakpoints);
|
cdiTarget.deleteBreakpoints(savedbreakpoints);
|
||||||
pause();
|
pause();
|
||||||
|
|
||||||
/* We should now have 6 breakpoints left. */
|
/* We should now have 6 breakpoints left. */
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertTrue(breakpoints.length == 6);
|
assertTrue(breakpoints.length == 6);
|
||||||
/* 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];
|
||||||
assertTrue(curbreak.getLocation().getLineNumber() == x + 1);
|
assertTrue(curbreak.getLocation().getLineNumber() == x + 1);
|
||||||
}
|
}
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
pause();
|
pause();
|
||||||
assertTrue(breaks.getBreakpoints().length == 0);
|
assertTrue(cdiTarget.getBreakpoints().length == 0);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* 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[10];
|
||||||
for (int x = 0; x < 10; x++) {
|
for (int x = 0; x < 10; x++) {
|
||||||
location = breaks.createLocation("main.c", null, x + 1);
|
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||||
savedbreakpoints[x] = breaks.setLocationBreakpoint(0, location, null, null);
|
savedbreakpoints[x] = cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
assertNotNull(savedbreakpoints[x]);
|
assertNotNull(savedbreakpoints[x]);
|
||||||
}
|
}
|
||||||
breaks.deleteBreakpoints(savedbreakpoints);
|
cdiTarget.deleteBreakpoints(savedbreakpoints);
|
||||||
pause();
|
pause();
|
||||||
/* We should now have 0 breakpoints left. */
|
/* We should now have 0 breakpoints left. */
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertTrue(breakpoints.length == 0);
|
assertTrue(breakpoints.length == 0);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -583,14 +580,14 @@ public class BreakpointTests extends TestCase {
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
for (int x = 0; x < 10; x++) {
|
for (int x = 0; x < 10; x++) {
|
||||||
location = breaks.createLocation("main.c", null, x + 1);
|
location = cdiTarget.createLocation("main.c", null, x + 1);
|
||||||
curbreak = breaks.setLocationBreakpoint(0, location, null, null);
|
curbreak = cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
assertNotNull(curbreak);
|
assertNotNull(curbreak);
|
||||||
}
|
}
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
pause();
|
pause();
|
||||||
/* We should now have 0 breakpoints left. */
|
/* We should now have 0 breakpoints left. */
|
||||||
breakpoints = breaks.getBreakpoints();
|
breakpoints = cdiTarget.getBreakpoints();
|
||||||
assertTrue(breakpoints.length == 0);
|
assertTrue(breakpoints.length == 0);
|
||||||
|
|
||||||
/* clean up the session */
|
/* clean up the session */
|
||||||
|
@ -604,40 +601,37 @@ public class BreakpointTests extends TestCase {
|
||||||
* work as expected.
|
* work as expected.
|
||||||
*/
|
*/
|
||||||
public void testCondBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
public void testCondBreak() throws CoreException, MIException, IOException, CDIException, InterruptedException {
|
||||||
ICDIBreakpointManager breaks;
|
|
||||||
ICDILocation location;
|
|
||||||
ICDICondition cond;
|
|
||||||
boolean caught = false;
|
boolean caught = false;
|
||||||
session = CDebugHelper.createSession("main", testProject);
|
session = CDebugHelper.createSession("main", testProject);
|
||||||
assertNotNull(session);
|
assertNotNull(session);
|
||||||
breaks = session.getBreakpointManager();
|
ICDITarget cdiTarget = session.getCurrentTarget();
|
||||||
assertNotNull(breaks);
|
assertNotNull(cdiTarget);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point on a generic function with an empty condition
|
* Create a break point on a generic function with an empty condition
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
cond = breaks.createCondition(0, "");
|
ICDICondition cond = cdiTarget.createCondition(0, "");
|
||||||
location = breaks.createLocation(null, "func1", 0);
|
ICDILocation location = cdiTarget.createLocation(null, "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, cond, null);
|
cdiTarget.setLocationBreakpoint(0, location, cond, null, false);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point on a generic function with an valid condition
|
* Create a break point on a generic function with an valid condition
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
cond = breaks.createCondition(0, "x<10");
|
cond = cdiTarget.createCondition(0, "x<10");
|
||||||
location = breaks.createLocation(null, "func1", 0);
|
location = cdiTarget.createLocation(null, "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, cond, null);
|
cdiTarget.setLocationBreakpoint(0, location, cond, null, false);
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Create a break point on a generic function with an invalid condition
|
* 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.
|
* We expect to get a CDIException when we try to set the breakpoint.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
cond = breaks.createCondition(0, "nonexist<10");
|
cond = cdiTarget.createCondition(0, "nonexist<10");
|
||||||
location = breaks.createLocation(null, "func1", 0);
|
location = cdiTarget.createLocation(null, "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
try {
|
try {
|
||||||
breaks.setLocationBreakpoint(0, location, cond, null);
|
cdiTarget.setLocationBreakpoint(0, location, cond, null, false);
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
caught = true;
|
caught = true;
|
||||||
}
|
}
|
||||||
|
@ -648,12 +642,12 @@ public class BreakpointTests extends TestCase {
|
||||||
* it does not suspend execution of the application until the condition
|
* it does not suspend execution of the application until the condition
|
||||||
* is true
|
* is true
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
location = breaks.createLocation(null, null, 23);
|
location = cdiTarget.createLocation(null, null, 23);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
cond = breaks.createCondition(0, "a>10");
|
cond = cdiTarget.createCondition(0, "a>10");
|
||||||
|
|
||||||
breaks.setLocationBreakpoint(0, location, cond, null);
|
cdiTarget.setLocationBreakpoint(0, location, cond, null, false);
|
||||||
targets = session.getTargets();
|
targets = session.getTargets();
|
||||||
/*
|
/*
|
||||||
* We better only have one target connected to this session or something
|
* We better only have one target connected to this session or something
|
||||||
|
|
|
@ -8,16 +8,14 @@ package org.eclipse.cdt.debug.core.tests;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
|
||||||
|
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.cdt.debug.testplugin.CDebugHelper;
|
import org.eclipse.cdt.debug.testplugin.CDebugHelper;
|
||||||
import org.eclipse.cdt.debug.testplugin.CProjectHelper;
|
import org.eclipse.cdt.debug.testplugin.CProjectHelper;
|
||||||
|
@ -119,18 +117,18 @@ public class DebugTests extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testDebug() throws CoreException, MIException, IOException, CDIException {
|
public void testDebug() throws CoreException, MIException, IOException, CDIException {
|
||||||
ICDISourceManager source;
|
ICDISourceManager source;
|
||||||
ICDIBreakpointManager breaks;
|
ICDITarget cdiTarget;
|
||||||
ICDILocation location;
|
ICDILocation location;
|
||||||
|
|
||||||
session=CDebugHelper.createSession("main",testProject);
|
session=CDebugHelper.createSession("main",testProject);
|
||||||
assertNotNull(session);
|
assertNotNull(session);
|
||||||
source=session.getSourceManager();
|
source=session.getSourceManager();
|
||||||
assertNotNull(source);
|
assertNotNull(source);
|
||||||
breaks=session.getBreakpointManager();
|
cdiTarget=session.getCurrentTarget();
|
||||||
assertNotNull(breaks);
|
assertNotNull(cdiTarget);
|
||||||
location=breaks.createLocation(null, "func1", 0);
|
location=cdiTarget.createLocation(null, "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
session.getCurrentTarget().resume();
|
session.getCurrentTarget().resume();
|
||||||
session.terminate();
|
session.terminate();
|
||||||
session=null;
|
session=null;
|
||||||
|
|
|
@ -8,17 +8,15 @@ package org.eclipse.cdt.debug.core.tests;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
|
||||||
import org.eclipse.cdt.debug.core.cdi.ICDISession;
|
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.ICDIBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
|
||||||
|
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.cdt.debug.testplugin.CDebugHelper;
|
import org.eclipse.cdt.debug.testplugin.CDebugHelper;
|
||||||
import org.eclipse.cdt.debug.testplugin.CProjectHelper;
|
import org.eclipse.cdt.debug.testplugin.CProjectHelper;
|
||||||
|
@ -116,26 +114,26 @@ public class LocationTests extends TestCase {
|
||||||
* A couple tests to make sure comparing Locations works as expected.
|
* A couple tests to make sure comparing Locations works as expected.
|
||||||
*/
|
*/
|
||||||
public void testIsEquals() throws CoreException, MIException, IOException, CDIException {
|
public void testIsEquals() throws CoreException, MIException, IOException, CDIException {
|
||||||
ICDIBreakpointManager breaks;
|
ICDITarget cdiTarget;
|
||||||
ICDILocation location, location2;
|
ICDILocation location, location2;
|
||||||
ICDIBreakpoint[] breakpoints;
|
ICDIBreakpoint[] breakpoints;
|
||||||
ICDILocationBreakpoint curbreak;
|
ICDILocationBreakpoint curbreak;
|
||||||
session=CDebugHelper.createSession("main",testProject);
|
session=CDebugHelper.createSession("main",testProject);
|
||||||
assertNotNull(session);
|
assertNotNull(session);
|
||||||
breaks=session.getBreakpointManager();
|
cdiTarget=session.getCurrentTarget();
|
||||||
assertNotNull(breaks);
|
assertNotNull(cdiTarget);
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Simple test.. this should work.
|
* Simple test.. this should work.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
location=breaks.createLocation("main.c", "func1", 0);
|
location=cdiTarget.createLocation("main.c", "func1", 0);
|
||||||
location2=breaks.createLocation("main.c", "func1", 0);
|
location2=cdiTarget.createLocation("main.c", "func1", 0);
|
||||||
assertTrue(location.equals(location2));
|
assertTrue(location.equals(location2));
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Simple test.. this should work.
|
* Simple test.. this should work.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
location=breaks.createLocation("main.c", null, 10);
|
location=cdiTarget.createLocation("main.c", null, 10);
|
||||||
location2=breaks.createLocation("main.c", null, 10);
|
location2=cdiTarget.createLocation("main.c", null, 10);
|
||||||
assertTrue(location.equals(location2));
|
assertTrue(location.equals(location2));
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
@ -144,11 +142,11 @@ public class LocationTests extends TestCase {
|
||||||
* setLocationBreakpoint is the same as the breakpoint returned from
|
* setLocationBreakpoint is the same as the breakpoint returned from
|
||||||
* BreakpointManager.getBreakpoints.getLocation()
|
* BreakpointManager.getBreakpoints.getLocation()
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
location=breaks.createLocation("main.c", "func1", 0);
|
location=cdiTarget.createLocation("main.c", "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
location2=breaks.setLocationBreakpoint(0, location, null, null).getLocation();
|
location2=cdiTarget.setLocationBreakpoint(0, location, null, null, false).getLocation();
|
||||||
|
|
||||||
breakpoints=breaks.getBreakpoints();
|
breakpoints=cdiTarget.getBreakpoints();
|
||||||
assertNotNull(breakpoints);
|
assertNotNull(breakpoints);
|
||||||
assertTrue(breakpoints.length==1);
|
assertTrue(breakpoints.length==1);
|
||||||
if (breakpoints[0] instanceof ICDILocationBreakpoint) {
|
if (breakpoints[0] instanceof ICDILocationBreakpoint) {
|
||||||
|
@ -158,16 +156,16 @@ public class LocationTests extends TestCase {
|
||||||
assertNotNull(curbreak);
|
assertNotNull(curbreak);
|
||||||
|
|
||||||
assertTrue(curbreak.getLocation().equals(location2));
|
assertTrue(curbreak.getLocation().equals(location2));
|
||||||
breaks.deleteAllBreakpoints();
|
cdiTarget.deleteAllBreakpoints();
|
||||||
/* Create a break point on a generic function with a file name that
|
/* 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
|
* 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.
|
* should work, but at the time of writing (Sept 25, 2002) does not.
|
||||||
*/
|
*/
|
||||||
location=breaks.createLocation("main.c", "func1", 0);
|
location=cdiTarget.createLocation("main.c", "func1", 0);
|
||||||
assertNotNull(location);
|
assertNotNull(location);
|
||||||
breaks.setLocationBreakpoint(0, location, null, null);
|
cdiTarget.setLocationBreakpoint(0, location, null, null, false);
|
||||||
|
|
||||||
breakpoints=breaks.getBreakpoints();
|
breakpoints=cdiTarget.getBreakpoints();
|
||||||
assertNotNull(breakpoints);
|
assertNotNull(breakpoints);
|
||||||
assertTrue(breakpoints.length==1);
|
assertTrue(breakpoints.length==1);
|
||||||
if (breakpoints[0] instanceof ICDILocationBreakpoint) {
|
if (breakpoints[0] instanceof ICDILocationBreakpoint) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue