1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

The "IStackFrameInfo" interface is removed and it's methods moved to "ICStackFrame".

This commit is contained in:
Mikhail Khodjaiants 2004-05-20 22:23:20 +00:00
parent 95d5594fd0
commit f6719903b6
11 changed files with 366 additions and 513 deletions

View file

@ -1,3 +1,10 @@
2004-05-20 Mikhail Khodjaiants
The "IStackFrameInfo" interface is removed and it's methods moved to "ICStackFrame".
* ICStackFrameInfo: removed
* CStackFrame.java
* CSourceLocator.java
* CSourceManager.java
2004-05-19 Mikhail Khodjaiants
Added the support of watch expressions.
* CDIDebugModel.java

View file

@ -1,63 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.model.IVariable;
/**
*
* Provides the access to the stack frame information.
*
* @since Aug 16, 2002
*/
public interface IStackFrameInfo
{
/**
* Returns the address of this stack frame.
*
* @return the address of this stack frame
*/
long getAddress();
/**
* Returns the source file of this stack frame or <code>null</code>
* if the source file is unknown.
*
* @return the source file of this stack frame
*/
String getFile();
/**
* Returns the function of this stack frame or <code>null</code>
* if the function is unknown.
*
* @return the function of this stack frame
*/
String getFunction();
/**
* Returns the line number of this stack frame or <code>0</code>
* if the line number is unknown.
*
* @return the line number of this stack frame
*/
int getFrameLineNumber();
/**
* Returns the level of this stack frame.
*
* @return the level of this stack frame
*/
int getLevel();
/**
* Returns the arguments of this stack frame.
*
* @return the arguments of this stack frame
*/
IVariable[] getArguments();
}

View file

