1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 12:25:35 +02:00

[247851] - applied patch - line breakpoints on linked resources

This commit is contained in:
Alena Laskavaia 2008-11-12 17:39:19 +00:00
parent ba7746ffcb
commit c391a02225
2 changed files with 19 additions and 22 deletions

View file

@ -1220,7 +1220,18 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
private boolean isTargetBreakpoint( ICBreakpoint breakpoint ) {
if ( breakpoint instanceof ICAddressBreakpoint )
return supportsAddressBreakpoint( (ICAddressBreakpoint)breakpoint );
// If the breakpoint is set on a resource in this project
// it should be enabled irrespective of what the CSourceLookupDirector thinks
if (breakpoint.getMarker() != null) {
IProject project = breakpoint.getMarker().getResource().getProject();
if (getProject().equals(project))
return true;
if (CDebugUtils.isReferencedProject(getProject(), project))
return true;
}
// Is it a line breakpoint with source handle ?
if ( breakpointUsesSourceMatching( breakpoint ) ) {
try {
String handle = breakpoint.getSourceHandle();
@ -1232,10 +1243,10 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
}
}
catch( CoreException e ) {
return false;
CDebugCorePlugin.log(e);
}
}
else {
} else {
// Check the marker resource against the source containers ...
IResource resource = breakpoint.getMarker().getResource();
IProject project = resource.getProject();
if ( project != null && project.exists() ) {
@ -1244,12 +1255,9 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
return ((ICSourceLocator)sl).contains( project );
else if ( sl instanceof CSourceLookupDirector )
return ((CSourceLookupDirector)sl).contains( project );
if ( project.equals( getProject() ) )
return true;
return CDebugUtils.isReferencedProject( getProject(), project );
}
}
return true;
return false;
}
public boolean supportsBreakpoint( ICBreakpoint breakpoint ) {

View file

@ -14,14 +14,13 @@ package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.sourcelookup.AbsolutePathSourceContainer;
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@ -39,10 +38,10 @@ import org.eclipse.debug.core.sourcelookup.containers.WorkspaceSourceContainer;
*/
public class CSourceLookupDirector extends AbstractSourceLookupDirector {
private static Set fSupportedTypes;
private static Set<String> fSupportedTypes;
static {
fSupportedTypes = new HashSet();
fSupportedTypes = new HashSet<String>();
fSupportedTypes.add( WorkspaceSourceContainer.TYPE_ID );
fSupportedTypes.add( ProjectSourceContainer.TYPE_ID );
fSupportedTypes.add( FolderSourceContainer.TYPE_ID );
@ -77,16 +76,6 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
public boolean contains( ICBreakpoint breakpoint ) {
try {
String handle = breakpoint.getSourceHandle();
// Check if the breakpoint's resource is a link - we have to handle
// this case differently.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=125603
IMarker marker = breakpoint.getMarker();
if ( marker != null ) {
IResource resource = marker.getResource();
if ( resource.isLinked() && resource.getLocation().toOSString().equals( handle ) ) {
return contains( resource.getProject() );
}
}
ISourceContainer[] containers = getSourceContainers();
for ( int i = 0; i < containers.length; ++i ) {
if ( contains( containers[i], handle ) )