From 47aa5eed6416aa1e28790aeb909a1f8d6a1292d1 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 24 Oct 2005 17:31:54 +0000 Subject: [PATCH] Fix for bugs 112008 and 111828. Applied modified patch from Matthias Spycher (matthias@coware.com). --- debug/org.eclipse.cdt.debug.core/ChangeLog | 10 ++++++ .../internal/core/CBreakpointManager.java | 31 ++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 372934b1938..49eb42fb739 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,13 @@ +2005-10-24 Mikhail Khodjaiants + Fix for bugs 112008 and 111828. + Applied modified patch from Matthias Spycher (matthias@coware.com). + * CBreakpointManager.java + +2005-09-30 Mikhail Khodjaiants + Partial fix for bug 109950: Major crash and stack overflow if two projects reference each other. + * CDebugTarget.java + * CSourceLookupDirector.java + 2005-09-16 Mikhail Khodjaiants Bug 109785: "mi_cmd_var_create: unable to create variable object" when stepping out of stack frame. * CStackFrame.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java index 57a252cb808..f2034d79130 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java @@ -7,9 +7,12 @@ * * Contributors: * QNX Software Systems - Initial API and implementation + * Matthias Spycher (matthias@coware.com) - patch for bug #112008 ***********************************************************************/ package org.eclipse.cdt.debug.internal.core; +import java.io.File; +import java.io.IOException; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; @@ -70,6 +73,7 @@ import org.eclipse.debug.core.IBreakpointsListener; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.ISourceLocator; +import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage; public class CBreakpointManager implements IBreakpointsListener, IBreakpointManagerListener, ICDIEventListener, IAdaptable { @@ -189,8 +193,21 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana String sourceHandle = file; if ( !isEmpty( file ) ) { Object sourceElement = getSourceElement( file ); - sourceHandle = ( sourceElement instanceof IFile ) ? ((IFile)sourceElement).getLocation().toOSString() : ((IStorage)sourceElement).getFullPath().toOSString(); - return sourceHandle.equals( ((ICLineBreakpoint)breakpoint).getSourceHandle() ) && location.getLineNumber() == ((ICLineBreakpoint)breakpoint).getLineNumber(); + if ( sourceElement instanceof IFile ) { + sourceHandle = ((IFile)sourceElement).getLocation().toOSString(); + } + else if ( sourceElement instanceof IStorage ) { + sourceHandle = ((IStorage)sourceElement).getFullPath().toOSString(); + } + String bpSourceHandle = ((ICLineBreakpoint)breakpoint).getSourceHandle(); + if ( sourceElement instanceof LocalFileStorage ) { // see bug #112008 + try { + bpSourceHandle = new File( bpSourceHandle ).getCanonicalPath(); + } + catch( IOException e ) { + } + } + return sourceHandle.equals( bpSourceHandle ) && location.getLineNumber() == ((ICLineBreakpoint)breakpoint).getLineNumber(); } } if ( breakpoint instanceof ICWatchpoint && cdiBreakpoint instanceof ICDIWatchpoint ) { @@ -658,9 +675,13 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana Object sourceElement = getSourceElement( file ); String sourceHandle = file; IResource resource = getProject(); - if ( sourceElement instanceof IFile || sourceElement instanceof IStorage ) { - sourceHandle = ( sourceElement instanceof IFile ) ? ((IFile)sourceElement).getLocation().toOSString() : ((IStorage)sourceElement).getFullPath().toOSString(); - resource = ( sourceElement instanceof IFile ) ? (IResource)sourceElement : ResourcesPlugin.getWorkspace().getRoot(); + if ( sourceElement instanceof IFile ) { + sourceHandle = ((IFile)sourceElement).getLocation().toOSString(); + resource = (IResource)sourceElement; + } + else if ( sourceElement instanceof IStorage ) { + sourceHandle = ((IStorage)sourceElement).getFullPath().toOSString(); + resource = ResourcesPlugin.getWorkspace().getRoot(); } breakpoint = createLineBreakpoint( sourceHandle, resource, cdiBreakpoint ); // else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {