mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-30 11:43:33 +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:
parent
89e16972e3
commit
1662c1895f
4 changed files with 58 additions and 16 deletions
|
@ -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
|
2004-06-24 Mikhail Khodjaiants
|
||||||
Temporary fix for bug 56520: Debug Perspective doesn't get called when a breakpoint is hit.
|
Temporary fix for bug 56520: Debug Perspective doesn't get called when a breakpoint is hit.
|
||||||
* CThread.java
|
* CThread.java
|
||||||
|
|
|
@ -16,23 +16,18 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.transform.OutputKeys;
|
import javax.xml.transform.OutputKeys;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.IFunction;
|
import org.eclipse.cdt.core.model.IFunction;
|
||||||
import org.eclipse.cdt.core.model.IMethod;
|
import org.eclipse.cdt.core.model.IMethod;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
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.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.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -354,19 +349,11 @@ public class CDebugUtils
|
||||||
|
|
||||||
public static Number getFloatingPointValue( ICValue value )
|
public static Number getFloatingPointValue( ICValue value )
|
||||||
{
|
{
|
||||||
if ( value instanceof CValue )
|
if ( value instanceof CFloatingPointValue )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ICDIValue cdiValue = ((CValue)value).getUnderlyingValue();
|
return ((CFloatingPointValue)value).getFloatingPointValue();
|
||||||
if ( cdiValue instanceof ICDIDoubleValue )
|
|
||||||
{
|
|
||||||
return new Double( ((ICDIDoubleValue)cdiValue).doubleValue() );
|
|
||||||
}
|
|
||||||
if ( cdiValue instanceof ICDIFloatValue )
|
|
||||||
{
|
|
||||||
return new Float( ((ICDIFloatValue)cdiValue).floatValue() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch( CDIException e )
|
catch( CDIException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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.ICDIValue;
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
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;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,6 +26,9 @@ public class CValueFactory
|
||||||
{
|
{
|
||||||
static public CValue createValue( CVariable parent, ICDIValue cdiValue ) throws DebugException
|
static public CValue createValue( CVariable parent, ICDIValue cdiValue ) throws DebugException
|
||||||
{
|
{
|
||||||
|
if ( cdiValue instanceof ICDIFloatingPointValue ) {
|
||||||
|
return new CFloatingPointValue( parent, cdiValue );
|
||||||
|
}
|
||||||
return new CValue( parent, cdiValue );
|
return new CValue( parent, cdiValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue