1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 12:03:16 +02:00

Added support for the "Skip Breakpoints" and "Skip breakpoints during a "Run To Line" operation.

This commit is contained in:
Mikhail Khodjaiants 2004-06-16 20:17:55 +00:00
parent dc43de0584
commit fbc9d83a65
7 changed files with 64 additions and 13 deletions

View file

@ -1,3 +1,10 @@
2004-06-16 Mikhail Khodjaiants
Added support for the "Skip Breakpoints" and "Skip breakpoints during a "Run To Line" operation.
* IRunToAddress.java
* IRunToLine.java
* CBreakpointManager.java
* CDebugTarget.java
2004-06-12 Mikhail Khodjaiants 2004-06-12 Mikhail Khodjaiants
"CUpdateManager" extends "Observable" to support "Auto-Refresh" toggle actions. "CUpdateManager" extends "Observable" to support "Auto-Refresh" toggle actions.
* CRegisterManager.java * CRegisterManager.java

View file

@ -29,5 +29,5 @@ public interface IRunToAddress {
* *
* @exception DebugException on failure. Reasons include: * @exception DebugException on failure. Reasons include:
*/ */
public void runToAddress( long address ) throws DebugException; public void runToAddress( long address, boolean skipBreakpoints ) throws DebugException;
} }

View file

@ -30,7 +30,7 @@ public interface IRunToLine {
* *
* @exception DebugException on failure. Reasons include: * @exception DebugException on failure. Reasons include:
*/ */
public void runToLine( IFile file, int lineNumber ) throws DebugException; public void runToLine( IFile file, int lineNumber, boolean skipBreakpoints ) throws DebugException;
/** /**
* Returns whether this operation is currently available for this file and line number. * Returns whether this operation is currently available for this file and line number.
@ -44,5 +44,5 @@ public interface IRunToLine {
* *
* @exception DebugException on failure. Reasons include: * @exception DebugException on failure. Reasons include:
*/ */
public void runToLine( String fileName, int lineNumber ) throws DebugException; public void runToLine( String fileName, int lineNumber, boolean skipBreakpoints ) throws DebugException;
} }

View file

@ -126,6 +126,8 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
private BreakpointMap fMap; private BreakpointMap fMap;
private boolean fSkipBreakpoint= false;
public CBreakpointManager( CDebugTarget target ) { public CBreakpointManager( CDebugTarget target ) {
super(); super();
setDebugTarget( target ); setDebugTarget( target );
@ -353,6 +355,14 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint ); doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint );
else if ( cdiBreakpoint instanceof ICDIWatchpoint ) else if ( cdiBreakpoint instanceof ICDIWatchpoint )
doHandleWatchpointCreatedEvent( (ICDIWatchpoint)cdiBreakpoint ); doHandleWatchpointCreatedEvent( (ICDIWatchpoint)cdiBreakpoint );
if ( !cdiBreakpoint.isTemporary() && !DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) {
try {
cdiBreakpoint.setEnabled( false );
}
catch( CDIException e ) {
DebugPlugin.log( e );
}
}
} }
protected void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint cdiBreakpoint ) { protected void doHandleLocationBreakpointCreatedEvent( ICDILocationBreakpoint cdiBreakpoint ) {
@ -396,7 +406,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
if ( breakpoint != null ) { if ( breakpoint != null ) {
Map map = new HashMap( 3 ); Map map = new HashMap( 3 );
try { try {
if ( DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) { if ( !fSkipBreakpoint && DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) {
map.put( IBreakpoint.ENABLED, new Boolean( cdiBreakpoint.isEnabled() ) ); map.put( IBreakpoint.ENABLED, new Boolean( cdiBreakpoint.isEnabled() ) );
} }
else { else {
@ -631,19 +641,32 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
* @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean) * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
*/ */
public void breakpointManagerEnablementChanged( boolean enabled ) { public void breakpointManagerEnablementChanged( boolean enabled ) {
doSkipBreakpoints( !enabled );
}
public void skipBreakpoints( boolean enabled ) {
if ( fSkipBreakpoint != enabled && (DebugPlugin.getDefault().getBreakpointManager().isEnabled() || !enabled) ) {
fSkipBreakpoint = enabled;
doSkipBreakpoints( enabled );
}
}
private void doSkipBreakpoints( boolean enabled ) {
ICBreakpoint[] cBreakpoints = getBreakpointMap().getAllCBreakpoints(); ICBreakpoint[] cBreakpoints = getBreakpointMap().getAllCBreakpoints();
for ( int i = 0; i < cBreakpoints.length; ++i ) { for ( int i = 0; i < cBreakpoints.length; ++i ) {
try { try {
if ( cBreakpoints[i].isEnabled() ) { if ( cBreakpoints[i].isEnabled() ) {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( cBreakpoints[i] ); ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( cBreakpoints[i] );
if ( cdiBreakpoint != null ) { if ( cdiBreakpoint != null ) {
cdiBreakpoint.setEnabled( enabled ); cdiBreakpoint.setEnabled( !enabled );
} }
} }
} }
catch( CoreException e ) { catch( CoreException e ) {
DebugPlugin.log( e.getStatus() );
} }
catch( CDIException e ) { catch( CDIException e ) {
DebugPlugin.log( e );
} }
} }
} }

View file

@ -1325,6 +1325,7 @@ public class CDebugTarget extends CDebugElement
// Reset the registers that have errors. // Reset the registers that have errors.
getRegisterManager().targetSuspended(); getRegisterManager().targetSuspended();
setSuspensionThread(); setSuspensionThread();
getBreakpointManager().skipBreakpoints( false );
List newThreads = refreshThreads(); List newThreads = refreshThreads();
if ( event.getSource() instanceof ICDITarget ) if ( event.getSource() instanceof ICDITarget )
{ {
@ -1856,10 +1857,13 @@ public class CDebugTarget extends CDebugElement
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IRunToLine#runToLine(IResource, int) * @see org.eclipse.cdt.debug.core.IRunToLine#runToLine(IResource, int)
*/ */
public void runToLine( String fileName, int lineNumber ) throws DebugException public void runToLine( String fileName, int lineNumber, boolean skipBreakpoints ) throws DebugException
{ {
if ( !canRunToLine( fileName, lineNumber ) ) if ( !canRunToLine( fileName, lineNumber ) )
return; return;
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( true );
}
ICDILocation location = getCDISession().getBreakpointManager().createLocation( fileName, null, lineNumber ); ICDILocation location = getCDISession().getBreakpointManager().createLocation( fileName, null, lineNumber );
try try
{ {
@ -1867,6 +1871,9 @@ public class CDebugTarget extends CDebugElement
} }
catch( CDIException e ) catch( CDIException e )
{ {
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( false );
}
targetRequestFailed( e.getMessage(), e ); targetRequestFailed( e.getMessage(), e );
} }
} }
@ -1883,11 +1890,11 @@ public class CDebugTarget extends CDebugElement
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IRunToLine#runToLine(IResource, int) * @see org.eclipse.cdt.debug.core.IRunToLine#runToLine(IResource, int)
*/ */
public void runToLine( IFile file, int lineNumber ) throws DebugException public void runToLine( IFile file, int lineNumber, boolean skipBreakpoints ) throws DebugException
{ {
if ( !canRunToLine( file, lineNumber ) ) if ( !canRunToLine( file, lineNumber ) )
return; return;
runToLine( file.getLocation().lastSegment(), lineNumber ); runToLine( file.getLocation().lastSegment(), lineNumber, skipBreakpoints );
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -2111,10 +2118,13 @@ public class CDebugTarget extends CDebugElement
/** /**
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToLine(long) * @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToLine(long)
*/ */
public void runToAddress( long address ) throws DebugException public void runToAddress( long address, boolean skipBreakpoints ) throws DebugException
{ {
if ( !canRunToAddress( address ) ) if ( !canRunToAddress( address ) )
return; return;
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( true );
}
ICDILocation location = getCDISession().getBreakpointManager().createLocation( address ); ICDILocation location = getCDISession().getBreakpointManager().createLocation( address );
try try
{ {
@ -2122,6 +2132,9 @@ public class CDebugTarget extends CDebugElement
} }
catch( CDIException e ) catch( CDIException e )
{ {
if ( skipBreakpoints ) {
getBreakpointManager().skipBreakpoints( false );
}
targetRequestFailed( e.getMessage(), e ); targetRequestFailed( e.getMessage(), e );
} }
} }

View file

@ -1,3 +1,7 @@
2004-06-16 Mikhail Khodjaiants
Added support for the "Skip Breakpoints" and "Skip breakpoints during a "Run To Line" operation.
* RunToLineAdapter.java
2004-06-16 Mikhail Khodjaiants 2004-06-16 Mikhail Khodjaiants
Removed the "Add Address Breakpoint" and "Add Watchpoint" global actions. Removed the "Add Address Breakpoint" and "Add Watchpoint" global actions.
* plugin.properties * plugin.properties

View file

@ -23,6 +23,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.ISuspendResume; import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.actions.IRunToLineTarget; import org.eclipse.debug.ui.actions.IRunToLineTarget;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextSelection;
@ -65,8 +67,9 @@ public class RunToLineAdapter implements IRunToLineTarget {
int lineNumber = textSelection.getStartLine() + 1; int lineNumber = textSelection.getStartLine() + 1;
if ( target instanceof IAdaptable ) { if ( target instanceof IAdaptable ) {
IRunToLine runToLine = (IRunToLine)((IAdaptable)target).getAdapter( IRunToLine.class ); IRunToLine runToLine = (IRunToLine)((IAdaptable)target).getAdapter( IRunToLine.class );
if ( runToLine != null && runToLine.canRunToLine( fileName, lineNumber ) ) if ( runToLine != null && runToLine.canRunToLine( fileName, lineNumber ) ) {
runToLine.runToLine( fileName, lineNumber ); runToLine.runToLine( fileName, lineNumber, DebugUIPlugin.getDefault().getPluginPreferences().getBoolean( IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE ) );
}
} }
return; return;
} }
@ -83,8 +86,9 @@ public class RunToLineAdapter implements IRunToLineTarget {
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
if ( target instanceof IAdaptable ) { if ( target instanceof IAdaptable ) {
IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class ); IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class );
if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) {
runToAddress.runToAddress( address ); runToAddress.runToAddress( address, DebugUIPlugin.getDefault().getPluginPreferences().getBoolean( IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE ) );
}
} }
return; return;
} }