@ -15,15 +15,13 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
@ -42,6 +40,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.osgi.framework.Bundle;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -103,11 +102,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
*/
public Object getSourceElement( IStackFrame stackFrame )
{
if ( stackFrame != null && stackFrame.getAdapter( IStackFrameInfo.class ) != null )
{
return getInput( (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class ) );
}
return null;
return getInput( stackFrame );
}
/* (non-Javadoc)
@ -115,43 +110,47 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
*/
public int getLineNumber( IStackFrame frame )
{
IStackFrameInfo info = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
return ( info != null ) ? info.getFrameLineNumber() : 0;
return ( frame instanceof ICStackFrame ) ? ((ICStackFrame)frame).getFrameLineNumber() : 0;
}
protected Object getInput( IStackFrameInfo info )
protected Object getInput( IStackFrame f )
{
LinkedList list = new LinkedList();
if ( info != null )
if ( f instanceof ICStackFrame )
{
Object result = null;
String fileName = info.getFile();
if ( fileName != null && fileName.length() > 0 )
ICStackFrame frame = (ICStackFrame)f;
LinkedList list = new LinkedList();
if ( frame != null )
{
ICSourceLocation[] locations = getSourceLocations();
for ( int i = 0; i < locations.length; ++i )
Object result = null;
String fileName = frame.getFile();
if ( fileName != null && fileName.length() > 0 )
{
try
ICSourceLocation[] locations = getSourceLocations();
for ( int i = 0; i < locations.length; ++i )
{
result = locations[i].findSourceElement( fileName );
}
catch( CoreException e )
{
// do nothing
}
if ( result != null )
{
if ( result instanceof List )
list.addAll( (List)result );
else
list.add( result );
if ( !searchForDuplicateFiles() )
break;
try
{
result = locations[i].findSourceElement( fileName );
}
catch( CoreException e )
{
// do nothing
}
if ( result != null )
{
if ( result instanceof List )
list.addAll( (List)result );
else
list.add( result );
if ( !searchForDuplicateFiles() )
break;
}
}
}
}
return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
}
return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
return null;
}
/* (non-Javadoc)
@ -415,7 +414,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
private void addAdditionalLocations( Element root, List sourceLocations ) throws CoreException
{
ClassLoader classLoader = CDebugCorePlugin.getDefault() .getDescriptor().getPluginClassLoader();
Bundle bundle = CDebugCorePlugin.getDefault().getBundle();
MultiStatus status = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(),
CDebugCorePlugin.INTERNAL_ERROR,
@ -442,7 +441,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
Class clazz = null;
try
{
clazz = classLoader.loadClass( className );
clazz = bundle.loadClass( className );
}
catch( ClassNotFoundException e )
{
@ -483,7 +482,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
private void addOldLocations( Element root, List sourceLocations ) throws CoreException
{
ClassLoader classLoader = CDebugCorePlugin.getDefault() .getDescriptor().getPluginClassLoader();
Bundle bundle = CDebugCorePlugin.getDefault().getBundle();
NodeList list = root.getChildNodes();
int length = list.getLength();
@ -506,7 +505,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
Class clazz = null;
try
{
clazz = classLoader.loadClass( className );
clazz = bundle.loadClass( className );
}
catch( ClassNotFoundException e )
{

View file

@ -10,7 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
@ -54,9 +54,8 @@ public class CSourceManager implements ICSourceLocator, IPersistableSourceLocato
if ( getCSourceLocator() != null ) {
return getCSourceLocator().getLineNumber( frame );
}
IStackFrameInfo info = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
if ( info != null ) {
return info.getFrameLineNumber();
if ( frame instanceof ICStackFrame ) {
return ((ICStackFrame)frame).getFrameLineNumber();
}
return 0;
}

View file

@ -1,3 +1,11 @@
2004-05-20 Mikhail Khodjaiants
The "IStackFrameInfo" interface is removed and it's methods moved to "ICStackFrame".
* CDTDebugModelPresentation.java
* FileNotFoundElement.java
* DefaultSourceLocator.java
* SourceLookupBlock.java
* SourceLookupLabelProvider.java
2004-05-19 Mikhail Khodjaiants
Added the support of watch expressions.
* CDTDebugModelPresentation.java

View file

@ -8,7 +8,6 @@ package org.eclipse.cdt.debug.internal.ui;
import java.text.MessageFormat;
import java.util.HashMap;
import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit;
@ -26,12 +25,12 @@ import org.eclipse.cdt.debug.core.model.ICDebugTargetType;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICType;
import org.eclipse.cdt.debug.core.model.ICValue;
import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor;
import org.eclipse.cdt.debug.internal.ui.editors.EditorInputDelegate;
@ -60,7 +59,6 @@ import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.core.model.IWatchExpression;
import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
@ -516,16 +514,16 @@ public class CDTDebugModelPresentation extends LabelProvider
return getFormattedString( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.Thread_threadName_suspended"), thread.getName() ); //$NON-NLS-1$
}
protected String getStackFrameText( IStackFrame stackFrame, boolean qualified ) throws DebugException
protected String getStackFrameText( IStackFrame f, boolean qualified ) throws DebugException
{
IStackFrameInfo info = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
if ( info != null )
if ( f instanceof ICStackFrame )
{
ICStackFrame frame = (ICStackFrame)f;
StringBuffer label = new StringBuffer();
label.append( info.getLevel() );
label.append( frame.getLevel() );
label.append( ' ' );
String function = info.getFunction();
String function = frame.getFunction();
if ( function != null )
{
function = function.trim();
@ -533,16 +531,16 @@ public class CDTDebugModelPresentation extends LabelProvider
{
label.append( function );
label.append( "() " ); //$NON-NLS-1$
if ( info.getFile() != null )
if ( frame.getFile() != null )
{
IPath path = new Path( info.getFile() );
IPath path = new Path( frame.getFile() );
if ( !path.isEmpty() )
{
label.append( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.at")+" " ); //$NON-NLS-1$ //$NON-NLS-2$
label.append( ( qualified ? path.toOSString() : path.lastSegment() ) );
label.append( ":" ); //$NON-NLS-1$
if ( info.getFrameLineNumber() != 0 )
label.append( info.getFrameLineNumber() );
if ( frame.getFrameLineNumber() != 0 )
label.append( frame.getFrameLineNumber() );
}
}
}
@ -551,8 +549,8 @@ public class CDTDebugModelPresentation extends LabelProvider
label.append( CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.Symbol_not_available") ); //$NON-NLS-1$
return label.toString();
}
return ( stackFrame.getAdapter( IDummyStackFrame.class ) != null ) ?
getDummyStackFrameLabel( stackFrame ) : stackFrame.getName();
return ( f.getAdapter( IDummyStackFrame.class ) != null ) ?
getDummyStackFrameLabel( f ) : f.getName();
}
private String getDummyStackFrameLabel( IStackFrame stackFrame )

View file

@ -5,7 +5,7 @@
*/
package org.eclipse.cdt.debug.internal.ui.editors;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunch;
@ -30,13 +30,16 @@ public class FileNotFoundElement
public IPath getFullPath()
{
IStackFrameInfo frameInfo = (IStackFrameInfo)fStackFrame.getAdapter( IStackFrameInfo.class );
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
if ( fStackFrame instanceof ICStackFrame )
{
Path path = new Path( frameInfo.getFile() );
if ( path.isValidPath( frameInfo.getFile() ) )
String fn = ((ICStackFrame)fStackFrame).getFile();
if ( fn != null && fn.trim().length() > 0 )
{
return path;
Path path = new Path( fn );
if ( path.isValidPath( fn ) )
{
return path;
}
}
}
return null;

View file

@ -11,16 +11,14 @@ import java.io.StringReader;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
@ -294,8 +292,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
}
if ( res == null )
{
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
if ( frameInfo != null && frameInfo.getFile() != null && frameInfo.getFile().length() > 0 )
if ( stackFrame instanceof ICStackFrame && !isEmpty( ((ICStackFrame)stackFrame).getFile() ) )
{
res = new FileNotFoundElement( stackFrame );
}
@ -367,11 +364,10 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
private String getFileName( IStackFrame frame )
{
IStackFrameInfo frameInfo = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
if ( frameInfo != null )
if ( frame instanceof ICStackFrame )
{
String name = frameInfo.getFile();
if ( name != null && name.trim().length() > 0 )
String name = ((ICStackFrame)frame).getFile();
if ( !isEmpty( name ) )
return name.trim();
}
return null;
@ -404,7 +400,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
private boolean isEmpty( String string )
{
return string == null || string.length() == 0;
return string == null || string.trim().length() == 0;
}
private IProject getProject( ILaunchConfiguration configuration ) throws CoreException

View file

@ -434,7 +434,7 @@ public class SourceLookupBlock implements Observer
field.setDialogFieldListener(
new IDialogFieldListener()
{
public void dialogFieldChanged( DialogField field )
public void dialogFieldChanged( DialogField f )
{
doCheckStateChanged();
}
@ -448,12 +448,12 @@ public class SourceLookupBlock implements Observer
new SourceListDialogField( CDebugUIPlugin.getResourceString("ui.sourcelookup.SourceLookupBlock.Additional_Source_Locations"), //$NON-NLS-1$
new IListAdapter()
{
public void customButtonPressed( DialogField field, int index )
public void customButtonPressed( DialogField f, int index )
{
doAddedSourceButtonPressed( index );
}
public void selectionChanged(DialogField field)
public void selectionChanged(DialogField f)
{
}
} );

View file

@ -22,10 +22,9 @@ public class SourceLookupLabelProvider extends LabelProvider implements ITableLa
{
if ( element instanceof IProjectSourceLocation )
{
if ( ((IProjectSourceLocation)element).getProject().isOpen() )
return CDebugImages.get( CDebugImages.IMG_OBJS_PROJECT );
else
return CDebugImages.get( CDebugImages.IMG_OBJS_CLOSED_PROJECT );
return ( ((IProjectSourceLocation)element).getProject().isOpen() ) ?
CDebugImages.get( CDebugImages.IMG_OBJS_PROJECT ) :
CDebugImages.get( CDebugImages.IMG_OBJS_CLOSED_PROJECT );
}
if ( element instanceof IDirectorySourceLocation )
{