From fa3f6e5e4c48c84923c6eb50d2246bb29fd72bef Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Fri, 14 Mar 2003 19:10:17 +0000 Subject: [PATCH] Cross-referencing projects cause the debugger to go into a stack overflow exception. Make sure that there is only one source location for each referenced project. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 5 +++++ .../core/sourcelookup/CSourceLocator.java | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 5306df27d39..6c1ee6b84d5 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,8 @@ +2003-03-14 Mikhail Khodjaiants + Cross-referencing projects cause the debugger to go into a stack overflow exception. + Make sure that there is only one source location for each referenced project. + * CSourceLocator.java + 2003-03-13 Alain Magloire No longer throw exceptions. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java index 7f81f6bb8da..555ce838c38 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.io.StringReader; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import javax.xml.parsers.DocumentBuilder; @@ -214,7 +215,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato IProject[] projects = project.getReferencedProjects(); for ( int i = 0; i < projects.length; i++ ) { - if ( projects[i].exists() ) + if ( projects[i].exists() && !containsProject( list, projects[i] ) ) { list.add( new CProjectSourceLocation( projects[i] ) ); addReferencedSourceLocations( list, projects[i] ); @@ -228,6 +229,18 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato } } + private static boolean containsProject( List list, IProject project ) + { + Iterator it = list.iterator(); + while( it.hasNext() ) + { + CProjectSourceLocation location = (CProjectSourceLocation)it.next(); + if ( project.equals( location.getProject() ) ) + return true; + } + return false; + } + private Object findFileByAbsolutePath( String fileName ) { Path path = new Path( fileName );