mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Filter breakpoints before setting using the source lookup mechanism.
This commit is contained in:
parent
597791a3c7
commit
44f7f93af9
3 changed files with 68 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2005-07-08 Mikhail Khodjaiants
|
||||||
|
Filter breakpoints before setting using the source lookup mechanism.
|
||||||
|
* CBreakpointManager.java
|
||||||
|
* CSourceLookupDirector.java
|
||||||
|
|
||||||
2005-07-08 Mikhail Khodjaiants
|
2005-07-08 Mikhail Khodjaiants
|
||||||
Bug 79371: Setting breakpoints in the left hand side ruler of the disassembly view is sluggish.
|
Bug 79371: Setting breakpoints in the left hand side ruler of the disassembly view is sluggish.
|
||||||
Asynchronous breakpoint handling.
|
Asynchronous breakpoint handling.
|
||||||
|
|
|
@ -882,7 +882,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
||||||
if ( sl instanceof ICSourceLocator )
|
if ( sl instanceof ICSourceLocator )
|
||||||
return ( ((ICSourceLocator)sl).findSourceElement( handle ) != null );
|
return ( ((ICSourceLocator)sl).findSourceElement( handle ) != null );
|
||||||
else if ( sl instanceof CSourceLookupDirector ) {
|
else if ( sl instanceof CSourceLookupDirector ) {
|
||||||
return true;//( ((CSourceLookupDirector)sl).getCompilationPath( handle ) != null || ((CSourceLookupDirector)sl).findSourceElements( handle ).length > 0 );
|
return ( ((CSourceLookupDirector)sl).contains( breakpoint ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( CoreException e ) {
|
catch( CoreException e ) {
|
||||||
|
|
|
@ -10,13 +10,18 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.CDirectorySourceContainer;
|
import org.eclipse.cdt.debug.core.sourcelookup.CDirectorySourceContainer;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
|
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.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
|
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
|
||||||
|
@ -54,6 +59,20 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
|
||||||
return fSupportedTypes.contains( type.getId() );
|
return fSupportedTypes.contains( type.getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean contains( ICBreakpoint breakpoint ) {
|
||||||
|
try {
|
||||||
|
String handle = breakpoint.getSourceHandle();
|
||||||
|
ISourceContainer[] containers = getSourceContainers();
|
||||||
|
for ( int i = 0; i < containers.length; ++i ) {
|
||||||
|
if ( contains( containers[i], handle ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( CoreException e ) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean contains( IProject project ) {
|
public boolean contains( IProject project ) {
|
||||||
ISourceContainer[] containers = getSourceContainers();
|
ISourceContainer[] containers = getSourceContainers();
|
||||||
for ( int i = 0; i < containers.length; ++i ) {
|
for ( int i = 0; i < containers.length; ++i ) {
|
||||||
|
@ -80,6 +99,49 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean contains( ISourceContainer container, String sourceName ) {
|
||||||
|
IPath path = new Path( sourceName );
|
||||||
|
if ( !path.isValidPath( sourceName ) )
|
||||||
|
return false;
|
||||||
|
if ( container instanceof ProjectSourceContainer ) {
|
||||||
|
IProject project = ((ProjectSourceContainer)container).getProject();
|
||||||
|
IPath projPath = project.getLocation();
|
||||||
|
if ( projPath.isPrefixOf( path ) ) {
|
||||||
|
IFile file = ((ProjectSourceContainer)container).getProject().getFile( path.removeFirstSegments( projPath.segmentCount() ) );
|
||||||
|
return ( file != null && file.exists() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( container instanceof FolderSourceContainer ) {
|
||||||
|
IContainer folder = ((FolderSourceContainer)container).getContainer();
|
||||||
|
IPath folderPath = folder.getLocation();
|
||||||
|
if ( folderPath.isPrefixOf( path ) ) {
|
||||||
|
IFile file = ((FolderSourceContainer)container).getContainer().getFile( path.removeFirstSegments( folderPath.segmentCount() ) );
|
||||||
|
return ( file != null && file.exists() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( container instanceof CDirectorySourceContainer ) {
|
||||||
|
File dir = ((CDirectorySourceContainer)container).getDirectory();
|
||||||
|
boolean searchSubfolders = ((CDirectorySourceContainer)container).searchSubfolders();
|
||||||
|
IPath dirPath = new Path( dir.getAbsolutePath() );
|
||||||
|
if ( searchSubfolders || dirPath.segmentCount() + 1 == path.segmentCount() )
|
||||||
|
return dirPath.isPrefixOf( path );
|
||||||
|
}
|
||||||
|
if ( container instanceof MappingSourceContainer ) {
|
||||||
|
return ( ((MappingSourceContainer)container).getCompilationPath( sourceName ) != null );
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ISourceContainer[] containers;
|
||||||
|
containers = container.getSourceContainers();
|
||||||
|
for ( int i = 0; i < containers.length; ++i ) {
|
||||||
|
if ( contains( containers[i], sourceName ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( CoreException e ) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public IPath getCompilationPath( String sourceName ) {
|
public IPath getCompilationPath( String sourceName ) {
|
||||||
IPath path = null;
|
IPath path = null;
|
||||||
ISourceContainer[] containers = getSourceContainers();
|
ISourceContainer[] containers = getSourceContainers();
|
||||||
|
|
Loading…
Add table
Reference in a new issue