1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Implementing retargettable breakpoint related actions.

This commit is contained in:
Mikhail Khodjaiants 2004-04-12 22:33:55 +00:00
parent 9494a0f14e
commit 2a72346aa5
31 changed files with 1536 additions and 1819 deletions

View file

@ -1,3 +1,23 @@
2004-04-12 Mikhail Khodjaiants
Implementing retargettable breakpoint related actions.
* CDebugModel.java
* CDIDebugModel.java
* ICAddressBreakpoint.java
* ICBreakpoint.java
* ICFunctionBreakpoint.java
* ICLineBreakpoint.java
* ICWatchpoint.java
* CBreakpointManager.java
* CDebugUtils.java
* BreakpointMessages.properties
* BreakpointMessages.java
* CAddressBreakpoint.java
* CBreakpoint.java
* CFunctionBreakpoint.java
* CLineBreakpoint.java
* CWatchpoint.java
* plugin.xml
2004-04-11 Mikhail Khodjaiants
Stack frame should provide an adapter for IRunToLine.
* CStackFrame.java

View file

@ -43,6 +43,9 @@
<attribute
name="org.eclipse.cdt.debug.core.installCount">
</attribute>
<attribute
name="org.eclipse.cdt.debug.core.sourceHandle">
</attribute>
</extension>
<extension
id="commonCLineBreakpointMarker"

View file

@ -1,16 +1,36 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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;
import java.util.HashMap;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
/**
* Provides utility methods for creating debug sessions, targets and
* breakpoints specific to the CDI debug model.
*
* @since: Feb 23, 2004
*/
public class CDIDebugModel {
/**
@ -21,4 +41,312 @@ public class CDIDebugModel {
public static String getPluginIdentifier() {
return CDebugCorePlugin.getUniqueIdentifier();
}
/**
* Creates and returns a line breakpoint for the source defined by
* the given source handle, at the given line number. The marker associated
* with the breakpoint will be created on the specified resource.
*
* @param sourceHandle the handle to the breakpoint source
* @param resource the resource on which to create the associated breakpoint marker
* @param lineNumber the line number on which the breakpoint is set - line
* numbers are 1 based, associated with the source file in which the breakpoint is set
* @param enabled whether to enable or disable this breakpoint
* @param ignoreCount the number of times this breakpoint will be ignored
* @param condition the breakpoint condition
* @param register whether to add this breakpoint to the breakpoint manager
* @return a line breakpoint
* @throws CoreException if this method fails. Reasons include:<ul>
* <li>Failure creating underlying marker. The exception's status contains
* the underlying exception responsible for the failure.</li></ul>
*/
public static ICLineBreakpoint createLineBreakpoint( String sourceHandle,
IResource resource,
int lineNumber,
boolean enabled,
int ignoreCount,
String condition,
boolean register ) throws CoreException {
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
return new CLineBreakpoint( resource, attributes, register );
}
/**
* Creates and returns an address breakpoint for the source defined by
* the given source handle, at the given address. The marker associated
* with the breakpoint will be created on the specified resource.
*
* @param sourceHandle the handle to the breakpoint source
* @param resource the resource on which to create the associated breakpoint marker
* @param address the address on which the breakpoint is set
* @param enabled whether to enable or disable this breakpoint
* @param ignoreCount the number of times this breakpoint will be ignored
* @param condition the breakpoint condition
* @param register whether to add this breakpoint to the breakpoint manager
* @return an address breakpoint
* @throws CoreException if this method fails. Reasons include:<ul>
* <li>Failure creating underlying marker. The exception's status contains
* the underlying exception responsible for the failure.</li></ul>
*/
public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle,
IResource resource,
long address,
boolean enabled,
int ignoreCount,
String condition,
boolean register ) throws CoreException {
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IMarker.CHAR_START, 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( ICAddressBreakpoint.ADDRESS, Long.toString( address ) );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
return new CAddressBreakpoint( resource, attributes, register );
}
/**
* Creates and returns a watchpoint for the source defined by
* the given source handle, at the given expression. The marker associated
* with the watchpoint will be created on the specified resource.
*
* @param sourceHandle the handle to the watchpoint source
* @param resource the resource on which to create the associated watchpoint marker
* @param writeAccess whether this is write watchpoint
* @param readAccess whether this is read watchpoint
* @param expression the expression on which the watchpoint is set
* @param enabled whether to enable or disable this breakpoint
* @param ignoreCount the number of times this breakpoint will be ignored
* @param condition the breakpoint condition
* @param register whether to add this breakpoint to the breakpoint manager
* @return a watchpoint
* @throws CoreException if this method fails. Reasons include:<ul>
* <li>Failure creating underlying marker. The exception's status contains
* the underlying exception responsible for the failure.</li></ul>
*/
public static ICWatchpoint createWatchpoint( String sourceHandle,
IResource resource,
boolean writeAccess,
boolean readAccess,
String expression,
boolean enabled,
int ignoreCount,
String condition,
boolean register ) throws CoreException {
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
attributes.put( ICWatchpoint.EXPRESSION, expression );
attributes.put( ICWatchpoint.READ, new Boolean( readAccess ) );
attributes.put( ICWatchpoint.WRITE, new Boolean( writeAccess ) );
return new CWatchpoint( resource, attributes, register );
}
/**
* Creates and returns a breakpoint for the function defined by
* the given name. The marker associated with the breakpoint will
* be created on the specified resource.
*
* @param sourceHandle the handle to the breakpoint source
* @param resource the resource on which to create the associated breakpoint marker
* @param function the name of the function this breakpoint suspends execution in
* @param charStart the first character index associated with the breakpoint,
* or -1 if unspecified, in the source file in which the breakpoint is set
* @param charEnd the last character index associated with the breakpoint,
* or -1 if unspecified, in the source file in which the breakpoint is set
* @param lineNumber the lineNumber on which the breakpoint is set, or -1 if
* unspecified - line numbers are 1 based, associated with the source file
* in which the breakpoint is set
* @param enabled whether to enable or disable this breakpoint
* @param ignoreCount the number of times this breakpoint will be ignored
* @param condition the breakpoint condition
* @param register whether to add this breakpoint to the breakpoint manager
* @return an address breakpoint
* @throws CoreException if this method fails. Reasons include:<ul>
* <li>Failure creating underlying marker. The exception's status contains
* the underlying exception responsible for the failure.</li></ul>
*/
public static ICFunctionBreakpoint createFunctionBreakpoint( String sourceHandle,
IResource resource,
String function,
int charStart,
int charEnd,
int lineNumber,
boolean enabled,
int ignoreCount,
String condition,
boolean register ) throws CoreException {
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put( ICFunctionBreakpoint.FUNCTION, function );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put( ICBreakpoint.SOURCE_HANDLE, sourceHandle );
return new CFunctionBreakpoint( resource, attributes, register );
}
/**
* Returns the line breakpoint that is already registered with the breakpoint
* manager for a source with the given handle and the given resource at the
* given line number.
*
* @param sourceHandle the source handle
* @param resource the breakpoint resource
* @param lineNumber the line number
* @return the line breakpoint that is already registered with the breakpoint
* manager or <code>null</code> if no such breakpoint is registered
* @exception CoreException if unable to retrieve the associated marker
* attributes (line number).
*/
public static ICLineBreakpoint lineBreakpointExists( String sourceHandle, IResource resource, int lineNumber ) throws CoreException {
String modelId = getPluginIdentifier();
String markerType = CLineBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for( int i = 0; i < breakpoints.length; i++ ) {
if ( !(breakpoints[i] instanceof ICLineBreakpoint) ) {
continue;
}
ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) ) {
if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
if ( breakpoint.getMarker().getResource().equals( resource ) ) {
if ( breakpoint.getLineNumber() == lineNumber ) {
return breakpoint;
}
}
}
}
}
return null;
}
/**
* Returns the address breakpoint that is already registered with the breakpoint
* manager for a source with the given handle and the given resource at the
* given address.
*
* @param sourceHandle the source handle
* @param resource the breakpoint resource
* @param address the address
* @return the address breakpoint that is already registered with the breakpoint
* manager or <code>null</code> if no such breakpoint is registered
* @exception CoreException if unable to retrieve the associated marker
* attributes (line number).
*/
public static ICAddressBreakpoint addressBreakpointExists( String sourceHandle, IResource resource, long address ) throws CoreException {
String modelId = getPluginIdentifier();
String markerType = CAddressBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for( int i = 0; i < breakpoints.length; i++ ) {
if ( !(breakpoints[i] instanceof ICAddressBreakpoint) ) {
continue;
}
ICAddressBreakpoint breakpoint = (ICAddressBreakpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) ) {
if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
if ( breakpoint.getMarker().getResource().equals( resource ) ) {
try {
if ( Long.parseLong( breakpoint.getAddress() ) == address ) {
return breakpoint;
}
}
catch( NumberFormatException e ) {
}
}
}
}
}
return null;
}
/**
* Returns the watchpoint that is already registered with the breakpoint
* manager for a source with the given handle and the given resource at the
* given expression.
*
* @param sourceHandle the source handle
* @param resource the breakpoint resource
* @param expression the expression
* @return the watchpoint that is already registered with the breakpoint
* manager or <code>null</code> if no such watchpoint is registered
* @exception CoreException if unable to retrieve the associated marker
* attributes (line number).
*/
public static ICWatchpoint watchpointExists( String sourceHandle, IResource resource, String expression ) throws CoreException {
String modelId = getPluginIdentifier();
String markerType = CWatchpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for( int i = 0; i < breakpoints.length; i++ ) {
if ( !(breakpoints[i] instanceof ICWatchpoint) ) {
continue;
}
ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) ) {
if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
if ( breakpoint.getMarker().getResource().equals( resource ) ) {
if ( breakpoint.getExpression().equals( expression ) ) {
return breakpoint;
}
}
}
}
}
return null;
}
/**
* Returns the function breakpoint that is already registered with the breakpoint
* manager for a source with the given handle and the given resource with the
* given function name.
*
* @param sourceHandle the source handle
* @param resource the breakpoint resource
* @param function the fully qualified function name
* @return the breakpoint that is already registered with the breakpoint
* manager or <code>null</code> if no such breakpoint is registered
* @exception CoreException if unable to retrieve the associated marker
* attributes (line number).
*/
public static ICFunctionBreakpoint functionBreakpointExists( String sourceHandle, IResource resource, String function ) throws CoreException {
String modelId = getPluginIdentifier();
String markerType = CFunctionBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for( int i = 0; i < breakpoints.length; i++ ) {
if ( !(breakpoints[i] instanceof ICFunctionBreakpoint) ) {
continue;
}
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) ) {
if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) {
if ( breakpoint.getMarker().getResource().equals( resource ) ) {
if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( function ) ) {
return breakpoint;
}
}
}
}
}
return null;
}
}

View file

@ -263,287 +263,6 @@ public class CDebugModel
return target[0];
}
/**
* Returns a C/C++ line breakpoint that is already registered with the breakpoint
* manager for a file with the given name at the given line number.
*
* @param fileName fully qualified file name
* @param lineNumber line number
* @return a C/C++ line breakpoint that is already registered with the breakpoint
* manager for a file with the given name at the given line number or <code>null</code>
* if no such breakpoint is registered
* @exception CoreException if unable to retrieve the associated marker
* attributes (line number).
*/
public static ICLineBreakpoint lineBreakpointExists( String fileName, int lineNumber ) throws CoreException
{
String modelId = getPluginIdentifier();
String markerType = CLineBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for ( int i = 0; i < breakpoints.length; i++ )
{
if ( !( breakpoints[i] instanceof ICLineBreakpoint ) )
{
continue;
}
ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) )
{
if ( breakpoint.getMarker().getResource().getLocation().toOSString().equals( fileName ) )
{
if ( breakpoint.getLineNumber() == lineNumber )
{
return breakpoint;
}
}
}
}
return null;
}
public static ICLineBreakpoint createLineBreakpoint( IResource resource,
int lineNumber,
boolean enabled,
int ignoreCount,
String condition,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
return new CLineBreakpoint( resource, attributes, add );
}
public static ICAddressBreakpoint addressBreakpointExists( IResource resource, long address ) throws CoreException
{
String modelId = getPluginIdentifier();
String markerType = CAddressBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for ( int i = 0; i < breakpoints.length; i++ )
{
if ( !( breakpoints[i] instanceof ICAddressBreakpoint ) )
{
continue;
}
ICAddressBreakpoint breakpoint = (ICAddressBreakpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) )
{
if ( breakpoint.getMarker().getResource().getLocation().toOSString().equals( resource.getLocation().toOSString() ) )
{
try
{
if ( Long.parseLong( breakpoint.getAddress() ) == address )
{
return breakpoint;
}
}
catch( NumberFormatException e )
{
}
}
}
}
return null;
}
public static ICAddressBreakpoint createAddressBreakpoint( IResource resource,
long address,
boolean enabled,
int ignoreCount,
String condition,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IMarker.CHAR_START, 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( ICAddressBreakpoint.ADDRESS, Long.toString( address ) );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
return new CAddressBreakpoint( resource, attributes, add );
}
public static ICFunctionBreakpoint functionBreakpointExists( IFunction function ) throws CoreException
{
String modelId = getPluginIdentifier();
String markerType = CFunctionBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for ( int i = 0; i < breakpoints.length; i++ )
{
if ( !( breakpoints[i] instanceof ICFunctionBreakpoint ) )
{
continue;
}
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) )
{
if ( breakpoint.getMarker().getResource().equals( CDebugUtils.getFunctionResource( function ) ) )
{
if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( CDebugUtils.getFunctionName( function ) ) )
{
return breakpoint;
}
}
}
}
return null;
}
public static ICFunctionBreakpoint createFunctionBreakpoint( IFunction function,
boolean enabled,
int ignoreCount,
String condition,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
int lineNumber = -1;
int charStart = -1;
int charEnd = -1;
try
{
ISourceRange sourceRange = function.getSourceRange();
if ( sourceRange != null )
{
charStart = sourceRange.getStartPos();
charEnd = charStart + sourceRange.getLength();
// for now
if ( charEnd == 0 )
lineNumber = sourceRange.getStartLine();
}
}
catch( CModelException e )
{
CDebugCorePlugin.log( e.getStatus() );
}
attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put( ICFunctionBreakpoint.FUNCTION, CDebugUtils.getFunctionName( function ) );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
return new CFunctionBreakpoint( CDebugUtils.getFunctionResource( function ), attributes, add );
}
public static ICFunctionBreakpoint methodBreakpointExists( IMethod method ) throws CoreException
{
String modelId = getPluginIdentifier();
String markerType = CFunctionBreakpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for ( int i = 0; i < breakpoints.length; i++ )
{
if ( !( breakpoints[i] instanceof ICFunctionBreakpoint ) )
{
continue;
}
ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType ) )
{
if ( breakpoint.getMarker().getResource().equals( CDebugUtils.getMethodResource( method ) ) )
{
if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( CDebugUtils.getMethodQualifiedName( method ) ) )
{
return breakpoint;
}
}
}
}
return null;
}
public static ICFunctionBreakpoint createMethodBreakpoint( IMethod method,
boolean enabled,
int ignoreCount,
String condition,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
int lineNumber = -1;
int charStart = -1;
int charEnd = -1;
try
{
ISourceRange sourceRange = method.getSourceRange();
if ( sourceRange != null )
{
charStart = sourceRange.getStartPos();
charEnd = charStart + sourceRange.getLength();
// for now
if ( charEnd == 0 )
lineNumber = sourceRange.getStartLine();
}
}
catch( CModelException e )
{
CDebugCorePlugin.log( e.getStatus() );
}
attributes.put( IMarker.CHAR_START, new Integer( charStart ) );
attributes.put( IMarker.CHAR_END, new Integer( charEnd ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( lineNumber ) );
attributes.put( ICFunctionBreakpoint.FUNCTION, CDebugUtils.getMethodQualifiedName( method ) );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
return new CFunctionBreakpoint( CDebugUtils.getMethodResource( method ), attributes, add );
}
public static ICWatchpoint watchpointExists( IResource resource, boolean write, boolean read, String expression ) throws CoreException
{
String modelId = getPluginIdentifier();
String markerType = CWatchpoint.getMarkerType();
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = manager.getBreakpoints( modelId );
for ( int i = 0; i < breakpoints.length; i++ )
{
if ( !( breakpoints[i] instanceof ICWatchpoint ) )
{
continue;
}
ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i];
if ( breakpoint.getMarker().getType().equals( markerType )&&
breakpoint.getMarker().getResource().equals( resource ) &&
breakpoint.isWriteType() == write &&
breakpoint.isReadType() == read &&
breakpoint.getExpression().equals( expression ) )
{
return breakpoint;
}
}
return null;
}
public static ICWatchpoint createWatchpoint( IResource resource,
boolean writeAccess,
boolean readAccess,
String expression,
boolean enabled,
int ignoreCount,
String condition,
boolean add ) throws DebugException
{
HashMap attributes = new HashMap( 10 );
attributes.put( IBreakpoint.ID, getPluginIdentifier() );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition );
attributes.put( ICWatchpoint.EXPRESSION, expression );
attributes.put( ICWatchpoint.READ, new Boolean( readAccess ) );
attributes.put( ICWatchpoint.WRITE, new Boolean( writeAccess ) );
return new CWatchpoint( resource, attributes, add );
}
public static IExpression createExpression( IDebugTarget target, String text ) throws DebugException
{

View file

@ -1,19 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.core.runtime.IAdaptable;
/**
* Enter type comment.
*
* @since: Jan 7, 2003
*/
public interface ICBreakpointManager extends IAdaptable
{
long getBreakpointAddress( ICBreakpoint breakpoint );
}

View file

@ -1,22 +1,24 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.core.runtime.CoreException;
/**
*
* A breakpoint that suspend execution when a particular address is reached.
*
* @since Aug 21, 2002
* 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
* 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>.
*/
@ -26,8 +28,8 @@ public interface ICAddressBreakpoint extends ICLineBreakpoint
* 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
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getAddress() throws CoreException;
@ -35,8 +37,8 @@ public interface ICAddressBreakpoint extends ICLineBreakpoint
* 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
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setAddress( String address ) throws CoreException;
}
}

View file

@ -1,64 +1,72 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.core.runtime.CoreException;
import org.eclipse.debug.core.model.IBreakpoint;
/**
*
* A breakpoint specific to the C/C++ debug model. A C/C++ breakpoint supports:
* <ul>
* <li>a condition</li>
* <li>an ignore count</li>
* <li>a thread filter to restrict a breakpoin to a specific thread</li>
* <li>a thread filter to restrict the breakpoint to a specific thread</li>
* <li>an installed property that indicates a breakpoint was successfully
* installed in debug target</li>
* installed in debug target</li>
* </ul>
*
* @since Aug 21, 2002
*/
public interface ICBreakpoint extends IBreakpoint
{
public interface ICBreakpoint extends IBreakpoint {
/**
* Breakpoint attribute storing the number of debug targets a
* breakpoint is installed in (value <code>"org.eclipse.cdt.debug.core.installCount"</code>).
* This attribute is a <code>int</code>.
* Breakpoint attribute storing the number of debug targets a breakpoint is
* installed in (value <code>"org.eclipse.cdt.debug.core.installCount"</code>).
* This attribute is an <code>int</code>.
*/
public static final String INSTALL_COUNT = "org.eclipse.cdt.debug.core.installCount"; //$NON-NLS-1$
/**
* Breakpoint attribute storing the conditional expression
* associated with this breakpoint (value <code>"org.eclipse.cdt.debug.core.condition"</code>).
* Breakpoint attribute storing the conditional expression associated with
* this breakpoint (value <code>"org.eclipse.cdt.debug.core.condition"</code>).
* This attribute is a <code>String</code>.
*/
public static final String CONDITION = "org.eclipse.cdt.debug.core.condition"; //$NON-NLS-1$
/**
* Breakpoint attribute storing a breakpoint's ignore count value
* (value <code>"org.eclipse.cdt.debug.core.ignoreCount"</code>).
* This attribute is a <code>int</code>.
* Breakpoint attribute storing a breakpoint's ignore count value (value
* <code>"org.eclipse.cdt.debug.core.ignoreCount"</code>). This attribute
* is an <code>int</code>.
*/
public static final String IGNORE_COUNT = "org.eclipse.cdt.debug.core.ignoreCount"; //$NON-NLS-1$
/**
* Breakpoint attribute storing an identifier of the thread this
* breakpoint is restricted in (value <code>"org.eclipse.cdt.debug.core.threadId"</code>).
* Breakpoint attribute storing an identifier of the thread this breakpoint
* is restricted in (value <code>"org.eclipse.cdt.debug.core.threadId"</code>).
* This attribute is a <code>String</code>.
*/
public static final String THREAD_ID = "org.eclipse.cdt.debug.core.threadId"; //$NON-NLS-1$
/**
* Returns whether this breakpoint is installed in at least
* one debug target.
* Breakpoint attribute storing a source handle this breakpoint
* is set in (value <code>"org.eclipse.cdt.debug.core.sourceHandle"</code>).
* This attribute is a <code>String</code>.
*/
public static final String SOURCE_HANDLE = "org.eclipse.cdt.debug.core.sourceHandle"; //$NON-NLS-1$
/**
* Returns whether this breakpoint is installed in at least one debug
* target.
*
* @return whether this breakpoint is installed
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public boolean isInstalled() throws CoreException;
@ -66,8 +74,8 @@ public interface ICBreakpoint extends IBreakpoint
* Returns whether this breakpoint is conditional.
*
* @return whether this breakpoint is conditional
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public boolean isConditional() throws CoreException;
@ -75,8 +83,8 @@ public interface ICBreakpoint extends IBreakpoint
* Returns the conditional expression associated with this breakpoint.
*
* @return this breakpoint's conditional expression
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getCondition() throws CoreException;
@ -84,8 +92,8 @@ public interface ICBreakpoint extends IBreakpoint
* Sets the condition associated with this breakpoint.
*
* @param condition the conditional expression
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setCondition( String condition ) throws CoreException;
@ -93,8 +101,8 @@ public interface ICBreakpoint extends IBreakpoint
* Returns the ignore count used by this breakpoint.
*
* @return the ignore count used by this breakpoint
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public int getIgnoreCount() throws CoreException;
@ -102,8 +110,8 @@ public interface ICBreakpoint extends IBreakpoint
* Sets the ignore count attribute for this breakpoint.
*
* @param ignoreCount the new ignore count
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setIgnoreCount( int ignoreCount ) throws CoreException;
@ -111,18 +119,36 @@ public interface ICBreakpoint extends IBreakpoint
* Returns the identifier of the thread this breakpoint is restricted in.
*
* @return the thread identifier
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getThreadId() throws CoreException;
/**
* Restricts this breakpoint to suspend only in the given thread
* when encounterd in the given thread's target.
* Restricts this breakpoint to suspend only in the given thread when
* encounterd in the given thread's target.
*
* @param threadId the thread identifier
* @exception CoreException if unable to access the property
* on this breakpoint's underlying marker
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setThreadId( String threadId ) throws CoreException;
}
/**
* Returns the source handle this breakpoint is set in.
*
* @return the source handle
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getSourceHandle() throws CoreException;
/**
* Sets the source handle of this breakpoint.
*
* @param sourceHandle the source handle
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public void setSourceHandle( String sourceHandle ) throws CoreException;
}

View file

@ -1,22 +1,24 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.core.runtime.CoreException;
/**
*
* A breakpoint that suspend execution when a function is entered.
*
* @since Aug 21, 2002
* 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
* 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>.
*/
@ -26,8 +28,8 @@ public interface ICFunctionBreakpoint extends ICLineBreakpoint
* 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
* @exception CoreException if unable to access the property on this breakpoint's
* underlying marker
*/
public String getFunction() throws CoreException;
@ -35,10 +37,17 @@ public interface ICFunctionBreakpoint extends ICLineBreakpoint
* 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
* @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

@ -1,20 +1,21 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.model.ILineBreakpoint;
/**
*
* A breakpoint that suspend execution when a particular line of code
* A breakpoint that suspends the execution when a particular line of code
* is reached.
*
* @since Aug 21, 2002
*/
public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint
{
public interface ICLineBreakpoint extends ICBreakpoint, ILineBreakpoint {
}

View file

@ -1,20 +1,22 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.core.runtime.CoreException;
/**
*
* A watchpoint specific to the C/C++ debug model.
*
* @since Sep 4, 2002
*/
public interface ICWatchpoint extends ICBreakpoint
{
public interface ICWatchpoint extends ICBreakpoint {
/**
* Watchpoint attribute storing the expression associated with this
* watchpoint (value <code>"org.eclipse.cdt.debug.core.expression"</code>).
@ -33,21 +35,21 @@ public interface ICWatchpoint extends ICBreakpoint
* This attribute is a <code>boolean</code>.
*/
public static final String READ = "org.eclipse.cdt.debug.core.read"; //$NON-NLS-1$
/**
* Returns whether this watchppoint is a write watchpoint.
*
* @return whether this watchppoint is a write watchpoint
*/
boolean isWriteType() throws CoreException;
/**
* Returns whether this watchppoint is a read watchpoint.
*
* @return whether this watchppoint is a read watchpoint
*/
boolean isReadType() throws CoreException;
/**
* Returns the watchpoint's expression.
*
@ -55,4 +57,4 @@ public interface ICWatchpoint extends ICBreakpoint
* @throws CDIException if this method fails. Reasons include:
*/
String getExpression() throws CoreException;
}
}

View file

@ -1,18 +1,21 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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;
import java.util.HashMap;
import java.util.Set;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICBreakpointManager;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager;
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
@ -49,14 +52,13 @@ import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.ISourceLocator;
/**
* Enter type comment.
*
* @since Nov 3, 2003
* The breakpoint manager manages all breakpoints set to the associated
* debug target.
*/
public class CBreakpointManager implements ICBreakpointManager, ICDIEventListener, IAdaptable
{
public class BreakpointMap
{
public class CBreakpointManager implements ICDIEventListener, IAdaptable {
private class BreakpointMap {
/**
* Maps CBreakpoints to CDI breakpoints.
*/
@ -67,73 +69,61 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
*/
private HashMap fCDIBreakpoints;
protected BreakpointMap()
{
protected BreakpointMap() {
fCBreakpoints = new HashMap( 10 );
fCDIBreakpoints = new HashMap( 10 );
}
protected synchronized void put( ICBreakpoint breakpoint, ICDIBreakpoint cdiBreakpoint )
{
protected synchronized void put( ICBreakpoint breakpoint, ICDIBreakpoint cdiBreakpoint ) {
fCBreakpoints.put( breakpoint, cdiBreakpoint );
fCDIBreakpoints.put( cdiBreakpoint, breakpoint );
}
protected synchronized ICDIBreakpoint getCDIBreakpoint( ICBreakpoint breakpoint )
{
protected synchronized ICDIBreakpoint getCDIBreakpoint( ICBreakpoint breakpoint ) {
return (ICDIBreakpoint)fCBreakpoints.get( breakpoint );
}
protected synchronized ICBreakpoint getCBreakpoint( ICDIBreakpoint cdiBreakpoint )
{
protected synchronized ICBreakpoint getCBreakpoint( ICDIBreakpoint cdiBreakpoint ) {
return (ICBreakpoint)fCDIBreakpoints.get( cdiBreakpoint );
}
protected void removeCBreakpoint( ICBreakpoint breakpoint )
{
if ( breakpoint != null )
{
protected void removeCBreakpoint( ICBreakpoint breakpoint ) {
if ( breakpoint != null ) {
ICDIBreakpoint cdiBreakpoint = (ICDIBreakpoint)fCBreakpoints.remove( breakpoint );
if ( cdiBreakpoint != null )
fCDIBreakpoints.remove( cdiBreakpoint );
fCDIBreakpoints.remove( cdiBreakpoint );
}
}
protected void removeCDIBreakpoint( ICBreakpoint breakpoin, ICDIBreakpoint cdiBreakpoint )
{
if ( cdiBreakpoint != null )
{
protected void removeCDIBreakpoint( ICBreakpoint breakpoin, ICDIBreakpoint cdiBreakpoint ) {
if ( cdiBreakpoint != null ) {
ICBreakpoint breakpoint = (ICBreakpoint)fCDIBreakpoints.remove( cdiBreakpoint );
if ( breakpoint != null )
fCBreakpoints.remove( breakpoint );
fCBreakpoints.remove( breakpoint );
}
}
protected ICBreakpoint[] getAllCBreakpoints()
{
protected ICBreakpoint[] getAllCBreakpoints() {
Set set = fCBreakpoints.keySet();
return (ICBreakpoint[])set.toArray( new ICBreakpoint[set.size()]);
return (ICBreakpoint[])set.toArray( new ICBreakpoint[set.size()] );
}
protected ICDIBreakpoint[] getAllCDIBreakpoints()
{
protected ICDIBreakpoint[] getAllCDIBreakpoints() {
Set set = fCDIBreakpoints.keySet();
return (ICDIBreakpoint[])set.toArray( new ICDIBreakpoint[set.size()]);
return (ICDIBreakpoint[])set.toArray( new ICDIBreakpoint[set.size()] );
}
protected void dispose()
{
protected void dispose() {
fCBreakpoints.clear();
fCDIBreakpoints.clear();
}
}
private CDebugTarget fDebugTarget;
private BreakpointMap fMap;
public CBreakpointManager( CDebugTarget target )
{
public CBreakpointManager( CDebugTarget target ) {
super();
setDebugTarget( target );
fMap = new BreakpointMap();
@ -143,8 +133,7 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
public Object getAdapter( Class adapter )
{
public Object getAdapter( Class adapter ) {
if ( CBreakpointManager.class.equals( adapter ) )
return this;
if ( CDebugTarget.class.equals( adapter ) )
@ -156,31 +145,26 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
return null;
}
public CDebugTarget getDebugTarget()
{
public CDebugTarget getDebugTarget() {
return fDebugTarget;
}
private void setDebugTarget( CDebugTarget target )
{
private void setDebugTarget( CDebugTarget target ) {
fDebugTarget = target;
}
protected ICDIBreakpointManager getCDIBreakpointManager()
{
protected ICDIBreakpointManager getCDIBreakpointManager() {
return getDebugTarget().getCDISession().getBreakpointManager();
}
protected ICSourceLocator getCSourceLocator()
{
protected ICSourceLocator getCSourceLocator() {
ISourceLocator locator = getDebugTarget().getLaunch().getSourceLocator();
if ( locator instanceof IAdaptable )
if ( locator instanceof IAdaptable )
return (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
return null;
}
public void dispose()
{
public void dispose() {
getDebugTarget().getCDISession().getEventManager().removeEventListener( this );
removeAllBreakpoints();
getBreakpointMap().dispose();
@ -189,26 +173,20 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener#handleDebugEvents(org.eclipse.cdt.debug.core.cdi.event.ICDIEvent)
*/
public void handleDebugEvents( ICDIEvent[] events )
{
for (int i = 0; i < events.length; i++)
{
public void handleDebugEvents( ICDIEvent[] events ) {
for( int i = 0; i < events.length; i++ ) {
ICDIEvent event = events[i];
ICDIObject source = event.getSource();
if ( source != null && source.getTarget().equals( getDebugTarget().getCDITarget() ) )
{
if ( event instanceof ICDICreatedEvent )
{
if ( source != null && source.getTarget().equals( getDebugTarget().getCDITarget() ) ) {
if ( event instanceof ICDICreatedEvent ) {
if ( source instanceof ICDIBreakpoint )
handleBreakpointCreatedEvent( (ICDIBreakpoint)source );
}
else if ( event instanceof ICDIDestroyedEvent )
{
else if ( event instanceof ICDIDestroyedEvent ) {
if ( source instanceof ICDIBreakpoint )
handleBreakpointDestroyedEvent( (ICDIBreakpoint)source );
}
else if ( event instanceof ICDIChangedEvent )
{
else if ( event instanceof ICDIChangedEvent ) {
if ( source instanceof ICDIBreakpoint )
handleBreakpointChangedEvent( (ICDIBreakpoint)source );
}
@ -216,27 +194,22 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
}
}
public boolean isTargetBreakpoint( ICBreakpoint breakpoint )
{
public boolean isTargetBreakpoint( ICBreakpoint breakpoint ) {
IResource resource = breakpoint.getMarker().getResource();
if ( breakpoint instanceof ICAddressBreakpoint )
return supportsAddressBreakpoint( (ICAddressBreakpoint)breakpoint );
if ( breakpoint instanceof ICLineBreakpoint )
{
if ( breakpoint instanceof ICLineBreakpoint ) {
ICSourceLocator sl = getSourceLocator();
if ( sl != null )
return sl.contains( resource );
}
else
{
else {
IProject project = resource.getProject();
if ( project != null && project.exists() )
{
if ( project != null && project.exists() ) {
ICSourceLocator sl = getSourceLocator();
if ( sl != null )
return sl.contains( project );
else
{
else {
if ( project.equals( getExecFile().getProject() ) )
return true;
return CDebugUtils.isReferencedProject( getExecFile().getProject(), project );
@ -246,22 +219,17 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
return true;
}
public boolean isCDIRegistered( ICBreakpoint breakpoint )
{
return ( getBreakpointMap().getCDIBreakpoint( breakpoint ) != null );
public boolean isCDIRegistered( ICBreakpoint breakpoint ) {
return (getBreakpointMap().getCDIBreakpoint( breakpoint ) != null);
}
public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint )
{
return ( getExecFile() != null &&
getExecFile().getLocation().toOSString().equals( breakpoint.getMarker().getResource().getLocation().toOSString() ) );
public boolean supportsAddressBreakpoint( ICAddressBreakpoint breakpoint ) {
return (getExecFile() != null && getExecFile().getLocation().toOSString().equals( breakpoint.getMarker().getResource().getLocation().toOSString() ));
}
public IFile getCDIBreakpointFile( ICDIBreakpoint cdiBreakpoint )
{
public IFile getCDIBreakpointFile( ICDIBreakpoint cdiBreakpoint ) {
IBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
if ( breakpoint instanceof ICLineBreakpoint && !(breakpoint instanceof ICAddressBreakpoint) )
{
if ( breakpoint instanceof ICLineBreakpoint && !(breakpoint instanceof ICAddressBreakpoint) ) {
IResource resource = ((ICLineBreakpoint)breakpoint).getMarker().getResource();
if ( resource instanceof IFile )
return (IFile)resource;
@ -269,57 +237,44 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
return null;
}
public ICBreakpoint getBreakpoint( ICDIBreakpoint cdiBreakpoint )
{
public ICBreakpoint getBreakpoint( ICDIBreakpoint cdiBreakpoint ) {
return getBreakpointMap().getCBreakpoint( cdiBreakpoint );
}
public long getBreakpointAddress( ICBreakpoint breakpoint )
{
if ( breakpoint != null )
{
public long getBreakpointAddress( ICBreakpoint breakpoint ) {
if ( breakpoint != null ) {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
if ( cdiBreakpoint instanceof ICDILocationBreakpoint )
{
try
{
if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) {
try {
ICDILocation location = ((ICDILocationBreakpoint)cdiBreakpoint).getLocation();
if ( location != null )
return location.getAddress();
}
catch( CDIException e )
{
catch( CDIException e ) {
}
}
}
return 0;
}
public void setBreakpoint( final ICBreakpoint breakpoint ) throws DebugException
{
Runnable runnable = new Runnable()
{
public void run()
{
try
{
doSetBreakpoint( breakpoint );
}
catch( DebugException e )
{
}
}
};
public void setBreakpoint( final ICBreakpoint breakpoint ) throws DebugException {
Runnable runnable = new Runnable() {
public void run() {
try {
doSetBreakpoint( breakpoint );
}
catch( DebugException e ) {
}
}
};
CDebugCorePlugin.getDefault().asyncExec( runnable );
}
protected void doSetBreakpoint( ICBreakpoint breakpoint ) throws DebugException
{
try
{
protected void doSetBreakpoint( ICBreakpoint breakpoint ) throws DebugException {
try {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
if ( cdiBreakpoint == null )
{
if ( cdiBreakpoint == null ) {
if ( breakpoint instanceof ICFunctionBreakpoint )
cdiBreakpoint = setFunctionBreakpoint( (ICFunctionBreakpoint)breakpoint );
else if ( breakpoint instanceof ICAddressBreakpoint )
@ -335,315 +290,237 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
cdiBreakpoint.setEnabled( false );
setBreakpointCondition( breakpoint );
}
catch( CoreException e )
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.CBreakpointManager.Set_breakpoint_failed") + e.getMessage(), e ); //$NON-NLS-1$
catch( CoreException e ) {
requestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Set_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
}
catch( NumberFormatException e )
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.CBreakpointManager.Set_breakpoint_failed") + e.getMessage(), e ); //$NON-NLS-1$
catch( NumberFormatException e ) {
requestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Set_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
}
catch( CDIException e )
{
targetRequestFailed( CDebugCorePlugin.getResourceString("internal.core.CBreakpointManager.Set_breakpoint_failed") + e.getMessage(), e ); //$NON-NLS-1$
catch( CDIException e ) {
targetRequestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Set_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
}
}
public void removeBreakpoint( final ICBreakpoint breakpoint ) throws DebugException
{
Runnable runnable = new Runnable()
{
public void run()
{
try
{
doRemoveBreakpoint( breakpoint );
}
catch( DebugException e )
{
}
}
};
public void removeBreakpoint( final ICBreakpoint breakpoint ) throws DebugException {
Runnable runnable = new Runnable() {
public void run() {
try {
doRemoveBreakpoint( breakpoint );
}
catch( DebugException e ) {
}
}
};
CDebugCorePlugin.getDefault().asyncExec( runnable );
}
protected void doRemoveBreakpoint( ICBreakpoint breakpoint ) throws DebugException
{
protected void doRemoveBreakpoint( ICBreakpoint breakpoint ) throws DebugException {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
if ( cdiBreakpoint != null )
{
if ( cdiBreakpoint != null ) {
ICDIBreakpointManager bm = getCDIBreakpointManager();
try
{
bm.deleteBreakpoints( new ICDIBreakpoint[] { cdiBreakpoint } );
try {
bm.deleteBreakpoints( new ICDIBreakpoint[]{ cdiBreakpoint } );
}
catch( CDIException e )
{
targetRequestFailed( CDebugCorePlugin.getResourceString("internal.core.CBreakpointManager.Delete_breakpoint_failed") + e.getMessage(), e ); //$NON-NLS-1$
catch( CDIException e ) {
targetRequestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Delete_breakpoint_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
}
}
}
public void changeBreakpointProperties( final ICBreakpoint breakpoint, final IMarkerDelta delta ) throws DebugException
{
Runnable runnable = new Runnable()
{
public void run()
{
try
{
doChangeBreakpointProperties( breakpoint, delta );
}
catch( DebugException e )
{
}
}
};
public void changeBreakpointProperties( final ICBreakpoint breakpoint, final IMarkerDelta delta ) throws DebugException {
Runnable runnable = new Runnable() {
public void run() {
try {
doChangeBreakpointProperties( breakpoint, delta );
}
catch( DebugException e ) {
}
}
};
CDebugCorePlugin.getDefault().asyncExec( runnable );
}
protected void doChangeBreakpointProperties( ICBreakpoint breakpoint, IMarkerDelta delta ) throws DebugException
{
protected void doChangeBreakpointProperties( ICBreakpoint breakpoint, IMarkerDelta delta ) throws DebugException {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
if ( cdiBreakpoint == null )
return;
ICDIBreakpointManager bm = getCDIBreakpointManager();
try
{
try {
boolean enabled = breakpoint.isEnabled();
boolean oldEnabled = delta.getAttribute( IBreakpoint.ENABLED, true );
int ignoreCount = breakpoint.getIgnoreCount();
int oldIgnoreCount = delta.getAttribute( ICBreakpoint.IGNORE_COUNT, 0 );
String condition = breakpoint.getCondition();
String oldCondition = delta.getAttribute( ICBreakpoint.CONDITION, "" ); //$NON-NLS-1$
if ( enabled != oldEnabled )
{
if ( enabled != oldEnabled ) {
cdiBreakpoint.setEnabled( enabled );
}
if ( ignoreCount != oldIgnoreCount || !condition.equals( oldCondition ) )
{
if ( ignoreCount != oldIgnoreCount || !condition.equals( oldCondition ) ) {
ICDICondition cdiCondition = bm.createCondition( ignoreCount, condition );
cdiBreakpoint.setCondition( cdiCondition );
}
}
catch( CoreException e )
{
requestFailed( CDebugCorePlugin.getResourceString("internal.core.CBreakpointManager.Change_brkpt_properties_failed") + e.getMessage(), e ); //$NON-NLS-1$
catch( CoreException e ) {
requestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Change_brkpt_properties_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
}
catch( CDIException e )
{
targetRequestFailed( CDebugCorePlugin.getResourceString("internal.core.CBreakpointManager.Change_brkpt_properties_failed") + e.getMessage(), e ); //$NON-NLS-1$
catch( CDIException e ) {
targetRequestFailed( CDebugCorePlugin.getResourceString( "internal.core.CBreakpointManager.Change_brkpt_properties_failed" ) + e.getMessage(), e ); //$NON-NLS-1$
}
}
private void handleBreakpointCreatedEvent( final ICDIBreakpoint cdiBreakpoint )
{
Runnable runnable = new Runnable()
{
public void run()
{
if ( cdiBreakpoint instanceof ICDILocationBreakpoint )
doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint );
else if ( cdiBreakpoint instanceof ICDIWatchpoint )
doHandleWatchpointCreatedEvent( (ICDIWatchpoint)cdiBreakpoint );
}
};
private void handleBreakpointCreatedEvent( final ICDIBreakpoint cdiBreakpoint ) {
Runnable runnable = new Runnable() {
public void run() {
if ( cdiBreakpoint instanceof ICDILocationBreakpoint )
doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint );
else if ( cdiBreakpoint instanceof ICDIWatchpoint )
doHandleWatchpointCreatedEvent( (ICDIWatchpoint)cdiBreakpoint );
}
};
CDebugCorePlugin.getDefault().asyncExec( runnable );
}
protected void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint cdiBreakpoint )
{
protected void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint cdiBreakpoint ) {
if ( cdiBreakpoint.isTemporary() )
return;
ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
if ( breakpoint == null )
{
try
{
if ( cdiBreakpoint.getLocation().getFile() != null && cdiBreakpoint.getLocation().getFile().length() > 0 )
{
if ( breakpoint == null ) {
try {
if ( cdiBreakpoint.getLocation().getFile() != null && cdiBreakpoint.getLocation().getFile().length() > 0 ) {
ICSourceLocator locator = getSourceLocator();
if ( locator != null )
{
if ( locator != null ) {
Object sourceElement = locator.findSourceElement( cdiBreakpoint.getLocation().getFile() );
if ( sourceElement != null && sourceElement instanceof IFile )
{
if ( sourceElement != null && sourceElement instanceof IFile ) {
breakpoint = createLineBreakpoint( (IFile)sourceElement, cdiBreakpoint );
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 )
{
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 )
{
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}
catch( CDIException e )
{
catch( CDIException e ) {
}
catch( CoreException e )
{
catch( CoreException e ) {
}
}
if ( breakpoint != null )
{
try
{
if ( breakpoint != null ) {
try {
((CBreakpoint)breakpoint).incrementInstallCount();
}
catch( CoreException e )
{
catch( CoreException e ) {
CDebugCorePlugin.log( e.getStatus() );
}
}
}
protected void doHandleWatchpointCreatedEvent( ICDIWatchpoint cdiWatchpoint )
{
protected void doHandleWatchpointCreatedEvent( ICDIWatchpoint cdiWatchpoint ) {
ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiWatchpoint );
if ( breakpoint == null )
{
try
{
breakpoint = CDebugModel.createWatchpoint( getExecFile().getProject(),
cdiWatchpoint.isWriteType(),
cdiWatchpoint.isReadType(),
cdiWatchpoint.getWatchExpression(),
cdiWatchpoint.isEnabled(),
cdiWatchpoint.getCondition().getIgnoreCount(),
cdiWatchpoint.getCondition().getExpression(),
false );
getBreakpointMap().put( breakpoint, cdiWatchpoint );
((CBreakpoint)breakpoint).register( true );
if ( breakpoint == null ) {
try {
breakpoint = createWatchpoint( cdiWatchpoint );
}
catch( CDIException e )
{
catch( CDIException e ) {
}
catch( CoreException e )
{
catch( CoreException e ) {
}
}
if ( breakpoint != null )
{
try
{
if ( breakpoint != null ) {
try {
((CBreakpoint)breakpoint).incrementInstallCount();
}
catch( CoreException e )
{
catch( CoreException e ) {
CDebugCorePlugin.log( e.getStatus() );
}
}
}
private void handleBreakpointDestroyedEvent( final ICDIBreakpoint cdiBreakpoint )
{
Runnable runnable = new Runnable()
{
public void run()
{
doHandleBreakpointDestroyedEvent( cdiBreakpoint );
}
};
private void handleBreakpointDestroyedEvent( final ICDIBreakpoint cdiBreakpoint ) {
Runnable runnable = new Runnable() {
public void run() {
doHandleBreakpointDestroyedEvent( cdiBreakpoint );
}
};
CDebugCorePlugin.getDefault().asyncExec( runnable );
}
protected void doHandleBreakpointDestroyedEvent( ICDIBreakpoint cdiBreakpoint )
{
protected void doHandleBreakpointDestroyedEvent( ICDIBreakpoint cdiBreakpoint ) {
ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
if ( breakpoint != null )
{
if ( breakpoint != null ) {
getBreakpointMap().removeCDIBreakpoint( breakpoint, cdiBreakpoint );
try
{
try {
((CBreakpoint)breakpoint).decrementInstallCount();
}
catch( CoreException e )
{
catch( CoreException e ) {
CDebugCorePlugin.log( e.getStatus() );
}
}
}
private void handleBreakpointChangedEvent( final ICDIBreakpoint cdiBreakpoint )
{
Runnable runnable = new Runnable()
{
public void run()
{
doHandleBreakpointChangedEvent( cdiBreakpoint );
}
};
private void handleBreakpointChangedEvent( final ICDIBreakpoint cdiBreakpoint ) {
Runnable runnable = new Runnable() {
public void run() {
doHandleBreakpointChangedEvent( cdiBreakpoint );
}
};
CDebugCorePlugin.getDefault().asyncExec( runnable );
}
protected void doHandleBreakpointChangedEvent( ICDIBreakpoint cdiBreakpoint )
{
protected void doHandleBreakpointChangedEvent( ICDIBreakpoint cdiBreakpoint ) {
ICBreakpoint breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
if ( breakpoint != null )
{
try
{
if ( breakpoint != null ) {
try {
breakpoint.setEnabled( cdiBreakpoint.isEnabled() );
breakpoint.setIgnoreCount( cdiBreakpoint.getCondition().getIgnoreCount() );
breakpoint.setCondition( cdiBreakpoint.getCondition().getExpression() );
}
catch( CDIException e )
{
catch( CDIException e ) {
}
catch( CoreException e )
{
catch( CoreException e ) {
}
}
}
private void removeAllBreakpoints()
{
private void removeAllBreakpoints() {
ICDIBreakpoint[] cdiBreakpoints = getBreakpointMap().getAllCDIBreakpoints();
ICDIBreakpointManager bm = getCDIBreakpointManager();
if ( cdiBreakpoints.length > 0 )
{
try
{
if ( cdiBreakpoints.length > 0 ) {
try {
bm.deleteBreakpoints( cdiBreakpoints );
}
catch( CDIException e )
{
catch( CDIException e ) {
CDebugCorePlugin.log( e.getMessage() );
}
ICBreakpoint[] breakpoints = getBreakpointMap().getAllCBreakpoints();
for ( int i = 0; i < breakpoints.length; ++i )
{
try
{
for( int i = 0; i < breakpoints.length; ++i ) {
try {
((CBreakpoint)breakpoints[i]).decrementInstallCount();
}
catch( CoreException e )
{
catch( CoreException e ) {
CDebugCorePlugin.log( e.getMessage() );
}
}
}
}
private synchronized ICDIBreakpoint setFunctionBreakpoint( ICFunctionBreakpoint breakpoint ) throws CDIException, CoreException
{
private synchronized ICDIBreakpoint setFunctionBreakpoint( ICFunctionBreakpoint breakpoint ) throws CDIException, CoreException {
ICDIBreakpointManager bm = getCDIBreakpointManager();
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 );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
getBreakpointMap().put( breakpoint, cdiBreakpoint );
return cdiBreakpoint;
}
private synchronized ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException
{
private synchronized ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
ICDIBreakpointManager bm = getCDIBreakpointManager();
ICDILocation location = bm.createLocation( Long.parseLong( breakpoint.getAddress() ) );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
@ -651,8 +528,7 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
return cdiBreakpoint;
}
private synchronized ICDIBreakpoint setLineBreakpoint( ICLineBreakpoint breakpoint ) throws CDIException, CoreException
{
private synchronized ICDIBreakpoint setLineBreakpoint( ICLineBreakpoint breakpoint ) throws CDIException, CoreException {
ICDIBreakpointManager bm = getCDIBreakpointManager();
ICDILocation location = bm.createLocation( breakpoint.getMarker().getResource().getLocation().lastSegment(), null, breakpoint.getLineNumber() );
ICDIBreakpoint cdiBreakpoint = bm.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
@ -660,84 +536,91 @@ public class CBreakpointManager implements ICBreakpointManager, ICDIEventListene
return cdiBreakpoint;
}
private synchronized ICDIBreakpoint setWatchpoint( ICWatchpoint watchpoint ) throws CDIException, CoreException
{
private synchronized ICDIBreakpoint setWatchpoint( ICWatchpoint watchpoint ) throws CDIException, CoreException {
ICDIBreakpointManager bm = getCDIBreakpointManager();
int accessType = 0;
accessType |= ( watchpoint.isWriteType() ) ? ICDIWatchpoint.WRITE : 0;
accessType |= ( watchpoint.isReadType() ) ? ICDIWatchpoint.READ : 0;
accessType |= (watchpoint.isWriteType()) ? ICDIWatchpoint.WRITE : 0;
accessType |= (watchpoint.isReadType()) ? ICDIWatchpoint.READ : 0;
String expression = watchpoint.getExpression();
ICDIWatchpoint cdiWatchpoint = bm.setWatchpoint( ICDIBreakpoint.REGULAR, accessType, expression, null );
getBreakpointMap().put( watchpoint, cdiWatchpoint );
return cdiWatchpoint;
}
private void setBreakpointCondition( ICBreakpoint breakpoint ) throws CoreException, CDIException
{
private void setBreakpointCondition( ICBreakpoint breakpoint ) throws CoreException, CDIException {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
ICDIBreakpointManager bm = getCDIBreakpointManager();
ICDICondition condition = bm.createCondition( breakpoint.getIgnoreCount(), breakpoint.getCondition() );
cdiBreakpoint.setCondition( condition );
}
private BreakpointMap getBreakpointMap()
{
private BreakpointMap getBreakpointMap() {
return fMap;
}
protected void targetRequestFailed( String message, Throwable e ) throws DebugException
{
protected void targetRequestFailed( String message, Throwable e ) throws DebugException {
requestFailed0( message, e, DebugException.TARGET_REQUEST_FAILED );
}
protected void requestFailed( String message, Throwable e ) throws DebugException
{
protected void requestFailed( String message, Throwable e ) throws DebugException {
requestFailed0( message, e, DebugException.REQUEST_FAILED );
}
private void requestFailed0( String message, Throwable e, int code ) throws DebugException
{
throw new DebugException( new Status( IStatus.ERROR,
CDebugModel.getPluginIdentifier(),
code,
message,
e ) );
private void requestFailed0( String message, Throwable e, int code ) throws DebugException {
throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), code, message, e ) );
}
private ICLineBreakpoint createLineBreakpoint( IFile file, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException
{
ICLineBreakpoint breakpoint = CDebugModel.createLineBreakpoint( file,
cdiBreakpoint.getLocation().getLineNumber(),
cdiBreakpoint.isEnabled(),
cdiBreakpoint.getCondition().getIgnoreCount(),
cdiBreakpoint.getCondition().getExpression(),
false );
private ICLineBreakpoint createLineBreakpoint( IFile file, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
ICLineBreakpoint breakpoint = CDIDebugModel.createLineBreakpoint( cdiBreakpoint.getLocation().getFile(),
file,
cdiBreakpoint.getLocation().getLineNumber(),
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
{
ICAddressBreakpoint breakpoint = CDebugModel.createAddressBreakpoint( getExecFile(),
cdiBreakpoint.getLocation().getAddress(),
cdiBreakpoint.isEnabled(),
cdiBreakpoint.getCondition().getIgnoreCount(),
cdiBreakpoint.getCondition().getExpression(),
false );
private ICAddressBreakpoint createAddressBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException {
IFile execFile = getExecFile();
String sourceHandle = execFile.getFullPath().toOSString();
ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( sourceHandle,
execFile,
cdiBreakpoint.getLocation().getAddress(),
cdiBreakpoint.isEnabled(),
cdiBreakpoint.getCondition().getIgnoreCount(),
cdiBreakpoint.getCondition().getExpression(),
false );
getBreakpointMap().put( breakpoint, cdiBreakpoint );
((CBreakpoint)breakpoint).register( true );
return breakpoint;
}
private ICSourceLocator getSourceLocator()
{
private ICWatchpoint createWatchpoint( ICDIWatchpoint cdiWatchpoint ) throws CDIException, CoreException {
IFile execFile = getExecFile();
String sourceHandle = execFile.getFullPath().toOSString();
ICWatchpoint watchpoint = CDIDebugModel.createWatchpoint( sourceHandle,
execFile.getProject(),
cdiWatchpoint.isWriteType(),
cdiWatchpoint.isReadType(),
cdiWatchpoint.getWatchExpression(),
cdiWatchpoint.isEnabled(),
cdiWatchpoint.getCondition().getIgnoreCount(),
cdiWatchpoint.getCondition().getExpression(),
false );
getBreakpointMap().put( watchpoint, cdiWatchpoint );
((CBreakpoint)watchpoint).register( true );
return watchpoint;
}
private ICSourceLocator getSourceLocator() {
ISourceLocator locator = getDebugTarget().getLaunch().getSourceLocator();
return ( locator instanceof IAdaptable ) ? (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class ) : null;
return (locator instanceof IAdaptable) ? (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class ) : null;
}
private IFile getExecFile()
{
private IFile getExecFile() {
return getDebugTarget().getExecFile();
}
}
}

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.internal.core;
/**
* Utilities used by C/C++ Debug Plugin's classes.
*/
public class CDebugUtils {
/**
* Returns the hexadecimal presentation of the given address.
*
* @param address an address to be converted to hex
* @return the hexadecimal presentation of the given address
*/
public static String toHexAddressString( long address ) {
String addressString = Long.toHexString( address );
StringBuffer sb = new StringBuffer( 10 );
sb.append( "0x" ); //$NON-NLS-1$
for( int i = 0; i < 8 - addressString.length(); ++i ) {
sb.append( '0' );
}
sb.append( addressString );
return sb.toString();
}
}

View file

@ -0,0 +1,33 @@
/**********************************************************************
* 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.MissingResourceException;
import java.util.ResourceBundle;
public class BreakpointMessages {
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.breakpoints.BreakpointMessages";//$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
private BreakpointMessages() {
}
public static String getString( String key ) {
try {
return RESOURCE_BUNDLE.getString( key );
}
catch( MissingResourceException e ) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,13 @@
CAddressBreakpoint.1=Address breakpoint:
CAddressBreakpoint.2=[address: {0}]
CBreakpoint.1=\ [ignore count: {0}]
CBreakpoint.2=\ if {0}
CFunctionBreakpoint.2=Function breakpoint:
CFunctionBreakpoint.3=\ [function: {0}]
CLineBreakpoint.1=Line breakpoint:
CLineBreakpoint.2=\ [line: {0}]
CWatchpoint.1=Write watchpoint
CWatchpoint.2=Read watchpoint
CWatchpoint.3=Access watchpoint
CWatchpoint.4=Watchpoint
CWatchpoint.5=\ at \'{0}\'

View file

@ -1,116 +1,115 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.text.MessageFormat;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
*
* Enter type comment.
*
* @since Aug 21, 2002
* A breakpoint that suspend the execution when a particular address is reached.
*/
public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoint
{
public class CAddressBreakpoint extends CBreakpoint implements ICAddressBreakpoint {
private static final String C_ADDRESS_BREAKPOINT = "org.eclipse.cdt.debug.core.cAddressBreakpointMarker"; //$NON-NLS-1$
/**
* Constructor for CAddressBreakpoint.
*/
public CAddressBreakpoint()
{
public CAddressBreakpoint() {
}
/**
* Constructor for CAddressBreakpoint.
*/
public CAddressBreakpoint( IResource resource, Map attributes, boolean add ) throws DebugException
{
public CAddressBreakpoint( IResource resource, Map attributes, boolean add ) throws CoreException {
super( resource, getMarkerType(), attributes, add );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#getAddress()
*/
public String getAddress() throws CoreException
{
public String getAddress() throws CoreException {
return ensureMarker().getAttribute( ADDRESS, null );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICAddressBreakpoint#setAddress(long)
*/
public void setAddress( String address ) throws CoreException
{
public void setAddress( String address ) throws CoreException {
setAttribute( ADDRESS, address );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/
public int getLineNumber() throws CoreException
{
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
*/
public int getCharStart() throws CoreException
{
public int getCharStart() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
*/
public int getCharEnd() throws CoreException
{
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
public static String getMarkerType()
{
public static String getMarkerType() {
return C_ADDRESS_BREAKPOINT;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
StringBuffer sb = new StringBuffer( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CAddressBreakpoint.Address_breakpoint") ); //$NON-NLS-1$
protected String getMarkerMessage() throws CoreException {
StringBuffer sb = new StringBuffer( BreakpointMessages.getString( "CAddressBreakpoint.1" ) ); //$NON-NLS-1$
String name = ensureMarker().getResource().getName();
if ( name != null && name.length() > 0 )
{
if ( name != null && name.length() > 0 ) {
sb.append( ' ' );
sb.append( name );
}
try
{
try {
long address = Long.parseLong( getAddress() );
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CAddressBreakpoint.address") ); //$NON-NLS-1$
sb.append( CDebugUtils.toHexAddressString( address ) );
sb.append( ']' );
sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { CDebugUtils.toHexAddressString( address ) } ) ); //$NON-NLS-1$
}
catch( NumberFormatException e )
{
catch( NumberFormatException e ) {
}
sb.append( getConditionText() );
return sb.toString();
}
}
}

View file

@ -1,14 +1,19 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.text.MessageFormat;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@ -21,263 +26,247 @@ import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.Breakpoint;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
*
* Enter type comment.
*
* @since Aug 21, 2002
* 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, IDebugEventSetListener {
/**
* Constructor for CBreakpoint.
*/
public CBreakpoint()
{
public CBreakpoint() {
}
/**
* Constructor for CBreakpoint.
*/
public CBreakpoint( final IResource resource, final String markerType, final Map attributes, final boolean add ) throws DebugException
{
IWorkspaceRunnable wr= new IWorkspaceRunnable()
{
public void run( IProgressMonitor monitor ) throws CoreException
{
// create the marker
setMarker( resource.createMarker( markerType ) );
// set attributes
ensureMarker().setAttributes( attributes );
//set the marker message
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
// add to breakpoint manager if requested
register( add );
}
};
public CBreakpoint( final IResource resource, final String markerType, final Map attributes, final boolean add ) throws CoreException {
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
public void run( IProgressMonitor monitor ) throws CoreException {
// create the marker
setMarker( resource.createMarker( markerType ) );
// set attributes
ensureMarker().setAttributes( attributes );
//set the marker message
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
// add to breakpoint manager if requested
register( add );
}
};
run( wr );
}
public void createMarker( final IResource resource, final String markerType, final Map attributes, final boolean add ) throws DebugException
{
IWorkspaceRunnable wr= new IWorkspaceRunnable()
{
public void run( IProgressMonitor monitor ) throws CoreException
{
// create the marker
setMarker( resource.createMarker( markerType ) );
// set attributes
ensureMarker().setAttributes( attributes );
//set the marker message
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
// add to breakpoint manager if requested
register( add );
}
};
public void createMarker( final IResource resource, final String markerType, final Map attributes, final boolean add ) throws DebugException {
IWorkspaceRunnable wr = new IWorkspaceRunnable() {
public void run( IProgressMonitor monitor ) throws CoreException {
// create the marker
setMarker( resource.createMarker( markerType ) );
// set attributes
ensureMarker().setAttributes( attributes );
//set the marker message
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
// add to breakpoint manager if requested
register( add );
}
};
run( wr );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IBreakpoint#getModelIdentifier()
*/
public String getModelIdentifier()
{
return CDebugModel.getPluginIdentifier();
public String getModelIdentifier() {
return CDIDebugModel.getPluginIdentifier();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICBreakpoint#isInstalled()
*/
public boolean isInstalled() throws CoreException
{
public boolean isInstalled() throws CoreException {
return ensureMarker().getAttribute( INSTALL_COUNT, 0 ) > 0;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICBreakpoint#getCondition()
*/
public String getCondition() throws CoreException
{
public String getCondition() throws CoreException {
return ensureMarker().getAttribute( CONDITION, "" ); //$NON-NLS-1$
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICBreakpoint#setCondition(String)
*/
public void setCondition( String condition ) throws CoreException
{
public void setCondition( String condition ) throws CoreException {
setAttribute( CONDITION, condition );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICBreakpoint#getIgnoreCount()
*/
public int getIgnoreCount() throws CoreException
{
public int getIgnoreCount() throws CoreException {
return ensureMarker().getAttribute( IGNORE_COUNT, 0 );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICBreakpoint#setIgnoreCount(int)
*/
public void setIgnoreCount( int ignoreCount ) throws CoreException
{
public void setIgnoreCount( int ignoreCount ) throws CoreException {
setAttribute( IGNORE_COUNT, ignoreCount );
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICBreakpoint#getThreadId()
*/
public String getThreadId() throws CoreException
{
public String getThreadId() throws CoreException {
return ensureMarker().getAttribute( THREAD_ID, null );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICBreakpoint#setThreadId(String)
*/
public void setThreadId( String threadId ) throws CoreException
{
public void setThreadId( String threadId ) throws CoreException {
setAttribute( THREAD_ID, threadId );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#getSourceHandle()
*/
public String getSourceHandle() throws CoreException {
return ensureMarker().getAttribute( SOURCE_HANDLE, null );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#setSourceHandle(java.lang.String)
*/
public void setSourceHandle( String sourceHandle ) throws CoreException {
setAttribute( SOURCE_HANDLE, sourceHandle );
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(DebugEvent[])
*/
public void handleDebugEvents( DebugEvent[] events )
{
public void handleDebugEvents( DebugEvent[] events ) {
}
/**
* Execute the given workspace runnable
*/
protected void run( IWorkspaceRunnable wr ) throws DebugException
{
try
{
protected void run( IWorkspaceRunnable wr ) throws DebugException {
try {
ResourcesPlugin.getWorkspace().run( wr, null );
}
catch ( CoreException e )
{
catch( CoreException e ) {
throw new DebugException( e.getStatus() );
}
}
/**
* Add this breakpoint to the breakpoint manager,
* or sets it as unregistered.
* Add this breakpoint to the breakpoint manager, or sets it as
* unregistered.
*/
public void register( boolean register ) throws CoreException
{
if ( register )
{
public void register( boolean register ) throws CoreException {
if ( register ) {
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint( this );
}
/*
else
{
setRegistered( false );
}
*/
/*
* else { setRegistered( false ); }
*/
}
protected String getMarkerMessage() throws CoreException
{
return null;
}
abstract protected String getMarkerMessage() throws CoreException;
/**
* Resets the install count of this breakpoint
*/
public synchronized void resetInstallCount() throws CoreException
{
public synchronized void resetInstallCount() throws CoreException {
setAttribute( INSTALL_COUNT, 0 );
}
/**
* Increments the install count of this breakpoint
*/
public synchronized void incrementInstallCount() throws CoreException
{
public synchronized void incrementInstallCount() throws CoreException {
int count = getInstallCount();
setAttribute( INSTALL_COUNT, count + 1 );
}
/**
* Returns the <code>INSTALL_COUNT</code> attribute of this breakpoint
* or 0 if the attribute is not set.
* Returns the <code>INSTALL_COUNT</code> attribute of this breakpoint or
* 0 if the attribute is not set.
*/
public int getInstallCount() throws CoreException
{
public int getInstallCount() throws CoreException {
return ensureMarker().getAttribute( INSTALL_COUNT, 0 );
}
/**
* Decrements the install count of this breakpoint.
*/
public synchronized void decrementInstallCount() throws CoreException
{
public synchronized void decrementInstallCount() throws CoreException {
int count = getInstallCount();
if ( count > 0 )
{
if ( count > 0 ) {
setAttribute( INSTALL_COUNT, count - 1 );
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.Breakpoint#ensureMarker()
*/
protected IMarker ensureMarker() throws DebugException
{
protected IMarker ensureMarker() throws DebugException {
return super.ensureMarker();
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.Breakpoint#setAttribute(String, Object)
*/
protected void setAttribute( String attributeName, Object value ) throws CoreException
{
protected void setAttribute( String attributeName, Object value ) throws CoreException {
super.setAttribute( attributeName, value );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.model.ICBreakpoint#isConditional()
*/
public boolean isConditional() throws CoreException
{
return ( (getCondition() != null && getCondition().trim().length() > 0) || getIgnoreCount() > 0 );
public boolean isConditional() throws CoreException {
return ((getCondition() != null && getCondition().trim().length() > 0) || getIgnoreCount() > 0);
}
protected String getConditionText() throws CoreException
{
protected String getConditionText() throws CoreException {
StringBuffer sb = new StringBuffer();
int ignoreCount = getIgnoreCount();
if ( ignoreCount > 0 )
{
sb.append( " [" ); //$NON-NLS-1$
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CBreakpoint.ignore_count") ); //$NON-NLS-1$
sb.append( ' ' );
sb.append( ignoreCount );
sb.append( ']' );
if ( ignoreCount > 0 ) {
sb.append( MessageFormat.format( BreakpointMessages.getString( "CBreakpoint.1" ), new Integer[] { new Integer( ignoreCount ) } ) ); //$NON-NLS-1$
}
String condition = getCondition();
if ( condition != null && condition.length() > 0 )
{
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CBreakpoint.if") ); //$NON-NLS-1$
sb.append( condition );
if ( condition != null && condition.length() > 0 ) {
sb.append( MessageFormat.format( BreakpointMessages.getString( "CBreakpoint.2" ), new String[] { condition } ) ); //$NON-NLS-1$
}
return sb.toString();
}
}
}

View file

@ -1,10 +1,16 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.text.MessageFormat;
import java.util.Map;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
@ -12,21 +18,16 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
*
* Enter type comment.
*
* @since Aug 21, 2002
* A breakpoint that suspends the execution when a function is entered.
*/
public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakpoint
{
public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakpoint {
private static final String C_FUNCTION_BREAKPOINT = "org.eclipse.cdt.debug.core.cFunctionBreakpointMarker"; //$NON-NLS-1$
/**
* Breakpoint attribute storing the function this breakpoint suspends
* 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>.
*/
@ -35,101 +36,98 @@ public class CFunctionBreakpoint extends CBreakpoint implements ICFunctionBreakp
/**
* Constructor for CFunctionBreakpoint.
*/
public CFunctionBreakpoint()
{
public CFunctionBreakpoint() {
}
/**
* Constructor for CFunctionBreakpoint.
*/
public CFunctionBreakpoint( IResource resource, Map attributes, boolean add ) throws DebugException
{
public CFunctionBreakpoint( IResource resource, Map attributes, boolean add ) throws CoreException {
super( resource, getMarkerType(), attributes, add );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#getFunction()
*/
public String getFunction() throws CoreException
{
public String getFunction() throws CoreException {
return ensureMarker().getAttribute( FUNCTION, null );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICFunctionBreakpoint#setFunction(String)
*/
public void setFunction( String function ) throws CoreException
{
public void setFunction( String function ) throws CoreException {
setAttribute( FUNCTION, function );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/
public int getLineNumber() throws CoreException
{
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
*/
public int getCharStart() throws CoreException
{
public int getCharStart() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
*/
public int getCharEnd() throws CoreException
{
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
public static String getMarkerType()
{
public static String getMarkerType() {
return C_FUNCTION_BREAKPOINT;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint#getFileName()
*/
public String getFileName() throws CoreException
{
public String getFileName() throws CoreException {
IResource resource = ensureMarker().getResource();
if ( resource instanceof IFile )
{
if ( resource instanceof IFile ) {
return ((IFile)resource).getLocation().lastSegment();
}
return null;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
StringBuffer sb = new StringBuffer( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CFunctionBreakpoint.Function_breakpoint") ); //$NON-NLS-1$
protected String getMarkerMessage() throws CoreException {
StringBuffer sb = new StringBuffer( BreakpointMessages.getString( "CFunctionBreakpoint.2" ) ); //$NON-NLS-1$
String name = ensureMarker().getResource().getName();
if ( name != null && name.length() > 0 )
{
if ( name != null && name.length() > 0 ) {
sb.append( ' ' );
sb.append( name );
}
String function = getFunction();
if ( function != null && function.trim().length() > 0 )
{
sb.append( " [" ); //$NON-NLS-1$
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CFunctionBreakpoint.function") ); //$NON-NLS-1$
sb.append( ' ' );
sb.append( function.trim() );
sb.append( ']' );
if ( function != null && function.trim().length() > 0 ) {
sb.append( MessageFormat.format( BreakpointMessages.getString( "CFunctionBreakpoint.3" ), new String[] { function.trim() } ) ); //$NON-NLS-1$
}
sb.append( getConditionText() );
return sb.toString();
}
}
}

View file

@ -1,98 +1,95 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.text.MessageFormat;
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.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
*
* Enter type comment.
*
* @since Aug 21, 2002
* A breakpoint that suspends the execution when a particular line of code is
* reached.
*/
public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint
{
public class CLineBreakpoint extends CBreakpoint implements ICLineBreakpoint {
private static final String C_LINE_BREAKPOINT = "org.eclipse.cdt.debug.core.cLineBreakpointMarker"; //$NON-NLS-1$
/**
* Constructor for CLineBreakpoint.
*/
public CLineBreakpoint()
{
public CLineBreakpoint() {
}
/**
* Constructor for CLineBreakpoint.
*/
public CLineBreakpoint( IResource resource, Map attributes, boolean add ) throws DebugException
{
public CLineBreakpoint( IResource resource, Map attributes, boolean add ) throws CoreException {
super( resource, getMarkerType(), attributes, add );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getLineNumber()
*/
public int getLineNumber() throws CoreException
{
public int getLineNumber() throws CoreException {
return ensureMarker().getAttribute( IMarker.LINE_NUMBER, -1 );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharStart()
*/
public int getCharStart() throws CoreException
{
public int getCharStart() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_START, -1 );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ILineBreakpoint#getCharEnd()
*/
public int getCharEnd() throws CoreException
{
public int getCharEnd() throws CoreException {
return ensureMarker().getAttribute( IMarker.CHAR_END, -1 );
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
public static String getMarkerType()
{
public static String getMarkerType() {
return C_LINE_BREAKPOINT;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
StringBuffer sb = new StringBuffer( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CLineBreakpoint.Line_breakpoint") ); //$NON-NLS-1$
protected String getMarkerMessage() throws CoreException {
StringBuffer sb = new StringBuffer( BreakpointMessages.getString( "CLineBreakpoint.1" ) ); //$NON-NLS-1$
String fileName = ensureMarker().getResource().getName();
if ( fileName != null && fileName.length() > 0 )
{
if ( fileName != null && fileName.length() > 0 ) {
sb.append( ' ' );
sb.append( fileName );
}
int lineNumber = getLineNumber();
if ( lineNumber > 0 )
{
sb.append( " [" ); //$NON-NLS-1$
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CLineBreakpoint.line") ); //$NON-NLS-1$
sb.append( ' ' );
sb.append( lineNumber );
sb.append( ']' );
if ( lineNumber > 0 ) {
sb.append( MessageFormat.format( BreakpointMessages.getString( "CLineBreakpoint.2" ), new Integer[] { new Integer( lineNumber ) } ) ); //$NON-NLS-1$
}
sb.append( getConditionText() );
return sb.toString();
}
}
}

View file

@ -1,106 +1,102 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.text.MessageFormat;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
/**
*
* Enter type comment.
*
* @since Sep 4, 2002
* A watchpoint specific to the C/C++ debug model.
*/
public class CWatchpoint extends CBreakpoint implements ICWatchpoint
{
public class CWatchpoint extends CBreakpoint implements ICWatchpoint {
private static final String C_WATCHPOINT = "org.eclipse.cdt.debug.core.cWatchpointMarker"; //$NON-NLS-1$
/**
* Constructor for CWatchpoint.
*/
public CWatchpoint()
{
public CWatchpoint() {
}
/**
* Constructor for CWatchpoint.
*/
public CWatchpoint( IResource resource, Map attributes, boolean add ) throws DebugException
{
public CWatchpoint( IResource resource, Map attributes, boolean add ) throws CoreException {
super( resource, getMarkerType(), attributes, add );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICWatchpoint#isWriteType()
*/
public boolean isWriteType() throws CoreException
{
public boolean isWriteType() throws CoreException {
return ensureMarker().getAttribute( WRITE, true );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICWatchpoint#isReadType()
*/
public boolean isReadType() throws CoreException
{
public boolean isReadType() throws CoreException {
return ensureMarker().getAttribute( READ, false );
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.core.ICWatchpoint#getExpression()
*/
public String getExpression() throws CoreException
{
public String getExpression() throws CoreException {
return ensureMarker().getAttribute( EXPRESSION, "" ); //$NON-NLS-1$
}
/**
* Returns the type of marker associated with this type of breakpoints
*/
public static String getMarkerType()
{
public static String getMarkerType() {
return C_WATCHPOINT;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint#getMarkerMessage()
*/
protected String getMarkerMessage() throws CoreException
{
protected String getMarkerMessage() throws CoreException {
StringBuffer sb = new StringBuffer();
if ( isWriteType() && !isReadType() )
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CWatchpoint.Write_watchpoint") ); //$NON-NLS-1$
sb.append( BreakpointMessages.getString( "CWatchpoint.1" ) ); //$NON-NLS-1$
else if ( !isWriteType() && isReadType() )
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CWatchpoint.Read_watchpoint") ); //$NON-NLS-1$
sb.append( BreakpointMessages.getString( "CWatchpoint.2" ) ); //$NON-NLS-1$
else if ( isWriteType() && isReadType() )
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CWatchpoint.Access_watchpoint") ); //$NON-NLS-1$
sb.append( BreakpointMessages.getString( "CWatchpoint.3" ) ); //$NON-NLS-1$
else
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CWatchpoint.Watchpoint") ); //$NON-NLS-1$
sb.append( BreakpointMessages.getString( "CWatchpoint.4" ) ); //$NON-NLS-1$
sb.append( ' ' );
String fileName = ensureMarker().getResource().getName();
if ( fileName != null && fileName.length() > 0 )
{
if ( fileName != null && fileName.length() > 0 ) {
sb.append( ' ' );
sb.append( fileName );
}
String expression = getExpression();
if ( expression != null && expression.length() > 0 )
{
sb.append( " " ); //$NON-NLS-1$
sb.append( CDebugCorePlugin.getResourceString("internal.core.breakpoints.CWatchpoint.at") ); //$NON-NLS-1$
sb.append( " \'" ); //$NON-NLS-1$
sb.append( expression );
sb.append( '\'' );
if ( expression != null && expression.length() > 0 ) {
sb.append( MessageFormat.format( BreakpointMessages.getString( "CWatchpoint.5" ), new String[]{ expression } ) ); //$NON-NLS-1$
}
sb.append( getConditionText() );
return sb.toString();
}
}
}

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICBreakpointManager;
import org.eclipse.cdt.debug.core.ICMemoryManager;
import org.eclipse.cdt.debug.core.ICRegisterManager;
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
@ -991,7 +990,7 @@ public class CDebugTarget extends CDebugElement
return this;
if ( adapter.equals( IJumpToAddress.class ) )
return this;
if ( adapter.equals( ICBreakpointManager.class ) )
if ( adapter.equals( CBreakpointManager.class ) )
return getBreakpointManager();
if ( adapter.equals( DisassemblyManager.class ) )
return getDisassemblyManager();

View file

@ -1,3 +1,15 @@
2004-04-12 Mikhail Khodjaiants
Implementing retargettable breakpoint related actions.
* AddAddressBreakpointActionDelegate.java
* AddWatchpointActionDelegate.java
* ManageBreakpointRulerAction.java
* ManageBreakpointRulerActionDelegate.java
* ManageFunctionBreakpointActionDelegate.java
* ToggleBreakpointAdapter.java
* DisassemblyMarkerAnnotationModel.java
* plugin.properties
* plugin.xml
2004-04-11 Mikhail Khodjaiants
Implementation of the "Run To Line" retargettable action.
* plugin.xml

View file

@ -28,7 +28,7 @@ SwitchToDisassemblyAction.tooltip=Disassembly Mode On/Off
ShowDebuggerConsoleAction.label=Show Debugger Console
ShowDebuggerConsoleAction.tooltip=Show Debugger Console On Target Selection
AddBreakpoint.label=Add/Remove &Breakpoint
AddBreakpoint.label=Add &Breakpoint
EnableBreakpoint.label=T&oggle Breakpoint
BreakpointProperties.label=Breakpoint P&roperties...
GlobalManageBreakpointAction.label=Add/Remove Brea&kpoint (C/C++)

View file

@ -69,8 +69,8 @@
<view
relative="org.eclipse.debug.ui.VariableView"
visible="false"
id="org.eclipse.cdt.debug.ui.MemoryView"
relationship="stack">
relationship="stack"
id="org.eclipse.cdt.debug.ui.MemoryView">
</view>
<viewShortcut
id="org.eclipse.cdt.debug.ui.MemoryView">
@ -78,8 +78,8 @@
<view
relative="org.eclipse.debug.ui.VariableView"
visible="false"
id="org.eclipse.cdt.debug.ui.SharedLibrariesView"
relationship="stack">
relationship="stack"
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
</view>
<viewShortcut
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
@ -87,8 +87,8 @@
<view
relative="org.eclipse.debug.ui.VariableView"
visible="false"
id="org.eclipse.cdt.debug.ui.SignalsView"
relationship="stack">
relationship="stack"
id="org.eclipse.cdt.debug.ui.SignalsView">
</view>
<viewShortcut
id="org.eclipse.cdt.debug.ui.SignalsView">
@ -177,20 +177,6 @@
</pluginState>
</enablement>
</action>
<action
label="%GlobalManageBreakpointAction.label"
icon="icons/full/obj16/brkp_obj.gif"
helpContextId="manage_breakpoint_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageBreakpointActionDelegate"
menubarPath="org.eclipse.ui.run/cBreakpointGroup"
id="org.eclipse.cdt.debug.ui.internal.actions.ManageBreakpointActionDelegate">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
<action
label="%AddAddressBreakpointAction.label"
icon="icons/full/obj16/addrbrkp_obj.gif"
@ -277,8 +263,8 @@
</action>
<action
label="%SwitchToDisassemblyAction.label"
icon="icons/full/clcl16/disassembly.gif"
style="toggle"
icon="icons/full/clcl16/disassembly.gif"
helpContextId="switch_to_disassembly_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
menubarPath="renderGroup"
@ -673,8 +659,8 @@
label="%LoadSymbolsAction.label"
icon="icons/full/clcl16/load_symbols_co.gif"
helpContextId="load_symbols_action_context"
tooltip="%LoadSymbolsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
tooltip="%LoadSymbolsAction.tooltip"
menubarPath="sharedLibrariesGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate">
@ -693,8 +679,8 @@
label="%SignalAction.label"
icon="icons/full/clcl16/signal_co.gif"
helpContextId="signal_action_context"
tooltip="%SignalAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"
tooltip="%SignalAction.tooltip"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate">
@ -709,8 +695,8 @@
label="%SignalPropertiesAction.label"
style="pulldown"
helpContextId="signal_properties_action_context"
tooltip="%SignalPropertiesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate"
tooltip="%SignalPropertiesAction.tooltip"
enablesFor="1"
id="org.eclipse.cdt.debug.ui.SignalPropertiesAction">
<enablement>
@ -746,8 +732,8 @@
<action
label="%RestoreDefaultTypeAction.label"
helpContextId="restore_default_type_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"
tooltip="%RestoreDefaultTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate">
@ -762,8 +748,8 @@
label="%CastToTypeAction.label"
icon="icons/full/clcl16/casttotype_co.gif"
helpContextId="cast_to_type_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"
tooltip="%CastToTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate">
@ -778,8 +764,8 @@
label="%CastToArrayAction.label"
icon="icons/full/clcl16/showasarray_co.gif"
helpContextId="cast_to_array_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"
tooltip="%CastToArrayAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate">
@ -798,8 +784,8 @@
label="%ManageFunctionBreakpointAction.label"
icon="icons/full/obj16/funbrkp_obj.gif"
helpContextId="manage_function_breakpoint_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
tooltip="%ManageFunctionBreakpointAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate">
@ -818,8 +804,8 @@
label="%DisableVariablesAction.label"
icon="icons/full/clcl16/disabled_co.gif"
helpContextId="disable_variables_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"
tooltip="%DisableVariablesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"
menubarPath="variableGroup"
enablesFor="2+"
id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate">
@ -831,8 +817,8 @@
label="%EnableVariablesAction.label"
icon="icons/full/clcl16/enabled_co.gif"
helpContextId="enable_variables_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"
tooltip="%EnableVariablesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"
menubarPath="variableGroup"
enablesFor="2+"
id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate">
@ -855,8 +841,8 @@
disabledIcon="icons/full/dlcl16/restart.gif"
enablesFor="1"
icon="icons/full/elcl16/restart.gif"
label="%RestartAction.label"
helpContextId="restart_action_context"
label="%RestartAction.label"
tooltip="%RestartAction.tooltip">
<enablement>
<pluginState
@ -874,8 +860,8 @@
disabledIcon="icons/full/dlcl16/disassembly.gif"
enablesFor="1"
icon="icons/full/elcl16/disassembly.gif"
label="%SwitchToDisassemblyAction.label"
helpContextId="switch_to_disassembly_action_context"
label="%SwitchToDisassemblyAction.label"
tooltip="%SwitchToDisassemblyAction.tooltip">
<enablement>
<pluginState
@ -890,11 +876,11 @@
id="org.eclipse.cdt.debug.ui.debugView.menu">
<action
label="%ShowFullPathsAction.label"
style="toggle"
icon="icons/full/clcl16/show_paths.gif"
style="toggle"
helpContextId="show_full_paths_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
@ -914,11 +900,11 @@
id="org.eclipse.cdt.debug.ui.breakpointView.menu">
<action
label="%ShowFullPathsAction.label"
style="toggle"
icon="icons/full/clcl16/show_paths.gif"
style="toggle"
helpContextId="show_full_paths_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
@ -940,8 +926,8 @@
disabledIcon="icons/full/dlcl16/watch_globals.gif"
enablesFor="1"
icon="icons/full/elcl16/watch_globals.gif"
label="%AddGlobalsAction.label"
helpContextId="add_globals_action_context"
label="%AddGlobalsAction.label"
tooltip="%AddGlobalsAction.tooltip">
<enablement>
<pluginState
@ -956,11 +942,11 @@
id="org.eclipse.debug.ui.sharedLibrariesView.menu">
<action
label="%ShowFullPathsAction.label"
icon="icons/full/clcl16/show_paths.gif"
style="toggle"
icon="icons/full/clcl16/show_paths.gif"
helpContextId="show_full_paths_context"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
@ -1051,20 +1037,20 @@
<extension
point="org.eclipse.debug.core.statusHandlers">
<statusHandler
code="10000"
plugin="org.eclipse.cdt.debug.core"
code="10000"
class="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler">
</statusHandler>
<statusHandler
code="10001"
plugin="org.eclipse.cdt.debug.core"
code="10001"
class="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler">
</statusHandler>
<statusHandler
code="10002"
plugin="org.eclipse.cdt.debug.core"
code="10002"
class="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler">
</statusHandler>
@ -1121,16 +1107,16 @@
point="org.eclipse.ui.editors">
<editor
name="%DisassemblyEditor.name"
extensions="dasm"
icon="icons/full/obj16/disassembly_obj.gif"
extensions="dasm"
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor"
id="org.eclipse.cdt.debug.ui.DisassemblyEditor">
</editor>
<editor
name="%CDebugEditor.name"
icon="icons/full/obj16/filenotfound_obj.gif"
class="org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor"
contributorClass="org.eclipse.cdt.internal.ui.editor.CEditorActionContributor"
class="org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor"
id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
</editor>
</extension>
@ -1152,8 +1138,8 @@
<context
name="Debugging C/C++"
description="Debugging C/C++ Programs"
id="org.eclipse.cdt.debug.ui.debugging"
parentId="org.eclipse.debug.ui.debugging">
parentId="org.eclipse.debug.ui.debugging"
id="org.eclipse.cdt.debug.ui.debugging">
</context>
</extension>
<extension
@ -1185,8 +1171,8 @@
<extension
point="org.eclipse.ui.editors.annotationTypes">
<type
super="org.eclipse.debug.core.breakpoint"
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"
super="org.eclipse.debug.core.breakpoint"
name="org.eclipse.cdt.debug.core.breakpoint">
</type>
</extension>

View file

@ -71,12 +71,12 @@ public class AddAddressBreakpointActionDelegate extends AbstractListenerActionDe
new AddressValidator() );
if ( dialog.open() == Window.OK )
{
CDebugModel.createAddressBreakpoint( ((IExecFileInfo)getDebugTarget( element ).getAdapter( IExecFileInfo.class )).getExecFile(),
parseValue( dialog.getValue().trim() ),
true,
0,
"", //$NON-NLS-1$
true );
// CDebugModel.createAddressBreakpoint( ((IExecFileInfo)getDebugTarget( element ).getAdapter( IExecFileInfo.class )).getExecFile(),
// parseValue( dialog.getValue().trim() ),
// true,
// 0,
// "", //$NON-NLS-1$
// true );
}
}

View file

@ -1,11 +1,16 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.ui.actions;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@ -34,35 +39,34 @@ import org.eclipse.ui.texteditor.ITextEditor;
*
* @since Sep 4, 2002
*/
public class AddWatchpointActionDelegate extends ActionDelegate
implements IWorkbenchWindowActionDelegate,
IPartListener
{
public class AddWatchpointActionDelegate extends ActionDelegate implements IWorkbenchWindowActionDelegate, IPartListener {
private boolean fInitialized = false;
private IAction fAction = null;
private ITextEditor fTextEditor = null;
private IWorkbenchWindow fWorkbenchWindow = null;
private IProject fProject = null;
/**
* Constructor for AddWatchpointActionDelegate.
*/
public AddWatchpointActionDelegate()
{
public AddWatchpointActionDelegate() {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose()
{
public void dispose() {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
*/
public void init( IWorkbenchWindow window )
{
public void init( IWorkbenchWindow window ) {
setWorkbenchWindow( window );
window.getPartService().addPartListener( this );
}
@ -70,41 +74,28 @@ public class AddWatchpointActionDelegate extends ActionDelegate
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run( IAction action )
{
public void run( IAction action ) {
String expression = getSelectedExpression();
AddWatchpointDialog dlg = new AddWatchpointDialog( CDebugUIPlugin.getActiveWorkbenchShell(),
true,
false,
expression );
AddWatchpointDialog dlg = new AddWatchpointDialog( CDebugUIPlugin.getActiveWorkbenchShell(), true, false, expression );
if ( dlg.open() != Window.OK )
return;
if ( getTextEditor() != null )
{
if ( getTextEditor() != null ) {
update();
addWatchpoint( getTextEditor().getEditorInput(),
dlg.getWriteAccess(),
dlg.getReadAccess(),
dlg.getExpression() );
addWatchpoint( getTextEditor().getEditorInput(), dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression() );
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( !fInitialized )
{
public void selectionChanged( IAction action, ISelection selection ) {
if ( !fInitialized ) {
setAction( action );
if ( getWorkbenchWindow() != null )
{
if ( getWorkbenchWindow() != null ) {
IWorkbenchPage page = getWorkbenchWindow().getActivePage();
if ( page != null )
{
if ( page != null ) {
IEditorPart part = page.getActiveEditor();
if ( part instanceof ITextEditor )
{
if ( part instanceof ITextEditor ) {
setTextEditor( (ITextEditor)part );
}
}
@ -113,53 +104,42 @@ public class AddWatchpointActionDelegate extends ActionDelegate
}
}
protected IAction getAction()
{
protected IAction getAction() {
return fAction;
}
protected void setAction( IAction action )
{
protected void setAction( IAction action ) {
fAction = action;
}
protected IWorkbenchWindow getWorkbenchWindow()
{
protected IWorkbenchWindow getWorkbenchWindow() {
return fWorkbenchWindow;
}
protected void setWorkbenchWindow( IWorkbenchWindow workbenchWindow )
{
protected void setWorkbenchWindow( IWorkbenchWindow workbenchWindow ) {
fWorkbenchWindow = workbenchWindow;
}
protected ITextEditor getTextEditor()
{
protected ITextEditor getTextEditor() {
return fTextEditor;
}
protected void setTextEditor( ITextEditor editor )
{
protected void setTextEditor( ITextEditor editor ) {
fTextEditor = editor;
if ( fTextEditor != null )
{
if ( fTextEditor != null ) {
IEditorInput input = fTextEditor.getEditorInput();
IFile file = ( input != null && input instanceof IFileEditorInput ) ? ((IFileEditorInput)input).getFile() : null;
setProject( ( file != null ) ? file.getProject() : null );
IFile file = (input != null && input instanceof IFileEditorInput) ? ((IFileEditorInput)input).getFile() : null;
setProject( (file != null) ? file.getProject() : null );
}
setEnabledState( editor );
}
protected String getSelectedExpression()
{
if ( getTextEditor() != null )
{
protected String getSelectedExpression() {
if ( getTextEditor() != null ) {
ISelectionProvider sp = getTextEditor().getSelectionProvider();
if ( sp != null )
{
if ( sp != null ) {
ISelection s = sp.getSelection();
if ( s instanceof ITextSelection )
{
if ( s instanceof ITextSelection ) {
return ((ITextSelection)s).getText().trim();
}
}
@ -167,70 +147,51 @@ public class AddWatchpointActionDelegate extends ActionDelegate
return ""; //$NON-NLS-1$
}
protected void update( ISelection selection )
{
protected void update( ISelection selection ) {
setEnabledState( getTextEditor() );
}
protected void update()
{
protected void update() {
IAction action = getAction();
if ( action != null )
{
if ( action != null ) {
action.setEnabled( getTextEditor() != null );
}
}
protected void setEnabledState( ITextEditor editor )
{
if ( getAction() != null )
{
protected void setEnabledState( ITextEditor editor ) {
if ( getAction() != null ) {
getAction().setEnabled( editor != null );
}
}
protected IProject getProject()
{
protected IProject getProject() {
return fProject;
}
protected void setProject( IProject project )
{
protected void setProject( IProject project ) {
fProject = project;
}
protected void addWatchpoint( IEditorInput editorInput, boolean write, boolean read, String expression )
{
protected void addWatchpoint( IEditorInput editorInput, boolean write, boolean read, String expression ) {
if ( getProject() == null )
return;
IDocument document = getTextEditor().getDocumentProvider().getDocument( editorInput );
WatchpointExpressionVerifier wev = new WatchpointExpressionVerifier();
if ( wev.isValidExpression( document, expression ) )
{
try
{
CDebugModel.createWatchpoint( getProject(),
write,
read,
expression,
true,
0,
"", //$NON-NLS-1$
true );
if ( wev.isValidExpression( document, expression ) ) {
try {
CDIDebugModel.createWatchpoint( "", getProject(), write, read, expression, true, 0, "", true ); //$NON-NLS-1$
}
catch( CoreException ce )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.AddWatchpointActionDelegate.Cannot_add_watchpoint"), ce ); //$NON-NLS-1$
catch( CoreException ce ) {
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString( "internal.ui.actions.AddWatchpointActionDelegate.Cannot_add_watchpoint" ), ce ); //$NON-NLS-1$
}
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart)
*/
public void partActivated( IWorkbenchPart part )
{
if ( part instanceof ITextEditor )
{
public void partActivated( IWorkbenchPart part ) {
if ( part instanceof ITextEditor ) {
setTextEditor( (ITextEditor)part );
}
}
@ -238,20 +199,16 @@ public class AddWatchpointActionDelegate extends ActionDelegate
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart)
*/
public void partBroughtToTop( IWorkbenchPart part )
{
public void partBroughtToTop( IWorkbenchPart part ) {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart)
*/
public void partClosed( IWorkbenchPart part )
{
if ( part == getTextEditor() )
{
public void partClosed( IWorkbenchPart part ) {
if ( part == getTextEditor() ) {
setTextEditor( null );
if ( getAction() != null )
{
if ( getAction() != null ) {
getAction().setEnabled( false );
}
}
@ -260,21 +217,17 @@ public class AddWatchpointActionDelegate extends ActionDelegate
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart)
*/
public void partDeactivated( IWorkbenchPart part )
{
public void partDeactivated( IWorkbenchPart part ) {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart)
*/
public void partOpened( IWorkbenchPart part )
{
if ( part instanceof ITextEditor )
{
if ( getTextEditor() == null )
{
public void partOpened( IWorkbenchPart part ) {
if ( part instanceof ITextEditor ) {
if ( getTextEditor() == null ) {
setTextEditor( (ITextEditor)part );
}
}
}
}
}

View file

@ -1,317 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.texteditor.ITextEditor;
/**
*
* Action for adding/removing breakpoints at a line in the source file
* shown in the active C/C++ Editor.
*
* @since Sep 3, 2002
*/
public class ManageBreakpointActionDelegate implements IWorkbenchWindowActionDelegate,
IPartListener
{
private boolean fInitialized = false;
private IAction fAction = null;
private int fLineNumber;
private ITextEditor fTextEditor = null;
private IWorkbenchWindow fWorkbenchWindow = null;
private IFile fFile = null;
/**
* Constructor for ManageBreakpointActionDelegate.
*/
public ManageBreakpointActionDelegate()
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose()
{
getWorkbenchWindow().getPartService().removePartListener( this );
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
*/
public void init( IWorkbenchWindow window )
{
setWorkbenchWindow( window );
window.getPartService().addPartListener( this );
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partActivated(IWorkbenchPart)
*/
public void partActivated( IWorkbenchPart part )
{
if ( part instanceof ITextEditor )
{
setTextEditor( (ITextEditor)part );
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partBroughtToTop(IWorkbenchPart)
*/
public void partBroughtToTop( IWorkbenchPart part )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partClosed(IWorkbenchPart)
*/
public void partClosed( IWorkbenchPart part )
{
if ( part == getTextEditor() )
{
setTextEditor( null );
if ( getAction() != null )
{
getAction().setEnabled( false );
}
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partDeactivated(IWorkbenchPart)
*/
public void partDeactivated( IWorkbenchPart part )
{
}
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partOpened(IWorkbenchPart)
*/
public void partOpened( IWorkbenchPart part )
{
if ( part instanceof ITextEditor )
{
if ( getTextEditor() == null )
{
setTextEditor( (ITextEditor)part );
}
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(IAction)
*/
public void run( IAction action )
{
if ( getTextEditor() != null )
{
update();
manageBreakpoint( getTextEditor().getEditorInput() );
}
}
protected void update( ISelection selection )
{
setEnabledState( getTextEditor() );
}
protected void update()
{
IAction action = getAction();
if ( action != null )
{
if ( getTextEditor() != null )
{
breakpointExists( getTextEditor().getEditorInput() );
}
action.setEnabled( getTextEditor() != null && getFile() != null );
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
if ( !fInitialized )
{
setAction( action );
if ( getWorkbenchWindow() != null )
{
IWorkbenchPage page = getWorkbenchWindow().getActivePage();
if ( page != null )
{
IEditorPart part = page.getActiveEditor();
if ( part instanceof ITextEditor )
{
setTextEditor( (ITextEditor)part );
update( getTextEditor().getSelectionProvider().getSelection() );
}
}
}
fInitialized = true;
}
update( selection );
}
/**
* Manages a breakpoint.
*/
protected void manageBreakpoint( IEditorInput editorInput )
{
ISelectionProvider sp = getTextEditor().getSelectionProvider();
if ( sp == null || getFile() == null )
{
beep();
return;
}
ISelection selection = sp.getSelection();
if ( selection instanceof ITextSelection )
{
if ( getFile() == null )
return;
IDocument document = getTextEditor().getDocumentProvider().getDocument( editorInput );
BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine());
if ( lineNumber > -1 )
{
try
{
ICLineBreakpoint breakpoint = CDebugModel.lineBreakpointExists( getFile().getLocation().toOSString(), lineNumber );
if ( breakpoint != null )
{
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
}
else
{
CDebugModel.createLineBreakpoint( getFile(),
lineNumber,
true,
0,
"", //$NON-NLS-1$
true );
}
}
catch( CoreException ce )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageBreakpointActionDelegate.Cannot_add_breakpoint"), ce ); //$NON-NLS-1$
}
}
}
}
/**
* Determines if a breakpoint exists on the line of the current selection.
*/
protected boolean breakpointExists(IEditorInput editorInput)
{
if ( getFile() != null )
{
try
{
return CDebugModel.lineBreakpointExists( getFile().getLocation().toOSString(), getLineNumber() ) == null;
}
catch (CoreException ce)
{
CDebugUIPlugin.log( ce );
}
}
return false;
}
protected IWorkbenchWindow getWorkbenchWindow()
{
return fWorkbenchWindow;
}
protected void setWorkbenchWindow( IWorkbenchWindow workbenchWindow )
{
fWorkbenchWindow = workbenchWindow;
}
protected ITextEditor getTextEditor()
{
return fTextEditor;
}
protected void setTextEditor( ITextEditor editor )
{
fTextEditor = editor;
if ( fTextEditor != null )
{
IEditorInput input = fTextEditor.getEditorInput();
setFile( ( input != null && input instanceof IFileEditorInput ) ? ((IFileEditorInput)input).getFile() : null );
}
setEnabledState( editor );
}
protected void setEnabledState( ITextEditor editor )
{
if ( getAction() != null )
{
getAction().setEnabled( editor != null );
}
}
protected void beep()
{
if ( CDebugUIPlugin.getActiveWorkbenchShell() != null )
{
CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
}
}
protected int getLineNumber()
{
return fLineNumber;
}
protected void setLineNumber( int lineNumber )
{
fLineNumber = lineNumber;
}
protected IAction getAction()
{
return fAction;
}
protected void setAction( IAction action )
{
fAction = action;
}
protected IFile getFile()
{
return fFile;
}
protected void setFile( IFile file )
{
fFile = file;
}
}

View file

@ -1,17 +1,19 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.ui.actions;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@ -19,37 +21,29 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.IUpdate;
/**
*
* Enter type comment.
*
* @since Aug 23, 2002
*/
public class ManageBreakpointRulerAction extends Action implements IUpdate
{
public class ManageBreakpointRulerAction extends Action {
private IVerticalRulerInfo fRuler;
private ITextEditor fTextEditor;
private List fMarkers;
private String fAddLabel;
private String fRemoveLabel;
private ToggleBreakpointAdapter fBreakpointAdapter;
/**
* Constructor for ManageBreakpointRulerAction.
@ -57,80 +51,86 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
* @param ruler
* @param editor
*/
public ManageBreakpointRulerAction( IVerticalRulerInfo ruler, ITextEditor editor )
{
public ManageBreakpointRulerAction( IVerticalRulerInfo ruler, ITextEditor editor ) {
super( "Toggle &Breakpoint" );
fRuler = ruler;
fTextEditor = editor;
fAddLabel = CDebugUIPlugin.getResourceString("internal.ui.actions.ManageBreakpointRulerAction.Add_Breakpoint"); //$NON-NLS-1$
fRemoveLabel = CDebugUIPlugin.getResourceString("internal.ui.actions.ManageBreakpointRulerAction.Remove_Breakpoint"); //$NON-NLS-1$
fBreakpointAdapter = new ToggleBreakpointAdapter();
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.IUpdate#update()
/**
* Disposes this action
*/
public void update()
{
fMarkers = getMarkers();
setText( fMarkers.isEmpty() ? fAddLabel : fRemoveLabel );
public void dispose() {
fTextEditor = null;
fRuler = null;
}
/**
* @see Action#run()
*/
public void run()
{
if ( fMarkers.isEmpty() )
{
addMarker();
public void run() {
try {
List list = getMarkers();
if ( list.isEmpty() ) {
// create new markers
IDocument document = getDocument();
int lineNumber = getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
IRegion line = document.getLineInformation( lineNumber );
ITextSelection selection = new TextSelection( document, line.getOffset(), line.getLength() );
fBreakpointAdapter.toggleLineBreakpoints( fTextEditor, selection );
}
else {
// remove existing breakpoints of any type
IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
Iterator iterator = list.iterator();
while( iterator.hasNext() ) {
IMarker marker = (IMarker)iterator.next();
IBreakpoint breakpoint = manager.getBreakpoint( marker );
if ( breakpoint != null ) {
breakpoint.delete();
}
}
}
}
else
{
removeMarkers( fMarkers );
catch( BadLocationException e ) {
DebugUIPlugin.errorDialog( getTextEditor().getSite().getShell(),
"Error",
"Operation failed",
e );
}
catch( CoreException e ) {
DebugUIPlugin.errorDialog( getTextEditor().getSite().getShell(),
"Error",
"Operation failed",
e.getStatus() );
}
}
protected List getMarkers()
{
protected List getMarkers() {
List breakpoints = new ArrayList();
IResource resource = getResource();
IResource resource = ToggleBreakpointAdapter.getResource( fTextEditor );
IDocument document = getDocument();
AbstractMarkerAnnotationModel model = getAnnotationModel();
if ( model != null )
{
try
{
if ( model != null ) {
try {
IMarker[] markers = null;
if ( resource instanceof IFile && !(getTextEditor().getEditorInput() instanceof DisassemblyEditorInput) )
{
markers = resource.findMarkers( IBreakpoint.BREAKPOINT_MARKER,
true,
IResource.DEPTH_INFINITE );
}
else
{
if ( resource instanceof IFile )
markers = resource.findMarkers( IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE );
else {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
markers = root.findMarkers( IBreakpoint.BREAKPOINT_MARKER,
true,
IResource.DEPTH_INFINITE );
markers = root.findMarkers( IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE );
}
if ( markers != null )
{
if ( markers != null ) {
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
for ( int i = 0; i < markers.length; i++ )
{
for( int i = 0; i < markers.length; i++ ) {
IBreakpoint breakpoint = breakpointManager.getBreakpoint( markers[i] );
if ( breakpoint != null &&
breakpointManager.isRegistered( breakpoint ) &&
includesRulerLine( model.getMarkerPosition( markers[i] ), document ) )
if ( breakpoint != null && breakpointManager.isRegistered( breakpoint ) && includesRulerLine( model.getMarkerPosition( markers[i] ), document ) )
breakpoints.add( markers[i] );
}
}
}
catch( CoreException x )
{
catch( CoreException x ) {
CDebugUIPlugin.log( x.getStatus() );
}
}
@ -143,8 +143,7 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
*
* @return the resource for which to create the marker or <code>null</code>
*/
protected IResource getResource()
{
protected IResource getResource() {
IEditorInput input = fTextEditor.getEditorInput();
IResource resource = (IResource)input.getAdapter( IFile.class );
if ( resource == null )
@ -159,21 +158,16 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
* @param document the document the position refers to
* @return <code>true</code> if the line is included by the given position
*/
protected boolean includesRulerLine( Position position, IDocument document )
{
if ( position != null )
{
try
{
protected boolean includesRulerLine( Position position, IDocument document ) {
if ( position != null ) {
try {
int markerLine = document.getLineOfOffset( position.getOffset() );
int line = fRuler.getLineOfLastMouseButtonActivity();
if ( line == markerLine )
{
if ( line == markerLine ) {
return true;
}
}
catch( BadLocationException x )
{
catch( BadLocationException x ) {
}
}
return false;
@ -184,8 +178,7 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
*
* @return this action's vertical ruler
*/
protected IVerticalRulerInfo getVerticalRulerInfo()
{
protected IVerticalRulerInfo getVerticalRulerInfo() {
return fRuler;
}
@ -194,8 +187,7 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
*
* @return this action's editor
*/
protected ITextEditor getTextEditor()
{
protected ITextEditor getTextEditor() {
return fTextEditor;
}
@ -204,12 +196,10 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
*
* @return the marker annotation model
*/
protected AbstractMarkerAnnotationModel getAnnotationModel()
{
protected AbstractMarkerAnnotationModel getAnnotationModel() {
IDocumentProvider provider = fTextEditor.getDocumentProvider();
IAnnotationModel model = provider.getAnnotationModel( fTextEditor.getEditorInput() );
if ( model instanceof AbstractMarkerAnnotationModel )
{
if ( model instanceof AbstractMarkerAnnotationModel ) {
return (AbstractMarkerAnnotationModel)model;
}
return null;
@ -220,92 +210,8 @@ public class ManageBreakpointRulerAction extends Action implements IUpdate
*
* @return the document of the editor's input
*/
protected IDocument getDocument()
{
protected IDocument getDocument() {
IDocumentProvider provider = fTextEditor.getDocumentProvider();
return provider.getDocument( fTextEditor.getEditorInput() );
}
protected void addMarker()
{
IEditorInput editorInput = getTextEditor().getEditorInput();
int rulerLine = getVerticalRulerInfo().getLineOfLastMouseButtonActivity();
try
{
if ( editorInput instanceof IFileEditorInput )
{
createLineBreakpoint( (IFileEditorInput)editorInput, rulerLine );
}
else if ( editorInput.getAdapter( DisassemblyEditorInput.class ) != null )
{
createAddressBreakpoint( (DisassemblyEditorInput)editorInput.getAdapter( DisassemblyEditorInput.class ), rulerLine );
}
}
catch( DebugException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageBreakpointRulerAction.Cannot_add_breakpoint"), e ); //$NON-NLS-1$
}
catch( CoreException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageBreakpointRulerAction.Cannot_add_breakpoint"), e ); //$NON-NLS-1$
}
}
private void createLineBreakpoint( IFileEditorInput editorInput, int rulerLine ) throws CoreException
{
IDocument document = getDocument();
BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
int lineNumber = bv.getValidLineBreakpointLocation( document, rulerLine );
if ( lineNumber > -1 )
{
String fileName = editorInput.getFile().getLocation().toString();
if ( fileName != null )
{
if ( CDebugModel.lineBreakpointExists( fileName, lineNumber ) == null )
{
CDebugModel.createLineBreakpoint( editorInput.getFile(), lineNumber, true, 0, "", true ); //$NON-NLS-1$
}
}
}
}
private void createAddressBreakpoint( DisassemblyEditorInput editorInput, int rulerLine ) throws CoreException
{
IDocument document = getDocument();
BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
int lineNumber = bv.getValidAddressBreakpointLocation( document, rulerLine );
if ( lineNumber > -1 )
{
IResource resource = (IResource)editorInput.getAdapter( IResource.class );
if ( resource != null )
{
if ( editorInput.getStorage() != null )
{
long address = ((IDisassemblyStorage)editorInput.getStorage()).getAddress( lineNumber );
if ( address != 0 && CDebugModel.addressBreakpointExists( resource, address ) == null )
{
CDebugModel.createAddressBreakpoint( resource, address, true, 0, "", true ); //$NON-NLS-1$
}
}
}
}
}
protected void removeMarkers( List markers )
{
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
try
{
Iterator e = markers.iterator();
while( e.hasNext() )
{
IBreakpoint breakpoint = breakpointManager.getBreakpoint( (IMarker)e.next() );
breakpointManager.removeBreakpoint( breakpoint, true );
}
}
catch( CoreException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageBreakpointRulerAction.Cannot_remove_breakpoint"), e ); //$NON-NLS-1$
}
}
}
}

View file

@ -1,29 +1,45 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
/**********************************************************************
* 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.ui.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
import org.eclipse.ui.texteditor.ITextEditor;
/**
*
* Enter type comment.
*
* @since Aug 23, 2002
*/
public class ManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate
{
public class ManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
private ManageBreakpointRulerAction fTargetAction;
private IEditorPart fActiveEditor;
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(ITextEditor, IVerticalRulerInfo)
*/
public IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo )
{
return new ManageBreakpointRulerAction( rulerInfo, editor );
public IAction createAction( ITextEditor editor, IVerticalRulerInfo rulerInfo ) {
fTargetAction = new ManageBreakpointRulerAction( rulerInfo, editor );
return fTargetAction;
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
*/
public void setActiveEditor( IAction callerAction, IEditorPart targetEditor ) {
if ( fActiveEditor != null ) {
if ( fTargetAction != null ) {
fTargetAction.dispose();
fTargetAction = null;
}
}
fActiveEditor = targetEditor;
super.setActiveEditor( callerAction, targetEditor );
}
}

View file

@ -98,22 +98,22 @@ public class ManageFunctionBreakpointActionDelegate extends ActionDelegate
private void manageBreakpoint( IFunction function )
{
try
{
ICFunctionBreakpoint breakpoint = CDebugModel.functionBreakpointExists( function );
if ( breakpoint != null )
{
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
}
else
{
CDebugModel.createFunctionBreakpoint( function, true, 0, "", true ); //$NON-NLS-1$
}
}
catch( CoreException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageFunctionBreakpointActionDelegate.Cannot_add_breakpoint"), e ); //$NON-NLS-1$
}
// try
// {
// ICFunctionBreakpoint breakpoint = CDebugModel.functionBreakpointExists( function );
// if ( breakpoint != null )
// {
// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
// }
// else
// {
// CDebugModel.createFunctionBreakpoint( function, true, 0, "", true ); //$NON-NLS-1$
// }
// }
// catch( CoreException e )
// {
// CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageFunctionBreakpointActionDelegate.Cannot_add_breakpoint"), e ); //$NON-NLS-1$
// }
}
private IFunction getFunction()
@ -123,22 +123,22 @@ public class ManageFunctionBreakpointActionDelegate extends ActionDelegate
private void manageBreakpoint( IMethod method )
{
try
{
ICFunctionBreakpoint breakpoint = CDebugModel.methodBreakpointExists( method );
if ( breakpoint != null )
{
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
}
else
{
CDebugModel.createMethodBreakpoint( method, true, 0, "", true ); //$NON-NLS-1$
}
}
catch( CoreException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageFunctionBreakpointActionDelegate.Cannot_add_breakpoint"), e ); //$NON-NLS-1$
}
// try
// {
// ICFunctionBreakpoint breakpoint = CDebugModel.methodBreakpointExists( method );
// if ( breakpoint != null )
// {
// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
// }
// else
// {
// CDebugModel.createMethodBreakpoint( method, true, 0, "", true ); //$NON-NLS-1$
// }
// }
// catch( CoreException e )
// {
// CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.ManageFunctionBreakpointActionDelegate.Cannot_add_breakpoint"), e ); //$NON-NLS-1$
// }
}
private IMethod getMethod()

View file

@ -10,13 +10,31 @@
***********************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.texteditor.IEditorStatusLine;
import org.eclipse.ui.texteditor.ITextEditor;
/**
@ -28,7 +46,50 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public void toggleLineBreakpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
// TODO Auto-generated method stub
IEditorPart editorPart = (IEditorPart)part;
IEditorInput input = editorPart.getEditorInput();
String errorMessage = null;
if ( input == null ) {
errorMessage = "Empty editor";
}
else {
final ITextEditor textEditor = (ITextEditor)editorPart;
final IDocument document = textEditor.getDocumentProvider().getDocument( input );
if ( document == null ) {
errorMessage = "Missing document";
}
else {
IResource resource = getResource( textEditor );
if ( resource == null ) {
errorMessage = "Missing resource";
}
else {
BreakpointLocationVerifier bv = new BreakpointLocationVerifier();
int lineNumber = bv.getValidLineBreakpointLocation( document, ((ITextSelection)selection).getStartLine() );
if ( lineNumber == -1 ) {
errorMessage = "Invalid line";
}
else {
String sourceHandle = getSourceHandle( input );
ICLineBreakpoint breakpoint = CDIDebugModel.lineBreakpointExists( sourceHandle, resource, lineNumber );
if ( breakpoint != null ) {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
}
else {
CDIDebugModel.createLineBreakpoint( sourceHandle,
resource,
lineNumber,
true,
0,
"", //$NON-NLS-1$
true );
}
return;
}
}
}
}
throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
}
/* (non-Javadoc)
@ -49,22 +110,70 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public boolean canToggleMethodBreakpoints( IWorkbenchPart part, ISelection selection ) {
// TODO for now
return ( selection instanceof ITextSelection );
return false;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public void toggleWatchpoints( IWorkbenchPart part, ISelection selection ) throws CoreException {
// TODO Auto-generated method stub
IEditorPart editorPart = (IEditorPart)part;
IEditorInput input = editorPart.getEditorInput();
String errorMessage = null;
if ( input == null ) {
errorMessage = "Empty editor";
}
else {
final ITextEditor textEditor = (ITextEditor)editorPart;
final IDocument document = textEditor.getDocumentProvider().getDocument( input );
if ( document == null ) {
errorMessage = "Missing document";
}
else {
IResource resource = getResource( textEditor );
if ( resource == null ) {
errorMessage = "Missing resource";
}
else {
if ( !(resource instanceof IWorkspaceRoot) )
resource = resource.getProject();
String expression = ( selection instanceof TextSelection ) ? ((TextSelection)selection).getText().trim() : ""; //$NON-NLS-1$
AddWatchpointDialog dlg = new AddWatchpointDialog( textEditor.getSite().getShell(), true, false, expression );
if ( dlg.open() != Window.OK )
return;
WatchpointExpressionVerifier wev = new WatchpointExpressionVerifier();
if ( !wev.isValidExpression( document, expression ) ) {
errorMessage = "Invalid expression: " + expression;
}
else {
String sourceHandle = getSourceHandle( input );
ICWatchpoint watchpoint = CDIDebugModel.watchpointExists( sourceHandle, resource, expression );
if ( watchpoint != null ) {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( watchpoint, true );
}
else {
CDIDebugModel.createWatchpoint( sourceHandle,
resource,
dlg.getWriteAccess(),
dlg.getReadAccess(),
expression,
true,
0,
"", //$NON-NLS-1$
true );
}
return;
}
}
}
}
throw new CoreException( new Status( IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), ICDebugUIConstants.INTERNAL_ERROR, errorMessage, null ) );
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public boolean canToggleWatchpoints( IWorkbenchPart part, ISelection selection ) {
// TODO for now
return ( selection instanceof ITextSelection );
}
@ -82,4 +191,26 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
}
}
protected static IResource getResource( IEditorPart editor ) {
IResource resource;
IEditorInput editorInput = editor.getEditorInput();
if ( editorInput instanceof IFileEditorInput ) {
resource = ((IFileEditorInput)editorInput).getFile();
}
else {
resource = ResourcesPlugin.getWorkspace().getRoot();
}
return resource;
}
private String getSourceHandle( IEditorInput input ) throws CoreException {
if ( input instanceof IFileEditorInput ) {
return ((IFileEditorInput)input).getFile().getFullPath().toOSString();
}
if ( input instanceof IStorageEditorInput ) {
return ((IStorageEditorInput)input).getStorage().getName();
}
return ""; //$NON-NLS-1$
}
}

View file

@ -7,13 +7,12 @@ package org.eclipse.cdt.debug.internal.ui.editors;
import java.util.ArrayList;
import org.eclipse.cdt.debug.core.ICBreakpointManager;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
@ -34,7 +33,6 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Position;
import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
@ -242,21 +240,21 @@ public class DisassemblyMarkerAnnotationModel extends AbstractMarkerAnnotationMo
private Position createPositionFromLineBreakpoint( IMarker marker )
{
if ( fStorage != null )
{
IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( marker );
if ( breakpoint instanceof ICBreakpoint )
{
IDebugTarget target = fStorage.getDebugTarget();
if ( target != null && target.getAdapter( ICBreakpointManager.class ) != null )
{
ICBreakpointManager bm = (ICBreakpointManager)target.getAdapter( ICBreakpointManager.class );
long address = bm.getBreakpointAddress( (ICBreakpoint)breakpoint );
if ( address != 0 )
return createPositionFromAddress( address );
}
}
}
// if ( fStorage != null )
// {
// IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( marker );
// if ( breakpoint instanceof ICBreakpoint )
// {
// IDebugTarget target = fStorage.getDebugTarget();
// if ( target != null && target.getAdapter( ICBreakpointManager.class ) != null )
// {
// ICBreakpointManager bm = (ICBreakpointManager)target.getAdapter( ICBreakpointManager.class );
// long address = bm.getBreakpointAddress( (ICBreakpoint)breakpoint );
// if ( address != 0 )
// return createPositionFromAddress( address );
// }
// }
// }
return null;
}