1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Moved the "FUNCTION" and "ADDRESS" breakpoint attributes to ICLineBreakpoint.

Added support for the Disassembly view.
This commit is contained in:
Mikhail Khodjaiants 2004-04-27 23:13:23 +00:00
parent 31cfba78a4
commit 06ad029125
14 changed files with 312 additions and 245 deletions

View file

@ -1,3 +1,20 @@
2004-04-27 Mikhail Khodjaiants
Moved the "FUNCTION" and "ADDRESS" breakpoint attributes to ICLineBreakpoint.
Added support for the Disassembly view.
* plugin.xml
* CDIDebugModel.java
* IBreakpointTarget.java: new
* ICAddressBreakpoint.java
* ICDebugTarget.java
* ICFunctionBreakpoint.java
* ICLineBreakpoint.java
* CBreakpointManager.java
* AbstractLineBreakpoint.java: new
* CAddressBreakpoint.java
* CFunctionBreakpoint.java
* CLineBreakpoint.java
* CDebugTarget.java
2004-04-26 Mikhail Khodjaiants 2004-04-26 Mikhail Khodjaiants
The notification of the Breakpoint Manager on breakpoint creation has been The notification of the Breakpoint Manager on breakpoint creation has been
moved to CBreakpointUpdater. moved to CBreakpointUpdater.

View file

@ -69,6 +69,12 @@
<persistent <persistent
value="true"> value="true">
</persistent> </persistent>
<attribute
name="org.eclipse.cdt.debug.core.function">
</attribute>
<attribute
name="org.eclipse.cdt.debug.core.address">
</attribute>
</extension> </extension>
<extension <extension
id="cAddressBreakpointMarker" id="cAddressBreakpointMarker"
@ -79,9 +85,6 @@
<persistent <persistent
value="true"> value="true">
</persistent> </persistent>
<attribute
name="org.eclipse.cdt.debug.core.address">
</attribute>
</extension> </extension>
<extension <extension
id="cFunctionBreakpointMarker" id="cFunctionBreakpointMarker"
@ -92,9 +95,6 @@
<persistent <persistent
value="true"> value="true">
</persistent> </persistent>
<attribute
name="org.eclipse.cdt.debug.core.function">
</attribute>
</extension> </extension>
<extension <extension
id="cWatchpointMarker" id="cWatchpointMarker"

View file

@ -107,7 +107,7 @@ public class CDIDebugModel {
attributes.put( IMarker.CHAR_END, new Integer( 0 ) ); attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) ); attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) ); attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
attributes.put( ICAddressBreakpoint.ADDRESS, Long.toString( address ) ); attributes.put( ICLineBreakpoint.ADDRESS, Long.toString( address ) );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) ); attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) ); attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition ); attributes.put( ICBreakpoint.CONDITION, condition );
@ -194,7 +194,7 @@ public class CDIDebugModel {
attributes.put( IMarker.CHAR_START, new Integer( charStart ) ); attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
attributes.put( IMarker.CHAR_END, new Integer( charEnd ) ); attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) ); attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put( ICFunctionBreakpoint.FUNCTION, function ); attributes.put( ICLineBreakpoint.FUNCTION, function );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) ); attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) ); attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition ); attributes.put( ICBreakpoint.CONDITION, condition );

View file

@ -0,0 +1,34 @@
/**********************************************************************
* Copyright (c) 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.DebugException;
/**
* Provides access to breakpoint-specific information.
*/
public interface IBreakpointTarget {
/**
* Returns whether this target supports the given breakpoint.
*
* @return whether this target supports the given breakpoint.
*/
boolean isTargetBreakpoint( ICBreakpoint breakpoint );
/**
* Returns the target address of the given breakpoint.
*
* @return the target address of the given breakpoint
* @throws DebugException if the address is not available
*/
long getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException;
}

View file

@ -10,35 +10,9 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.core.runtime.CoreException;
/** /**
* A breakpoint that suspend the execution when a particular address is reached. * A breakpoint that suspend the execution when a particular address is reached.
*/ */
public interface ICAddressBreakpoint extends ICLineBreakpoint { public interface ICAddressBreakpoint extends ICLineBreakpoint {
/**
* Breakpoint attribute storing the address this breakpoint suspends
* execution at (value <code>"org.eclipse.cdt.debug.core.address"</code>).
* This attribute is a <code>String</code>.
*/
public static final String ADDRESS = "org.eclipse.cdt.debug.core.address"; //$NON-NLS-1$
/**
* Returns the address this breakpoint suspends execution at.
*
* @return the address this breakpoint suspends execution at
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getAddress() throws CoreException;
/**
* Sets the address this breakpoint suspends execution at.
*
* @param address the address this breakpoint suspends execution at
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setAddress( String address ) throws CoreException;
} }

View file

@ -28,7 +28,8 @@ public interface ICDebugTarget extends IDebugTarget,
IResumeWithoutSignal, IResumeWithoutSignal,
IState, IState,
ISwitchToThread, ISwitchToThread,
ICDebugElement { ICDebugElement,
IBreakpointTarget {
/** /**
* Returns the shared libraries loaded in this debug target. An * Returns the shared libraries loaded in this debug target. An

View file

@ -10,44 +10,10 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.core.runtime.CoreException;
/** /**
* A breakpoint that suspends the execution when a function is entered. * A breakpoint that suspends the execution when a function is entered.
*/ */
public interface ICFunctionBreakpoint extends ICLineBreakpoint { public interface ICFunctionBreakpoint extends ICLineBreakpoint {
/**
* Breakpoint attribute storing the function this breakpoint suspends
* execution at (value <code>"org.eclipse.cdt.debug.core.function"</code>).
* This attribute is a <code>String</code>.
*/
public static final String FUNCTION = "org.eclipse.cdt.debug.core.function"; //$NON-NLS-1$
/**
* Returns the function this breakpoint suspends execution in.
*
* @return the function this breakpoint suspends execution in
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getFunction() throws CoreException;
/**
* Sets the function this breakpoint suspends execution in.
*
* @param function the function this breakpoint suspends execution in
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setFunction( String function ) throws CoreException;
/**
* Returns the source file of the function.
*
* @return the source file of the function
* @throws CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getFileName() throws CoreException;
} }

View file

@ -10,12 +10,71 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.debug.core.model.ILineBreakpoint;
/** /**
* A breakpoint that suspends the execution when a particular line of code * A breakpoint that suspends the execution when a particular location of code
* is reached. * is reached.
*/ */
public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint { public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
/**
* Breakpoint attribute storing the function this breakpoint suspends
* execution at (value <code>"org.eclipse.cdt.debug.core.function"</code>).
* This attribute is a <code>String</code>.
*/
public static final String FUNCTION = "org.eclipse.cdt.debug.core.function"; //$NON-NLS-1$
/**
* Breakpoint attribute storing the address this breakpoint suspends
* execution at (value <code>"org.eclipse.cdt.debug.core.address"</code>).
* This attribute is a <code>String</code>.
*/
public static final String ADDRESS = "org.eclipse.cdt.debug.core.address"; //$NON-NLS-1$
/**
* Returns the address this breakpoint suspends execution at.
*
* @return the address this breakpoint suspends execution at
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getAddress() throws CoreException;
/**
* Sets the address this breakpoint suspends execution at.
*
* @param address the address this breakpoint suspends execution at
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setAddress( String address ) throws CoreException;
/**
* Returns the function this breakpoint suspends execution in.
*
* @return the function this breakpoint suspends execution in
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getFunction() throws CoreException;
/**
* Sets the function this breakpoint suspends execution in.
*
* @param function the function this breakpoint suspends execution in
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setFunction( String function ) throws CoreException;
/**
* Returns the source file (if available) of this breakpoint.
*
* @return the source file of this breakpoint
* @throws CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getFileName() throws CoreException;
} }

View file

@ -225,7 +225,12 @@ public class CBreakpointManager implements ICDIEventListener, IAdaptable {
} }
public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint ) { public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint ) {
return (getExecFile() != null && getExecFile().getLocation().toOSString().equals( breakpoint.getMarker().getResource().getLocation().toOSString() )); try {
return ( getExecFile() != null && getExecFile().getLocation().toOSString().equals( breakpoint.getSourceHandle() ) );
}
catch( CoreException e ) {
}
return false;
} }
public IFile getCDIBreakpointFile( ICDIBreakpoint cdiBreakpoint ) { public IFile getCDIBreakpointFile( ICDIBreakpoint cdiBreakpoint ) {
@ -353,27 +358,7 @@ public class CBreakpointManager implements ICDIEventListener, IAdaptable {
return; return;
ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint ); ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
if ( breakpoint == null ) { if ( breakpoint == null ) {
try { breakpoint = createLocationBreakpoint( cdiBreakpoint );
if ( cdiBreakpoint.getLocation().getFile() != null && cdiBreakpoint.getLocation().getFile().length() > 0 ) {
ICSourceLocator locator = getSourceLocator();
if ( locator != null ) {
Object sourceElement = locator.findSourceElement( cdiBreakpoint.getLocation().getFile() );
if ( sourceElement != null && sourceElement instanceof IFile ) {
breakpoint = createLineBreakpoint( (IFile)sourceElement, cdiBreakpoint );
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}
catch( CDIException e ) {
}
catch( CoreException e ) {
}
} }
if ( breakpoint != null ) { if ( breakpoint != null ) {
getBreakpointNotifier().breakpointInstalled( getDebugTarget(), breakpoint ); getBreakpointNotifier().breakpointInstalled( getDebugTarget(), breakpoint );
@ -521,6 +506,38 @@ public class CBreakpointManager implements ICDIEventListener, IAdaptable {
throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), code, message, e ) ); throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), code, message, e ) );
} }
private ICLineBreakpoint createLocationBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) {
ICLineBreakpoint breakpoint = null;
try {
if ( !isEmpty( cdiBreakpoint.getLocation().getFile() ) ) {
ICSourceLocator locator = getSourceLocator();
if ( locator != null ) {
Object sourceElement = locator.findSourceElement( cdiBreakpoint.getLocation().getFile() );
if ( sourceElement != null && sourceElement instanceof IFile ) {
breakpoint = createLineBreakpoint( (IFile)sourceElement, cdiBreakpoint );
}
else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
breakpoint = createFunctionBreakpoint( cdiBreakpoint );
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}
}
else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
breakpoint = createFunctionBreakpoint( cdiBreakpoint );
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}
catch( CDIException e ) {
}
catch( CoreException e ) {
}
return breakpoint;
}
private ICLineBreakpoint createLineBreakpoint( IFile file, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { private ICLineBreakpoint createLineBreakpoint( IFile file, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
ICLineBreakpoint breakpoint = CDIDebugModel.createLineBreakpoint( cdiBreakpoint.getLocation().getFile(), ICLineBreakpoint breakpoint = CDIDebugModel.createLineBreakpoint( cdiBreakpoint.getLocation().getFile(),
file, file,
@ -534,6 +551,24 @@ public class CBreakpointManager implements ICDIEventListener, IAdaptable {
return breakpoint; return breakpoint;
} }
private ICFunctionBreakpoint createFunctionBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
IFile execFile = getExecFile();
String sourceHandle = execFile.getFullPath().toOSString();
ICFunctionBreakpoint breakpoint = CDIDebugModel.createFunctionBreakpoint( sourceHandle,
execFile,
cdiBreakpoint.getLocation().getFunction(),
-1,
-1,
-1,
cdiBreakpoint.isEnabled(),
cdiBreakpoint.getCondition().getIgnoreCount(),
cdiBreakpoint.getCondition().getExpression(),
false );
getBreakpointMap().put( breakpoint, cdiBreakpoint );
((CBreakpoint)breakpoint).register( true );
return breakpoint;
}
private ICAddressBreakpoint createAddressBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { private ICAddressBreakpoint createAddressBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
IFile execFile = getExecFile(); IFile execFile = getExecFile();
String sourceHandle = execFile.getFullPath().toOSString(); String sourceHandle = execFile.getFullPath().toOSString();
@ -578,4 +613,8 @@ public class CBreakpointManager implements ICDIEventListener, IAdaptable {
private CBreakpointNotifier getBreakpointNotifier() { private CBreakpointNotifier getBreakpointNotifier() {
return CBreakpointNotifier.getInstance(); return CBreakpointNotifier.getInstance();
} }
private boolean isEmpty( String str ) {
return !( str != null && str.trim().length() > 0 );
}
} }

View file

@ -0,0 +1,105 @@
/**********************************************************************
* Copyright (c) 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.util.Map;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/**
* Base class for different types of location breakponts.
*/
public abstract class AbstractLineBreakpoint extends CBreakpoint implements ICLineBreakpoint {
/**
* Constructor for AbstractLineBreakpoint.
*/
public AbstractLineBreakpoint() {
super();
}
/**
* Constructor for AbstractLineBreakpoint.
*
* @param resource
* @param markerType
* @param attributes
* @param add
* @throws CoreException
*/
public AbstractLineBreakpoint( IResource resource, String markerType, Map attributes, boolean add ) throws CoreException {
super( resource, markerType, attributes, add );
}
/*(non-Javadoc)
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
}
/*(non-Javadoc)
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
*/
public int getCharStart() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
}
/*(non-Javadoc)
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
*/
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#getAddress()
*/
public String getAddress() throws CoreException {
return ensureMarker().getAttribute( ICLineBreakpoint.ADDRESS, "" ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#getFileName()
*/
public String getFileName() throws CoreException {
String fileName = ensureMarker().getAttribute( ICBreakpoint.SOURCE_HANDLE, "" ); //$NON-NLS-1$
IPath path = new Path( fileName );
return ( path.isValidPath( fileName ) ) ? path.lastSegment() : null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#getFunction()
*/
public String getFunction() throws CoreException {
return ensureMarker().getAttribute( ICLineBreakpoint.FUNCTION, "" ); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#setAddress(java.lang.String)
*/
public void setAddress( String address ) throws CoreException {
setAttribute( ICLineBreakpoint.ADDRESS, address );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICLineBreakpoint#setFunction(java.lang.String)
*/
public void setFunction( String function ) throws CoreException {
setAttribute( ICLineBreakpoint.FUNCTION, function );
}
}

View file

@ -15,14 +15,13 @@ import java.util.Map;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.CDebugUtils; import org.eclipse.cdt.debug.internal.core.CDebugUtils;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
/** /**
* A breakpoint that suspend the execution when a particular address is reached. * A breakpoint that suspend the execution when a particular address is reached.
*/ */
public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoint { public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddressBreakpoint {
private static final String C_ADDRESS_BREAKPOINT = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$ private static final String C_ADDRESS_BREAKPOINT = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
@ -39,51 +38,6 @@ public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoi
super( resource, getMarkerType(), attributes, add ); super( resource, getMarkerType(), attributes, add );
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#getAddress()
*/
public String getAddress() throws CoreException {
return ensureMarker().getAttribute( ADDRESS, null );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#setAddress(long)
*/
public void setAddress( String address ) throws CoreException {
setAttribute( ADDRESS, address );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
*/
public int getCharStart() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
*/
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
/** /**
* Returns the type of marker associated with this type of breakpoints * Returns the type of marker associated with this type of breakpoints
*/ */

View file

@ -14,25 +14,16 @@ import java.text.MessageFormat;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
/** /**
* A breakpoint that suspends the execution when a function is entered. * A breakpoint that suspends the execution when a function is entered.
*/ */
public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakpoint { public class CFunctionBreakpoint extends AbstractLineBreakpoint implements ICFunctionBreakpoint {
private static final String C_FUNCTION_BREAKPOINT = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$ private static final String C_FUNCTION_BREAKPOINT = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
/**
* Breakpoint attribute storing the function this breakpoint suspends
* execution in (value <code>"org.eclipse.cdt.debug.core.function"</code>).
* This attribute is a <code>String</code>.
*/
protected static final String FUNCTION = "org.eclipse.cdt.debug.core.function"; //$NON-NLS-1$
/** /**
* Constructor for CFunctionBreakpoint. * Constructor for CFunctionBreakpoint.
*/ */
@ -46,51 +37,6 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp
super( resource, getMarkerType(), attributes, add ); super( resource, getMarkerType(), attributes, add );
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#getFunction()
*/
public String getFunction() throws CoreException {
return ensureMarker().getAttribute( FUNCTION, null );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#setFunction(String)
*/
public void setFunction( String function ) throws CoreException {
setAttribute( FUNCTION, function );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
*/
public int getCharStart() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
*/
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
/** /**
* Returns the type of marker associated with this type of breakpoints * Returns the type of marker associated with this type of breakpoints
*/ */
@ -98,22 +44,7 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp
return C_FUNCTION_BREAKPOINT; return C_FUNCTION_BREAKPOINT;
} }
/* /*(non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint#getFileName()
*/
public String getFileName() throws CoreException {
IResource resource = ensureMarker().getResource();
if ( resource instanceof IFile ) {
return ((IFile)resource).getLocation().lastSegment();
}
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage() * @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/ */
protected String getMarkerMessage() throws CoreException { protected String getMarkerMessage() throws CoreException {
@ -130,4 +61,4 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp
sb.append( getConditionText() ); sb.append( getConditionText() );
return sb.toString(); return sb.toString();
} }
} }

View file

@ -13,8 +13,6 @@ package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -22,7 +20,7 @@ import org.eclipse.core.runtime.CoreException;
* A breakpoint that suspends the execution when a particular line of code is * A breakpoint that suspends the execution when a particular line of code is
* reached. * reached.
*/ */
public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint { public class CLineBreakpoint extends AbstractLineBreakpoint {
private static final String C_LINE_BREAKPOINT = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$ private static final String C_LINE_BREAKPOINT = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
@ -39,33 +37,6 @@ public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint {
super( resource, getMarkerType(), attributes, add ); super( resource, getMarkerType(), attributes, add );
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
*/
public int getCharStart() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
*/
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
/** /**
* Returns the type of marker associated with this type of breakpoints * Returns the type of marker associated with this type of breakpoints
*/ */
@ -73,9 +44,7 @@ public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint {
return C_LINE_BREAKPOINT; return C_LINE_BREAKPOINT;
} }
/* /*(non-Javadoc)
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage() * @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/ */
protected String getMarkerMessage() throws CoreException { protected String getMarkerMessage() throws CoreException {

View file

@ -53,12 +53,14 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICDISignal; import org.eclipse.cdt.debug.core.cdi.model.ICDISignal;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.model.IBreakpointTarget;
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;
import org.eclipse.cdt.debug.core.model.ICDebugElementErrorStatus; import org.eclipse.cdt.debug.core.model.ICDebugElementErrorStatus;
import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICDebugTargetType; import org.eclipse.cdt.debug.core.model.ICDebugTargetType;
import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator; import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICSharedLibrary; import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
import org.eclipse.cdt.debug.core.model.ICSignal; import org.eclipse.cdt.debug.core.model.ICSignal;
import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport; import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport;
@ -997,6 +999,8 @@ public class CDebugTarget extends CDebugElement
return this; return this;
if ( adapter.equals( IJumpToAddress.class ) ) if ( adapter.equals( IJumpToAddress.class ) )
return this; return this;
if ( adapter.equals( IBreakpointTarget.class ) )
return this;
if ( adapter.equals( CBreakpointManager.class ) ) if ( adapter.equals( CBreakpointManager.class ) )
return getBreakpointManager(); return getBreakpointManager();
if ( adapter.equals( DisassemblyManager.class ) ) if ( adapter.equals( DisassemblyManager.class ) )
@ -2452,4 +2456,18 @@ public class CDebugTarget extends CDebugElement
fDisassembly.dispose(); fDisassembly.dispose();
fDisassembly = null; fDisassembly = null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint)
*/
public long getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException {
return ( getBreakpointManager() != null ) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : 0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#isTargetBreakpoint(org.eclipse.cdt.debug.core.model.ICBreakpoint)
*/
public boolean isTargetBreakpoint( ICBreakpoint breakpoint ) {
return ( getBreakpointManager() != null ) ? getBreakpointManager().isTargetBreakpoint( breakpoint ) : false;
}
} }