diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 5f80323d7d3..37774cf0c56 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -5,6 +5,11 @@ Added methods, signal(), jump() stepReturn(boolean) to mimic gdb "return/finish". +2003-02-03 Mikhail Khodjaiants + Filter out breakpoints set in unrelated projects. + * CDebugTarget.java + * CDebugUtils.java + 2003-02-03 Mikhail Khodjaiants Implemention of the 'handle' command of the 'Signals' view. * ICDISignal.java: added the 'handle' method diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugUtils.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugUtils.java index ed9998a7274..b2c69ed7496 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugUtils.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugUtils.java @@ -7,6 +7,7 @@ package org.eclipse.cdt.debug.internal.core; import java.util.Arrays; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugPlugin; @@ -222,5 +223,25 @@ public class CDebugUtils sb.append( text ); } return sb.toString(); - } + } + + public static boolean isReferencedProject( IProject parent, IProject project ) + { + if ( parent != null && parent.exists() ) + { + try + { + IProject[] projects = parent.getReferencedProjects(); + for ( int i = 0; i < projects.length; ++i ) + { + if ( projects[i].exists() && ( projects[i].equals( project ) || isReferencedProject( projects[i], project ) ) ) + return true; + } + } + catch( CoreException e ) + { + } + } + return false; + } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index f4d5803f044..e8165f557b5 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -82,6 +82,7 @@ import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager; import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarkerDelta; +import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -340,7 +341,7 @@ public class CDebugTarget extends CDebugElement IBreakpoint[] bps = (IBreakpoint[])manager.getBreakpoints( CDebugModel.getPluginIdentifier() ); for ( int i = 0; i < bps.length; i++ ) { - if ( bps[i] instanceof ICBreakpoint && findCDIBreakpoint( bps[i] ) == null ) + if ( bps[i] instanceof ICBreakpoint && isTargetBreakpoint( bps[i] ) && findCDIBreakpoint( bps[i] ) == null ) { breakpointAdded( (ICBreakpoint)bps[i] ); } @@ -349,6 +350,29 @@ public class CDebugTarget extends CDebugElement } } + private boolean isTargetBreakpoint( IBreakpoint bp ) + { + IProject project = bp.getMarker().getResource().getProject(); + if ( project != null && project.exists() ) + { + if ( getSourceLocator() instanceof IAdaptable ) + { + ICSourceLocator sl = (ICSourceLocator)((IAdaptable)getSourceLocator()).getAdapter( ICSourceLocator.class ); + if ( sl != null ) + { + return sl.contains( project ); + } + } + else + { + if ( project.equals( getExecFile().getProject() ) ) + return true; + return CDebugUtils.isReferencedProject( getExecFile().getProject(), project ); + } + } + return false; + } + protected void initializeRegisters() { fRegisterGroups = new ArrayList( 20 );