merge changeset 5fdb1cfe8afb (fix for slow startup for projects with lots of breakpoints)
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java Fri Aug 07 07:23:15 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLookupParticipant.java Fri Aug 07 08:05:16 2009 -0500
@@ -15,6 +15,9 @@
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
@@ -48,6 +51,8 @@
private static final NoSourceElement gfNoSource = new NoSourceElement();
private ListenerList fListeners;
+
+ private Map<Object, Object[]> fCachedResults = Collections.synchronizedMap(new HashMap<Object, Object[]>());
/**
* Constructor for CSourceLookupParticipant.
@@ -78,6 +83,11 @@
* @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant#findSourceElements(java.lang.Object)
*/
@Override
+ // Check the cache
+ Object[] results = fCachedResults.get(object);
+ if (results != null)
+ return results;
+
public Object[] findSourceElements( Object object ) throws CoreException {
// Workaround for BUG247977
@@ -94,9 +104,11 @@
if ( name == null || name.length() == 0 )
{
if (object instanceof IDebugElement)
- return new Object[] { new CSourceNotFoundElement( (IDebugElement) object ) };
+ results = new Object[] { new CSourceNotFoundElement( (IDebugElement) object ) };
else
- return new Object[] { gfNoSource };
+ results = new Object[] { gfNoSource };
+ fCachedResults.put(object, results);
+ return results;
}
}
// See if findSourceElements(...) is the result of a Breakpoint Hit Event
@@ -112,6 +124,7 @@
name = (String)object;
}
+ fCachedResults.put(object, foundElements);
// Actually query the source containers for the requested resource
Object[] foundElements = super.findSourceElements(object);
--- a/foo.txt Fri Aug 07 07:23:15 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-# HG changeset patch
-# User ryall
-# Date 1249412413 18000
-# Node ID fcb77f9783d2c410f5e70d8859fd004c67d10b0c
-# Parent e82f98a34bed4d769138c63f4c80d8b603593126
-Fix NPEs.
-
-diff -r e82f98a34bed -r fcb77f9783d2 cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java
---- a/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java Tue Aug 04 13:42:53 2009 -0500
-+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java Tue Aug 04 14:00:13 2009 -0500
-@@ -493,13 +493,16 @@
- }
-
- protected void updateProgramFromConfig(ILaunchConfiguration config) {
-- String programName = EMPTY_STRING;
-- try {
-- programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
-- } catch (CoreException ce) {
-- LaunchUIPlugin.log(ce);
-+ if (fProgText != null)
-+ {
-+ String programName = EMPTY_STRING;
-+ try {
-+ programName = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EMPTY_STRING);
-+ } catch (CoreException ce) {
-+ LaunchUIPlugin.log(ce);
-+ }
-+ fProgText.setText(programName);
- }
-- fProgText.setText(programName);
- }
-
- /** @since 6.0 */
-@@ -546,8 +549,12 @@
- config.setMappedResources(null);
- }
- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
-- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())));
-- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
-+ if (fBuildConfigCombo != null) {
-+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID, (String)fBuildConfigCombo.getData(Integer.toString(fBuildConfigCombo.getSelectionIndex())));
-+ }
-+ if (fProgText != null) {
-+ config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fProgText.getText());
-+ }
- if (fCoreText != null) {
- config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, fCoreText.getText());
- }