From 5e2af5b84f7d7427ce2c384e7a75bf313a48bdb3 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Fri, 12 Nov 2004 19:18:47 +0000 Subject: [PATCH] Compare breakpoint source handles as pathes. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 4 ++++ .../eclipse/cdt/debug/core/CDIDebugModel.java | 20 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index a6b28568255..1f663035882 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,7 @@ +2004-11-12 Mikhail Khodjaiants + Compare breakpoint source handles as pathes. + * CDIDebugModel.java + 2004-11-11 Alain Magloire Fix for PR 75000, from PalmSource * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIVariable.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java index 42d34c0c433..dd6cce0e7b7 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java @@ -40,8 +40,10 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; @@ -300,7 +302,7 @@ public class CDIDebugModel { continue; } ICLineBreakpoint breakpoint = (ICLineBreakpoint)breakpoints[i]; - if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) { + if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) { if ( breakpoint.getMarker().getResource().equals( resource ) ) { if ( breakpoint.getLineNumber() == lineNumber ) { return breakpoint; @@ -335,7 +337,7 @@ public class CDIDebugModel { } ICWatchpoint breakpoint = (ICWatchpoint)breakpoints[i]; if ( breakpoint.getMarker().getType().equals( markerType ) ) { - if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) { + if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) { if ( breakpoint.getMarker().getResource().equals( resource ) ) { if ( breakpoint.getExpression().equals( expression ) ) { return breakpoint; @@ -371,7 +373,7 @@ public class CDIDebugModel { } ICFunctionBreakpoint breakpoint = (ICFunctionBreakpoint)breakpoints[i]; if ( breakpoint.getMarker().getType().equals( markerType ) ) { - if ( sourceHandle != null && sourceHandle.equals( breakpoint.getSourceHandle() ) ) { + if ( sameSourceHandle( sourceHandle, breakpoint.getSourceHandle() ) ) { if ( breakpoint.getMarker().getResource().equals( resource ) ) { if ( breakpoint.getFunction() != null && breakpoint.getFunction().equals( function ) ) { return breakpoint; @@ -438,4 +440,16 @@ public class CDIDebugModel { } throw new CoreException( new Status( IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), -1, DebugCoreMessages.getString( "CDIDebugModel.0" ), null ) ); //$NON-NLS-1$ } + + private static boolean sameSourceHandle( String handle1, String handle2 ) { + if ( handle1 == null || handle2 == null ) + return false; + IPath path1 = new Path( handle1 ); + IPath path2 = new Path( handle2 ); + if ( path1.isValidPath( handle1 ) && path2.isValidPath( handle2 ) ) { + return path1.equals( path2 ); + } + // If handles are not file names ???? + return handle1.equals( handle2 ); + } } \ No newline at end of file