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

Fixes for breakpoint filtering.

This commit is contained in:
Mikhail Khodjaiants 2004-09-10 17:50:29 +00:00
parent c656bd7009
commit bdcd736bb3
7 changed files with 42 additions and 23 deletions

View file

@ -1,3 +1,9 @@
2004-09-10 Mikhail Khodjaiants
Fixes for breakpoint filtering.
* CBreakpointManager.java
* CBreakpoint.java
* CDebugTarget.java
2004-09-09 Alain Magloire 2004-09-09 Alain Magloire
Introduction of new classes in the CDI interface Introduction of new classes in the CDI interface
* ICDIExecuteStep.java * ICDIExecuteStep.java

View file

@ -291,7 +291,6 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
} }
if ( cdiBreakpoint == null ) if ( cdiBreakpoint == null )
return; return;
breakpoint.setTargetFilter( getDebugTarget() );
boolean enabled = breakpoint.isEnabled(); boolean enabled = breakpoint.isEnabled();
setBreakpointCondition( breakpoint ); setBreakpointCondition( breakpoint );
if ( !enabled ) if ( !enabled )
@ -318,14 +317,10 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
ICDITarget cdiTarget = getCDITarget(); ICDITarget cdiTarget = getCDITarget();
try { try {
cdiTarget.deleteBreakpoints( new ICDIBreakpoint[]{ cdiBreakpoint } ); cdiTarget.deleteBreakpoints( new ICDIBreakpoint[]{ cdiBreakpoint } );
breakpoint.removeTargetFilter( getDebugTarget() );
} }
catch( CDIException e ) { catch( CDIException e ) {
targetRequestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.3" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$ targetRequestFailed( MessageFormat.format( InternalDebugCoreMessages.getString( "CBreakpointManager.3" ), new String[] { e.getMessage() } ), e ); //$NON-NLS-1$
} }
catch( CoreException e ) {
DebugPlugin.log( e );
}
} }
} }
@ -384,6 +379,11 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
breakpoint = createLocationBreakpoint( cdiBreakpoint ); breakpoint = createLocationBreakpoint( cdiBreakpoint );
} }
if ( breakpoint != null ) { if ( breakpoint != null ) {
try {
breakpoint.setTargetFilter( getDebugTarget() );
}
catch( CoreException e ) {
}
getBreakpointNotifier().breakpointInstalled( getDebugTarget(), breakpoint ); getBreakpointNotifier().breakpointInstalled( getDebugTarget(), breakpoint );
} }
} }
@ -409,6 +409,11 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
getBreakpointMap().removeCDIBreakpoint( cdiBreakpoint ); getBreakpointMap().removeCDIBreakpoint( cdiBreakpoint );
if ( breakpoint != null ) { if ( breakpoint != null ) {
if ( isFilteredByTarget( breakpoint, getDebugTarget() ) ) { if ( isFilteredByTarget( breakpoint, getDebugTarget() ) ) {
try {
breakpoint.removeTargetFilter( getDebugTarget() );
}
catch( CoreException e ) {
}
getBreakpointNotifier().breakpointRemoved( getDebugTarget(), breakpoint ); getBreakpointNotifier().breakpointRemoved( getDebugTarget(), breakpoint );
} }
else { else {
@ -695,7 +700,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
boolean result = false; boolean result = false;
try { try {
ICDebugTarget[] tfs = breakpoint.getTargetFilters(); ICDebugTarget[] tfs = breakpoint.getTargetFilters();
result = Arrays.asList( tfs ).contains( this ); result = Arrays.asList( tfs ).contains( target );
} }
catch( CoreException e1 ) { catch( CoreException e1 ) {
} }

View file

@ -304,7 +304,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
public void removeTargetFilter( ICDebugTarget target ) throws CoreException { public void removeTargetFilter( ICDebugTarget target ) throws CoreException {
if ( fFilteredThreadsByTarget.containsKey( target ) ) { if ( fFilteredThreadsByTarget.containsKey( target ) ) {
fFilteredThreadsByTarget.remove( target ); fFilteredThreadsByTarget.remove( target );
fireChanged();
} }
} }
@ -331,7 +330,6 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
*/ */
public void setTargetFilter( ICDebugTarget target ) throws CoreException { public void setTargetFilter( ICDebugTarget target ) throws CoreException {
fFilteredThreadsByTarget.put( target, null ); fFilteredThreadsByTarget.put( target, null );
fireChanged();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -348,7 +346,7 @@ public abstract class CBreakpoint extends Breakpoint implements ICBreakpoint, ID
* does not exist, do not fire a change notificaiton (the marker may not * does not exist, do not fire a change notificaiton (the marker may not
* exist if the associated project was closed). * exist if the associated project was closed).
*/ */
protected void fireChanged() { public void fireChanged() {
if ( markerExists() ) { if ( markerExists() ) {
DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( this ); DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( this );
} }

View file

@ -654,7 +654,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
ICDebugTarget[] tfs = b.getTargetFilters(); ICDebugTarget[] tfs = b.getTargetFilters();
install = Arrays.asList( tfs ).contains( this ); install = Arrays.asList( tfs ).contains( this );
} }
catch( CoreException e1 ) { catch( CoreException e ) {
} }
boolean registered = getBreakpointManager().isCDIRegistered( b ); boolean registered = getBreakpointManager().isCDIRegistered( b );
if ( registered && !install ) { if ( registered && !install ) {

View file

@ -1,3 +1,8 @@
2004-09-10 Mikhail Khodjaiants
Fixes for breakpoint filtering.
* CBreakpointUpdater.java
* ThreadFilterEditor.java
2004-09-01 Mikhail Khodjaiants 2004-09-01 Mikhail Khodjaiants
Fix for bug 73197: DisassemblyEditorInput.getAddress can crash. Fix for bug 73197: DisassemblyEditorInput.getAddress can crash.
* DisassemblyEditorInput.java * DisassemblyEditorInput.java

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.internal.ui;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.ICBreakpointListener; import org.eclipse.cdt.debug.core.ICBreakpointListener;
import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
@ -51,13 +52,15 @@ public class CBreakpointUpdater implements ICBreakpointListener {
* @see org.eclipse.cdt.debug.core.ICBreakpointListener#breakpointInstalled(org.eclipse.debug.core.model.IDebugTarget, * @see org.eclipse.cdt.debug.core.ICBreakpointListener#breakpointInstalled(org.eclipse.debug.core.model.IDebugTarget,
* org.eclipse.debug.core.model.IBreakpoint) * org.eclipse.debug.core.model.IBreakpoint)
*/ */
public void breakpointInstalled( IDebugTarget target, final IBreakpoint breakpoint ) { public void breakpointInstalled( final IDebugTarget target, IBreakpoint breakpoint ) {
if ( breakpoint instanceof ICBreakpoint && target instanceof ICDebugTarget ) {
final ICBreakpoint b = (ICBreakpoint)breakpoint;
asyncExec( new Runnable() { asyncExec( new Runnable() {
public void run() { public void run() {
try { try {
if ( ((ICBreakpoint)breakpoint).incrementInstallCount() == 1 ) if ( b.incrementInstallCount() == 1 )
DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( breakpoint ); DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( b );
} }
catch( CoreException e ) { catch( CoreException e ) {
CDebugUIPlugin.log( e.getStatus() ); CDebugUIPlugin.log( e.getStatus() );
@ -65,6 +68,7 @@ public class CBreakpointUpdater implements ICBreakpointListener {
} }
} ); } );
} }
}
/* /*
* (non-Javadoc) * (non-Javadoc)

View file

@ -320,6 +320,7 @@ public class ThreadFilterEditor {
else { else {
breakpoint.removeTargetFilter( (ICDebugTarget)targets[i] ); breakpoint.removeTargetFilter( (ICDebugTarget)targets[i] );
} }
DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged( breakpoint );
} }
catch( CoreException e ) { catch( CoreException e ) {
DebugUIPlugin.log( e ); DebugUIPlugin.log( e );