mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Added support for the "Skip Breakpoints" and "Skip breakpoints during a "Run To Line" operation.
This commit is contained in:
parent
dc43de0584
commit
fbc9d83a65
7 changed files with 64 additions and 13 deletions
|
@ -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
|
||||
"CUpdateManager" extends "Observable" to support "Auto-Refresh" toggle actions.
|
||||
* CRegisterManager.java
|
||||
|
|
|
@ -29,5 +29,5 @@ public interface IRunToAddress {
|
|||
*
|
||||
* @exception DebugException on failure. Reasons include:
|
||||
*/
|
||||
public void runToAddress( long address ) throws DebugException;
|
||||
public void runToAddress( long address, boolean skipBreakpoints ) throws DebugException;
|
||||
}
|
|
@ -30,7 +30,7 @@ public interface IRunToLine {
|
|||
*
|
||||
* @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.
|
||||
|
@ -44,5 +44,5 @@ public interface IRunToLine {
|
|||
*
|
||||
* @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;
|
||||
}
|
|
@ -125,6 +125,8 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
|||
private CDebugTarget fDebugTarget;
|
||||
|
||||
private BreakpointMap fMap;
|
||||
|
||||
private boolean fSkipBreakpoint= false;
|
||||
|
||||
public CBreakpointManager( CDebugTarget target ) {
|
||||
super();
|
||||
|
@ -353,6 +355,14 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
|||
doHandleLocationBreakpointCreatedEvent( (ICDILocationBreakpoint)cdiBreakpoint );
|
||||
else if ( cdiBreakpoint instanceof ICDIWatchpoint )
|
||||
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 ) {
|
||||
|
@ -396,7 +406,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
|||
if ( breakpoint != null ) {
|
||||
Map map = new HashMap( 3 );
|
||||
try {
|
||||
if ( DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) {
|
||||
if ( !fSkipBreakpoint && DebugPlugin.getDefault().getBreakpointManager().isEnabled() ) {
|
||||
map.put( IBreakpoint.ENABLED, new Boolean( cdiBreakpoint.isEnabled() ) );
|
||||
}
|
||||
else {
|
||||
|
@ -631,19 +641,32 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
|||
* @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
|
||||
*/
|
||||
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();
|
||||
for ( int i = 0; i < cBreakpoints.length; ++i ) {
|
||||
try {
|
||||
if ( cBreakpoints[i].isEnabled() ) {
|
||||
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( cBreakpoints[i] );
|
||||
if ( cdiBreakpoint != null ) {
|
||||
cdiBreakpoint.setEnabled( enabled );
|
||||
cdiBreakpoint.setEnabled( !enabled );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( CoreException e ) {
|
||||
DebugPlugin.log( e.getStatus() );
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
DebugPlugin.log( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1325,6 +1325,7 @@ public class CDebugTarget extends CDebugElement
|
|||
// Reset the registers that have errors.
|
||||
getRegisterManager().targetSuspended();
|
||||
setSuspensionThread();
|
||||
getBreakpointManager().skipBreakpoints( false );
|
||||
List newThreads = refreshThreads();
|
||||
if ( event.getSource() instanceof ICDITarget )
|
||||
{
|
||||
|
@ -1856,10 +1857,13 @@ public class CDebugTarget extends CDebugElement
|
|||
/* (non-Javadoc)
|
||||
* @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 ) )
|
||||
return;
|
||||
if ( skipBreakpoints ) {
|
||||
getBreakpointManager().skipBreakpoints( true );
|
||||
}
|
||||
ICDILocation location = getCDISession().getBreakpointManager().createLocation( fileName, null, lineNumber );
|
||||
try
|
||||
{
|
||||
|
@ -1867,6 +1871,9 @@ public class CDebugTarget extends CDebugElement
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
if ( skipBreakpoints ) {
|
||||
getBreakpointManager().skipBreakpoints( false );
|
||||
}
|
||||
targetRequestFailed( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
@ -1883,11 +1890,11 @@ public class CDebugTarget extends CDebugElement
|
|||
/* (non-Javadoc)
|
||||
* @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 ) )
|
||||
return;
|
||||
runToLine( file.getLocation().lastSegment(), lineNumber );
|
||||
runToLine( file.getLocation().lastSegment(), lineNumber, skipBreakpoints );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -2111,10 +2118,13 @@ public class CDebugTarget extends CDebugElement
|
|||
/**
|
||||
* @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 ) )
|
||||
return;
|
||||
if ( skipBreakpoints ) {
|
||||
getBreakpointManager().skipBreakpoints( true );
|
||||
}
|
||||
ICDILocation location = getCDISession().getBreakpointManager().createLocation( address );
|
||||
try
|
||||
{
|
||||
|
@ -2122,6 +2132,9 @@ public class CDebugTarget extends CDebugElement
|
|||
}
|
||||
catch( CDIException e )
|
||||
{
|
||||
if ( skipBreakpoints ) {
|
||||
getBreakpointManager().skipBreakpoints( false );
|
||||
}
|
||||
targetRequestFailed( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
Removed the "Add Address Breakpoint" and "Add Watchpoint" global actions.
|
||||
* plugin.properties
|
||||
|
|
|
@ -23,6 +23,8 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
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.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
|
@ -65,8 +67,9 @@ public class RunToLineAdapter implements IRunToLineTarget {
|
|||
int lineNumber = textSelection.getStartLine() + 1;
|
||||
if ( target instanceof IAdaptable ) {
|
||||
IRunToLine runToLine = (IRunToLine)((IAdaptable)target).getAdapter( IRunToLine.class );
|
||||
if ( runToLine != null && runToLine.canRunToLine( fileName, lineNumber ) )
|
||||
runToLine.runToLine( fileName, lineNumber );
|
||||
if ( runToLine != null && runToLine.canRunToLine( fileName, lineNumber ) ) {
|
||||
runToLine.runToLine( fileName, lineNumber, DebugUIPlugin.getDefault().getPluginPreferences().getBoolean( IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE ) );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -83,8 +86,9 @@ public class RunToLineAdapter implements IRunToLineTarget {
|
|||
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
|
||||
if ( target instanceof IAdaptable ) {
|
||||
IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class );
|
||||
if ( runToAddress != null && runToAddress.canRunToAddress( address ) )
|
||||
runToAddress.runToAddress( address );
|
||||
if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) {
|
||||
runToAddress.runToAddress( address, DebugUIPlugin.getDefault().getPluginPreferences().getBoolean( IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE ) );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue