1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Filter out breakpoints set in unrelated projects.

This commit is contained in:
Mikhail Khodjaiants 2003-02-04 21:29:47 +00:00
parent 75b46d3f47
commit 54f777824b
3 changed files with 52 additions and 2 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -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 );