1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

Bug 105196, add the the enabled flag to the CDI api for setting breakpoints instead of calling setEnabled later on.

This commit is contained in:
Ken Ryall 2007-02-15 20:47:11 +00:00
parent 8f495e9c41
commit 7aee6c93ac
5 changed files with 140 additions and 15 deletions

View file

@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright (c) 2007 Nokia and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nokia - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddressFactory;
/**
*/
public interface ICDIAddressFactoryManagement {
/**
* Returns an AddressFactory.
* @return a IAddressFactory.
*/
IAddressFactory getAddressFactory();
}

View file

@ -0,0 +1,91 @@
/*******************************************************************************
* Copyright (c) 2007 Nokia and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nokia - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation;
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation;
import org.eclipse.cdt.debug.core.cdi.ICDILineLocation;
public interface ICDIBreakpointManagement2 {
/**
* Set a line breakpoint.
*
* @param type
* @param location
* @param condition
* @param deferred
* @param enabled
* @return
* @throws CDIException
*/
ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location,
ICDICondition condition, boolean deferred, boolean enabled) throws CDIException;
/**
* Set a function breakpoint.
*
* @param type
* @param location
* @param condition
* @param deferred
* @param enabled
* @return
* @throws CDIException
*/
ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location,
ICDICondition condition, boolean deferred, boolean enabled) throws CDIException;
/**
* Set an address Breakpoint
*
* @param type
* @param location
* @param condition
* @param deferred
* @param enabled
* @return
* @throws CDIException
*/
ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location,
ICDICondition condition, boolean deferred, boolean enabled) throws CDIException;
/**
* Set a watchpoint.
*
* @param type
* @param watchType
* @param expression
* @param condition
* @param enabled
* @return
* @throws CDIException
*/
ICDIWatchpoint setWatchpoint(int type, int watchType, String expression,
ICDICondition condition, boolean enabled) throws CDIException;
/**
* Set an exception point.
*
* @param clazz
* @param stopOnThrow
* @param stopOnCatch
* @param enabled
* @return
* @throws CDIException
*/
ICDIExceptionpoint setExceptionBreakpoint(String clazz, boolean stopOnThrow,
boolean stopOnCatch, boolean enabled) throws CDIException;
}

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
public interface ICDITarget2 extends ICDITarget {
@ -22,10 +21,4 @@ public interface ICDITarget2 extends ICDITarget {
*/
IGlobalVariableDescriptor[] getGlobalVariables();
/**
* Returns an AddressFactory for use with this target.
* @return an IAddressFactory.
*/
IAddressFactory getAddressFactory();
}

View file

@ -8,7 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Matthias Spycher (matthias@coware.com) - patch for bug #112008
* Ken Ryall (Nokia) - bug 170027
* Ken Ryall (Nokia) - bugs 170027, 105196
*******************************************************************************/
package org.eclipse.cdt.debug.internal.core;
@ -41,6 +41,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpointManagement2;
import org.eclipse.cdt.debug.core.cdi.model.ICDIFunctionBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDILineBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint;
@ -644,6 +645,9 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
protected void setBreakpointsOnTarget0( ICBreakpoint[] breakpoints ) {
ICDITarget cdiTarget = getCDITarget();
ICDIBreakpointManagement2 bpManager2 = null;
if (cdiTarget instanceof ICDIBreakpointManagement2)
bpManager2 = (ICDIBreakpointManagement2) cdiTarget;
for ( int i = 0; i < breakpoints.length; ++i ) {
try {
ICDIBreakpoint b = null;
@ -654,13 +658,19 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
ICDIFunctionLocation location = cdiTarget.createFunctionLocation( fileName, function );
ICDICondition condition = createCondition( breakpoint );
fBreakpointProblems.add(BreakpointProblems.reportUnresolvedBreakpoint(breakpoint, getDebugTarget().getName(), getDebugTarget().getInternalID()));
b = cdiTarget.setFunctionBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
if (bpManager2 != null)
bpManager2.setFunctionBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true, breakpoints[i].isEnabled() );
else
b = cdiTarget.setFunctionBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
} else if ( breakpoints[i] instanceof ICAddressBreakpoint ) {
ICAddressBreakpoint breakpoint = (ICAddressBreakpoint)breakpoints[i];
String address = breakpoint.getAddress();
ICDIAddressLocation location = cdiTarget.createAddressLocation( new BigInteger ( ( address.startsWith( "0x" ) ) ? address.substring( 2 ) : address, 16 ) ); //$NON-NLS-1$
ICDICondition condition = createCondition( breakpoint );
b = cdiTarget.setAddressBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
if (bpManager2 != null)
bpManager2.setAddressBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true, breakpoints[i].isEnabled() );
else
b = cdiTarget.setAddressBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
} else if ( breakpoints[i] instanceof ICLineBreakpoint ) {
ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
String handle = breakpoint.getSourceHandle();
@ -668,7 +678,10 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
ICDILineLocation location = cdiTarget.createLineLocation( path.toPortableString(), breakpoint.getLineNumber() );
ICDICondition condition = createCondition( breakpoint );
fBreakpointProblems.add(BreakpointProblems.reportUnresolvedBreakpoint(breakpoint, getDebugTarget().getName(), getDebugTarget().getInternalID()));
b = cdiTarget.setLineBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
if (bpManager2 != null)
bpManager2.setLineBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true, breakpoints[i].isEnabled() );
else
b = cdiTarget.setLineBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
} else if ( breakpoints[i] instanceof ICWatchpoint ) {
ICWatchpoint watchpoint = (ICWatchpoint)breakpoints[i];
int accessType = 0;
@ -676,7 +689,10 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
accessType |= (watchpoint.isReadType()) ? ICDIWatchpoint.READ : 0;
String expression = watchpoint.getExpression();
ICDICondition condition = createCondition( watchpoint );
b = cdiTarget.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
if (bpManager2 != null)
bpManager2.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition, breakpoints[i].isEnabled() );
else
b = cdiTarget.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
}
if ( b != null ) {
Object obj = getBreakpointMap().get( breakpoints[i] );
@ -685,7 +701,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
}
}
// Hack: see bug 105196: [CDI]: Add "enabled" flag to the "set...Breakpoint" methods
if ( b != null && b.isEnabled() != breakpoints[i].isEnabled() ) {
if (bpManager2 == null && b != null && b.isEnabled() != breakpoints[i].isEnabled() ) {
b.setEnabled( breakpoints[i].isEnabled() );
}
}

View file

@ -54,6 +54,7 @@ import org.eclipse.cdt.debug.core.cdi.event.ICDIExitedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIRestartedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIResumedEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDISuspendedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIAddressFactoryManagement;
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
@ -1634,8 +1635,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
// No binary file, possible when we do pure assembly level debug
// Without any binary file involved, ask CDI plugin for default
// AddressFactory, if any.
if (fCDITarget instanceof ICDITarget2) {
fAddressFactory = ((ICDITarget2) fCDITarget).getAddressFactory();
if (fCDITarget instanceof ICDIAddressFactoryManagement) {
fAddressFactory = ((ICDIAddressFactoryManagement) fCDITarget).getAddressFactory();
}
}
}