mirror of
https://github.com/eclipse-cdt/cdt
synced 2024-10-28 20:17:52 +01:00
- bug 118100 - hardware breakpoints support
This commit is contained in:
parent
5273116bf3
commit
dc62fa9320
7 changed files with 144 additions and 27 deletions
|
@ -30,6 +30,10 @@
|
|||
<attribute
|
||||
name="org.eclipse.cdt.debug.core.sourceHandle">
|
||||
</attribute>
|
||||
<attribute
|
||||
name="org.eclipse.cdt.debug.core.breakpointType">
|
||||
</attribute>
|
||||
|
||||
</extension>
|
||||
<extension
|
||||
id="commonCLineBreakpointMarker"
|
||||
|
|
|
@ -24,9 +24,11 @@ import org.eclipse.cdt.core.ICExtensionReference;
|
|||
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
|
||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
|
||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
|
||||
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
|
@ -203,6 +205,7 @@ public class CDIDebugModel {
|
|||
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
|
||||
attributes.put( ICBreakpoint.CONDITION, condition );
|
||||
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
|
||||
attributes.put( ICBreakpointTyped.TYPE, ICDIBreakpoint.REGULAR );
|
||||
return new CLineBreakpoint( resource, attributes, register );
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,10 @@ import javax.xml.transform.dom.DOMSource;
|
|||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICValue;
|
||||
|
@ -338,6 +340,7 @@ public class CDebugUtils {
|
|||
StringBuffer label = new StringBuffer();
|
||||
appendSourceName( breakpoint, label, qualified );
|
||||
appendLineNumber( breakpoint, label );
|
||||
appendBreakpointType( breakpoint, label );
|
||||
appendIgnoreCount( breakpoint, label );
|
||||
appendCondition( breakpoint, label );
|
||||
return label.toString();
|
||||
|
@ -361,6 +364,7 @@ public class CDebugUtils {
|
|||
StringBuffer label = new StringBuffer();
|
||||
appendSourceName( breakpoint, label, qualified );
|
||||
appendAddress( breakpoint, label );
|
||||
appendBreakpointType( breakpoint, label );
|
||||
appendIgnoreCount( breakpoint, label );
|
||||
appendCondition( breakpoint, label );
|
||||
return label.toString();
|
||||
|
@ -370,6 +374,7 @@ public class CDebugUtils {
|
|||
StringBuffer label = new StringBuffer();
|
||||
appendSourceName( breakpoint, label, qualified );
|
||||
appendFunction( breakpoint, label );
|
||||
appendBreakpointType( breakpoint, label );
|
||||
appendIgnoreCount( breakpoint, label );
|
||||
appendCondition( breakpoint, label );
|
||||
return label.toString();
|
||||
|
@ -454,6 +459,28 @@ public class CDebugUtils {
|
|||
label.append( MessageFormat.format( DebugCoreMessages.getString( "CDebugUtils.7" ), new String[]{ range } ) ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
protected static StringBuffer appendBreakpointType( ICBreakpoint breakpoint, StringBuffer label ) throws CoreException {
|
||||
if (breakpoint instanceof ICBreakpointTyped) {
|
||||
String typeString = null;
|
||||
int type = ((ICBreakpointTyped) breakpoint).getType();
|
||||
switch (type) {
|
||||
case ICDIBreakpoint.HARDWARE:
|
||||
typeString = DebugCoreMessages.getString("CDebugUtils.10");
|
||||
break;
|
||||
case ICDIBreakpoint.TEMPORARY:
|
||||
typeString = DebugCoreMessages.getString("CDebugUtils.11");
|
||||
break;
|
||||
}
|
||||
if (typeString != null) {
|
||||
label.append(' ');
|
||||
label.append(MessageFormat.format(
|
||||
DebugCoreMessages.getString("CDebugUtils.8"), new String[] { typeString })); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return label;
|
||||
|
||||
}
|
||||
|
||||
private static boolean isEmpty( String string ) {
|
||||
return ( string == null || string.trim().length() == 0 );
|
||||
|
|
|
@ -18,4 +18,8 @@ CDebugUtils.4=[condition: {0}]
|
|||
CDebugUtils.5=[expression: ''{0}'']
|
||||
CDebugUtils.6=[memory space: {0}]
|
||||
CDebugUtils.7=[units: {0}]
|
||||
CDebugUtils.8=[type: {0}]
|
||||
CDebugUtils.9=Regular
|
||||
CDebugUtils.10=Hardware
|
||||
CDebugUtils.11=Temporary
|
||||
CDIDebugModel.0=Unable to parser binary information from file
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 QNX Software Systems 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Jiju George T- bug 118100
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.core.model;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public interface ICBreakpointTyped {
|
||||
/**
|
||||
* Breakpoint attribute storing the type this breakpoint
|
||||
* is set in (value <code>"org.eclipse.cdt.debug.core.type"</code>).
|
||||
* This attribute is a <code>int</code>.
|
||||
* Possible values are
|
||||
* <code>ICDIBreakpoint.REGULAR</code>
|
||||
* <code>ICDIBreakpoint.HARDWARE</code>
|
||||
* <code>ICDIBreakpoint.TEMPORARY</code>
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public static final String TYPE = "org.eclipse.cdt.debug.core.breakpointType"; //$NON-NLS-1$
|
||||
|
||||
|
||||
/**
|
||||
* Returns the type of this breakpoint
|
||||
*
|
||||
* @return type of breakpoint. Defaults to REGULAR if property does not exists in
|
||||
* the underlying marker.
|
||||
* @exception CoreException if unable to access the property on this breakpoint's
|
||||
* underlying marker
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public int getType() throws CoreException;
|
||||
|
||||
/**
|
||||
* Sets the type of this breakpoint.
|
||||
*
|
||||
* @param type breakpoint type
|
||||
* @exception CoreException if unable to access the property on this breakpoint's
|
||||
* underlying marker
|
||||
*
|
||||
* @since 5.0
|
||||
*/
|
||||
public void setType( int type ) throws CoreException;
|
||||
}
|
|
@ -64,8 +64,9 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint2;
|
|||
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointFilterExtension;
|
||||
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
|
||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||
import org.eclipse.cdt.debug.core.model.ICEventBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICThread;
|
||||
|
@ -770,8 +771,13 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||
try {
|
||||
ICDIBreakpoint b = null;
|
||||
if ( breakpoints[i] instanceof ICFunctionBreakpoint ) {
|
||||
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
|
||||
int breakpointType = ICDIBreakpoint.REGULAR;
|
||||
ICBreakpoint icbreakpoint = breakpoints[i];
|
||||
if (icbreakpoint instanceof ICBreakpointTyped) {
|
||||
breakpointType = ((ICBreakpointTyped) icbreakpoint).getType();
|
||||
}
|
||||
if ( icbreakpoint instanceof ICFunctionBreakpoint ) {
|
||||
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)icbreakpoint;
|
||||
String function = breakpoint.getFunction();
|
||||
String fileName = breakpoint.getFileName();
|
||||
ICDIFunctionLocation location = cdiTarget.createFunctionLocation( fileName, function );
|
||||
|
@ -780,68 +786,68 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
|||
if (marker != null)
|
||||
fBreakpointProblems.add(marker);
|
||||
if (bpManager2 != null)
|
||||
b = bpManager2.setFunctionBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true, breakpoints[i].isEnabled() );
|
||||
b = bpManager2.setFunctionBreakpoint( breakpointType, location, condition, true, icbreakpoint.isEnabled() );
|
||||
else
|
||||
b = cdiTarget.setFunctionBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
|
||||
} else if ( breakpoints[i] instanceof ICAddressBreakpoint ) {
|
||||
ICAddressBreakpoint breakpoint = (ICAddressBreakpoint)breakpoints[i];
|
||||
b = cdiTarget.setFunctionBreakpoint( breakpointType, location, condition, true );
|
||||
} else if ( icbreakpoint instanceof ICAddressBreakpoint ) {
|
||||
ICAddressBreakpoint breakpoint = (ICAddressBreakpoint)icbreakpoint;
|
||||
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 );
|
||||
if (bpManager2 != null)
|
||||
b = bpManager2.setAddressBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true, breakpoints[i].isEnabled() );
|
||||
b = bpManager2.setAddressBreakpoint( breakpointType, location, condition, true, icbreakpoint.isEnabled() );
|
||||
else
|
||||
b = cdiTarget.setAddressBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
|
||||
} else if ( breakpoints[i] instanceof ICLineBreakpoint ) {
|
||||
ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
|
||||
b = cdiTarget.setAddressBreakpoint( breakpointType, location, condition, true );
|
||||
} else if ( icbreakpoint instanceof ICLineBreakpoint ) {
|
||||
ICLineBreakpoint breakpoint = (ICLineBreakpoint)icbreakpoint;
|
||||
String handle = breakpoint.getSourceHandle();
|
||||
IPath path = convertPath( handle );
|
||||
ICDILineLocation location = cdiTarget.createLineLocation( path.toPortableString(), breakpoint.getLineNumber() );
|
||||
ICDICondition condition = createCondition( breakpoint );
|
||||
fBreakpointProblems.add(BreakpointProblems.reportUnresolvedBreakpoint(breakpoint, getDebugTarget().getName(), getDebugTarget().getInternalID()));
|
||||
if (bpManager2 != null)
|
||||
b = bpManager2.setLineBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true, breakpoints[i].isEnabled() );
|
||||
b = bpManager2.setLineBreakpoint( breakpointType, location, condition, true, icbreakpoint.isEnabled() );
|
||||
else
|
||||
b = cdiTarget.setLineBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true );
|
||||
} else if ( breakpoints[i] instanceof ICWatchpoint ) {
|
||||
ICWatchpoint watchpoint = (ICWatchpoint)breakpoints[i];
|
||||
b = cdiTarget.setLineBreakpoint( breakpointType, location, condition, true );
|
||||
} else if ( icbreakpoint instanceof ICWatchpoint ) {
|
||||
ICWatchpoint watchpoint = (ICWatchpoint)icbreakpoint;
|
||||
int accessType = 0;
|
||||
accessType |= (watchpoint.isWriteType()) ? ICDIWatchpoint.WRITE : 0;
|
||||
accessType |= (watchpoint.isReadType()) ? ICDIWatchpoint.READ : 0;
|
||||
String expression = watchpoint.getExpression();
|
||||
ICDICondition condition = createCondition( watchpoint );
|
||||
if ( bpManager2 != null ) {
|
||||
if ( breakpoints[i] instanceof ICWatchpoint2 ) {
|
||||
if ( icbreakpoint instanceof ICWatchpoint2 ) {
|
||||
ICWatchpoint2 wp2 = (ICWatchpoint2)watchpoint;
|
||||
b = bpManager2.setWatchpoint(ICDIBreakpoint.REGULAR, accessType, expression, wp2.getMemorySpace(),
|
||||
wp2.getRange(), condition, breakpoints[i].isEnabled() );
|
||||
b = bpManager2.setWatchpoint( breakpointType, accessType, expression, wp2.getMemorySpace(),
|
||||
wp2.getRange(), condition, icbreakpoint.isEnabled() );
|
||||
} else {
|
||||
b = bpManager2.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition, breakpoints[i].isEnabled() );
|
||||
b = bpManager2.setWatchpoint( breakpointType, accessType, expression, condition, icbreakpoint.isEnabled() );
|
||||
}
|
||||
} else {
|
||||
b = cdiTarget.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, condition );
|
||||
b = cdiTarget.setWatchpoint(breakpointType, accessType, expression, condition );
|
||||
}
|
||||
} else if (breakpoints[i] instanceof ICEventBreakpoint) {
|
||||
ICEventBreakpoint eventbkpt = (ICEventBreakpoint) breakpoints[i];
|
||||
} else if (icbreakpoint instanceof ICEventBreakpoint) {
|
||||
ICEventBreakpoint eventbkpt = (ICEventBreakpoint) icbreakpoint;
|
||||
ICDICondition condition = createCondition(eventbkpt);
|
||||
if (cdiTarget instanceof ICDIBreakpointManagement3) {
|
||||
ICDIBreakpointManagement3 bpManager3 = (ICDIBreakpointManagement3) cdiTarget;
|
||||
b = bpManager3.setEventBreakpoint(eventbkpt.getEventType(), eventbkpt
|
||||
.getEventArgument(), ICDIBreakpoint.REGULAR, condition, true, breakpoints[i].isEnabled());
|
||||
.getEventArgument(), breakpointType, condition, true, icbreakpoint.isEnabled());
|
||||
} else {
|
||||
throw new UnsupportedOperationException("BreakpointManager does not support this type of breapoints");
|
||||
}
|
||||
|
||||
}
|
||||
if ( b != null ) {
|
||||
Object obj = getBreakpointMap().get( breakpoints[i] );
|
||||
Object obj = getBreakpointMap().get( icbreakpoint );
|
||||
if ( obj instanceof BreakpointInProgess ) {
|
||||
((BreakpointInProgess)obj).setCDIBreakpoint( b );
|
||||
}
|
||||
}
|
||||
// Hack: see bug 105196: [CDI]: Add "enabled" flag to the "set...Breakpoint" methods
|
||||
if (bpManager2 == null && b != null && b.isEnabled() != breakpoints[i].isEnabled() ) {
|
||||
b.setEnabled( breakpoints[i].isEnabled() );
|
||||
if (bpManager2 == null && b != null && b.isEnabled() != icbreakpoint.isEnabled() ) {
|
||||
b.setEnabled( icbreakpoint.isEnabled() );
|
||||
}
|
||||
}
|
||||
catch( CoreException e ) {
|
||||
|
|
|
@ -18,8 +18,10 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointExtension;
|
||||
import org.eclipse.cdt.debug.core.model.ICBreakpointTyped;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
|
@ -40,7 +42,7 @@ import org.eclipse.debug.core.model.Breakpoint;
|
|||
/**
|
||||
* The base class for all C/C++ specific breakpoints.
|
||||
*/
|
||||
public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, IDebugEventSetListener {
|
||||
public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ICBreakpointTyped, IDebugEventSetListener {
|
||||
|
||||
/**
|
||||
* Map of breakpoint extensions. The keys to the map are debug model IDs
|
||||
|
@ -154,6 +156,24 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
|
|||
setAttribute( IGNORE_COUNT, ignoreCount );
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getType()
|
||||
*/
|
||||
public int getType() throws CoreException {
|
||||
return ensureMarker().getAttribute( TYPE, 0 );
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setType(int)
|
||||
*/
|
||||
public void setType(int type) throws CoreException {
|
||||
setAttribute( TYPE, type );
|
||||
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
|
Loading…
Reference in a new issue