1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 19:35:36 +02:00

Partial fix for bug 45535: Performance problems when debugging.

Cache the double and float presentations of the floating point types.
This commit is contained in:
Mikhail Khodjaiants 2004-06-28 18:30:50 +00:00
parent 89e16972e3
commit 1662c1895f
4 changed files with 58 additions and 16 deletions

View file

@ -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

View file

@ -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 )
{

View file

@ -0,0 +1,44 @@
/**********************************************************************
* Copyright (c) 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.model;
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;
/**
* Represents a value of a float or double variable type.
*/
public class CFloatingPointValue extends CValue {
private Number fFloatingPointValue;
/**
* Constructor for CFloatingPointValue.
*/
public CFloatingPointValue( CVariable parent, ICDIValue cdiValue ) {
super( parent, cdiValue );
}
public Number getFloatingPointValue() throws CDIException {
if ( fFloatingPointValue == null ) {
ICDIValue cdiValue = getUnderlyingValue();
if ( cdiValue instanceof ICDIDoubleValue ) {
fFloatingPointValue = new Double( ((ICDIDoubleValue)cdiValue).doubleValue() );
}
else if ( cdiValue instanceof ICDIFloatValue ) {
fFloatingPointValue = new Float( ((ICDIFloatValue)cdiValue).floatValue() );
}
}
return fFloatingPointValue;
}
}

View file

@ -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 );
}