From fe9c5ad64b4476f5abbd8308d0e215603ac2bc37 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Tue, 29 Jun 2004 17:56:46 +0000 Subject: [PATCH] Partial fix for bug 45535: Performance problems when debugging. Cache the double and float presentations of the floating point types. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 7 +++++++ .../eclipse/cdt/debug/core/CDebugUtils.java | 19 +++---------------- .../internal/core/model/CValueFactory.java | 4 ++++ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 742914cee27..330cacfc847 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,10 @@ +2004-06-28 Mikhail Khodjaiants + Partial fix for bug 45535: Performance problems when debugging. + Cache the double and float presentations of the floating point types. + * CDebugUtils.java + * CFloatingPointValue.java: new + * CValueFactory.java + 2004-06-24 Mikhail Khodjaiants Temporary fix for bug 56520: Debug Perspective doesn't get called when a breakpoint is hit. * CThread.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java index 1aa7e227371..dba4fcfc88d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDebugUtils.java @@ -16,23 +16,18 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; - import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; - import org.eclipse.cdt.core.model.IFunction; import org.eclipse.cdt.core.model.IMethod; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIDoubleValue; -import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatValue; import org.eclipse.cdt.debug.core.model.ICValue; -import org.eclipse.cdt.debug.internal.core.model.CValue; +import org.eclipse.cdt.debug.internal.core.model.CFloatingPointValue; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -354,19 +349,11 @@ public class CDebugUtils public static Number getFloatingPointValue( ICValue value ) { - if ( value instanceof CValue ) + if ( value instanceof CFloatingPointValue ) { try { - ICDIValue cdiValue = ((CValue)value).getUnderlyingValue(); - if ( cdiValue instanceof ICDIDoubleValue ) - { - return new Double( ((ICDIDoubleValue)cdiValue).doubleValue() ); - } - if ( cdiValue instanceof ICDIFloatValue ) - { - return new Float( ((ICDIFloatValue)cdiValue).floatValue() ); - } + return ((CFloatingPointValue)value).getFloatingPointValue(); } catch( CDIException e ) { diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValueFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValueFactory.java index 1d4c2c9aab0..5710779c4eb 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValueFactory.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValueFactory.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.internal.core.model; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; +import org.eclipse.cdt.debug.core.cdi.model.type.ICDIFloatingPointValue; import org.eclipse.debug.core.DebugException; /** @@ -25,6 +26,9 @@ public class CValueFactory { static public CValue createValue( CVariable parent, ICDIValue cdiValue ) throws DebugException { + if ( cdiValue instanceof ICDIFloatingPointValue ) { + return new CFloatingPointValue( parent, cdiValue ); + } return new CValue( parent, cdiValue ); }