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

Removed old disassembly implementation.

This commit is contained in:
Mikhail Khodjaiants 2004-05-13 19:56:32 +00:00
parent b1157be81c
commit 8d4cf7f7d9
24 changed files with 77 additions and 1742 deletions

View file

@ -1,3 +1,14 @@
2004-05-13 Mikhail Khodjaiants
Removed old disassembly implementation.
* IDisassemblyStorage.java: deleted
* ISourceMode.java: deleted
* DisassemblyStorage.java: deleted
* DisassemblyManager.java: deleted
* ICDebugConstants.java
* CDebugTarget.java
* CThread.java
* CSourceManager.java
2004-05-13 Mikhail Khodjaiants
Support for the instruction stepping mode.
* ICDebugTarget.java

View file

@ -18,14 +18,6 @@ public interface ICDebugConstants
*/
public static final String PLUGIN_ID = CDebugCorePlugin.getDefault().getDescriptor().getUniqueIdentifier();
/**
* Boolean preference controlling whether the debugger automatically
* switchs to disassembly mode when can not find the source file .
* When <code>true</code> the debugger will automatically switch to
* disassembly mode.
*/
public static final String PREF_AUTO_DISASSEMBLY = PLUGIN_ID + "cDebug.auto_disassembly"; //$NON-NLS-1$
/**
* The identifier of the default variable format to use in the variables view
*/

View file

@ -1,51 +0,0 @@
/**********************************************************************
* 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.core.sourcelookup;
import org.eclipse.core.resources.IStorage;
import org.eclipse.debug.core.model.IDebugTarget;
/**
* Defines methods specific to disassembly.
*/
public interface IDisassemblyStorage extends IStorage {
/**
* Returns the debug target of this disassembly.
*
* @return the debug target of this disassembly
*/
IDebugTarget getDebugTarget();
/**
* Returns whether this storage contains the instructions at given address.
*
* @param address - an address
* @return whether this storage contains the instructions at given address
*/
boolean containsAddress( long address );
/**
* Returns the line number for given address.
*
* @param address - an address
* @return the line number for given address
*/
int getLineNumber( long address );
/**
* Returns the address of instruction at given line.
*
* @param lineNumber - a line number
* @return the address of instruction at given line
*/
long getAddress( int lineNumber );
}

View file

@ -1,33 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core.sourcelookup;
/**
* Defines constatnts and methods to set the source presentation mode.
*
* @since: Oct 8, 2002
*/
public interface ISourceMode
{
static final public int MODE_SOURCE = 0;
static final public int MODE_DISASSEMBLY = 1;
static final public int MODE_MIXED = 2;
/**
* Returns the current source presentation mode.
*
* @return the current source presentation mode
*/
int getMode();
/**
* Sets the source presentation mode.
*
* @param the source presentation mode to set
*/
void setMode( int mode );
}

View file

@ -1,251 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.core;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Arrays;
import org.eclipse.cdt.debug.core.*;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.core.model.IExecFileInfo;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
* Enter type comment.
*
* @since: Oct 8, 2002
*/
public class DisassemblyStorage implements IDisassemblyStorage
{
protected ICDIInstruction[] fInstructions;
protected IDebugTarget fDebugTarget;
protected ByteArrayInputStream fInputStream = null;
protected long fStartAddress = 0;
protected long fEndAddress = 0;
/**
* Constructor for DisassemblyStorage.
*/
public DisassemblyStorage( IDebugTarget target, ICDIInstruction[] instructions )
{
setDebugTarget( target );
setInstructions( instructions );
initializeAddresses();
createContent();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IDisassemblyStorage#getDebugTarget()
*/
public IDebugTarget getDebugTarget()
{
return fDebugTarget;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IDisassemblyStorage#containsAddress(Long)
*/
public boolean containsAddress( long address )
{
return ( address >= fStartAddress && address <= fEndAddress );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IDisassemblyStorage#getLineNumber(Long)
*/
public int getLineNumber( long address )
{
for ( int i = 0; i < fInstructions.length; ++i )
{
if ( fInstructions[i].getAdress() == address )
{
return i + 1;
}
}
return 0;
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getContents()
*/
public InputStream getContents() throws CoreException
{
if ( fInputStream != null )
fInputStream.reset();
return fInputStream;
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getFullPath()
*/
public IPath getFullPath()
{
return null;
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#getName()
*/
public String getName()
{
try
{
if ( getDebugTarget() != null )
{
return getDebugTarget().getName();
}
}
catch( DebugException e )
{
// ignore
}
return CDebugCorePlugin.getResourceString("internal.core.DisassemblyStorage.disassembly"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.core.resources.IStorage#isReadOnly()
*/
public boolean isReadOnly()
{
return true;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
*/
public Object getAdapter( Class adapter )
{
if ( adapter.equals( IStorage.class ) )
return this;
if ( adapter.equals( IDisassemblyStorage.class ) )
return this;
if ( adapter.equals( DisassemblyStorage.class ) )
return this;
if ( adapter.equals( IResource.class ) )
return getBinary();
return null;
}
protected void setDebugTarget( IDebugTarget target )
{
fDebugTarget = target;
}
protected void setInstructions( ICDIInstruction[] intructions )
{
fInstructions = intructions;
}
private void createContent()
{
StringBuffer lines = new StringBuffer();
int maxFunctionName = 0;
int maxOpcodeLength = 0;
long maxOffset = 0;
for ( int i = 0; i < fInstructions.length; ++i )
{
if ( fInstructions[i].getFuntionName().length() > maxFunctionName )
{
maxFunctionName = fInstructions[i].getFuntionName().length();
}
String opcode = fInstructions[i].getOpcode();
if ( opcode.length() > maxOpcodeLength )
maxOpcodeLength = opcode.length();
if ( fInstructions[i].getOffset() > maxOffset )
{
maxOffset = fInstructions[i].getOffset();
}
}
int instrPos = calculateInstructionPosition( maxFunctionName, maxOffset );
int argPosition = instrPos + maxOpcodeLength + 1;
for ( int i = 0; i < fInstructions.length; ++i )
{
lines.append( getInstructionString( fInstructions[i], instrPos, argPosition ) );
}
fInputStream = new ByteArrayInputStream( lines.toString().getBytes() );
}
private void initializeAddresses()
{
if ( fInstructions.length > 0 )
{
fStartAddress = fInstructions[0].getAdress();
fEndAddress = fInstructions[fInstructions.length - 1].getAdress();
}
}
private String getInstructionString( ICDIInstruction instruction, int instrPosition, int argPosition )
{
int worstCaseSpace = Math.max( instrPosition, argPosition );
char[] spaces= new char[worstCaseSpace];
Arrays.fill( spaces, ' ' );
StringBuffer sb = new StringBuffer();
if ( instruction != null )
{
sb.append( CDebugUtils.toHexAddressString( instruction.getAdress() ) );
sb.append( ' ' );
if ( instruction.getFuntionName() != null && instruction.getFuntionName().length() > 0 )
{
sb.append( '<' );
sb.append( instruction.getFuntionName() );
if ( instruction.getOffset() != 0 )
{
sb.append( '+' );
sb.append( instruction.getOffset() );
}
sb.append( ">:" ); //$NON-NLS-1$
sb.append( spaces, 0, instrPosition - sb.length() );
}
sb.append( instruction.getOpcode() );
sb.append( spaces, 0, argPosition - sb.length() );
sb.append( instruction.getArgs() );
sb.append( '\n' );
}
return sb.toString();
}
private int calculateInstructionPosition( int maxFunctionName, long maxOffset )
{
return ( 16 + maxFunctionName + Long.toString( maxOffset ).length() );
}
private IResource getBinary()
{
if ( getDebugTarget() != null )
{
IExecFileInfo info = (IExecFileInfo)getDebugTarget().getAdapter( IExecFileInfo.class );
if ( info != null )
{
return info.getExecFile();
}
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage#getAddress(int)
*/
public long getAddress( int lineNumber )
{
if ( fInstructions.length > lineNumber && lineNumber >= 0 )
{
return fInstructions[lineNumber].getAdress();
}
return 0;
}
}

View file

@ -73,7 +73,6 @@ import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
import org.eclipse.cdt.debug.internal.core.CBreakpointManager;
import org.eclipse.cdt.debug.internal.core.CMemoryManager;
import org.eclipse.cdt.debug.internal.core.CRegisterManager;
@ -81,7 +80,6 @@ import org.eclipse.cdt.debug.internal.core.CSharedLibraryManager;
import org.eclipse.cdt.debug.internal.core.CSignalManager;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IResourceChangeListener;
@ -229,11 +227,6 @@ public class CDebugTarget extends CDebugElement
*/
private CMemoryManager fMemoryManager;
/**
* A disassembly manager for this target.
*/
private DisassemblyManager fDisassemblyManager;
/**
* A disassembly manager for this target.
*/
@ -311,7 +304,6 @@ public class CDebugTarget extends CDebugElement
setExecFile( file );
setConfiguration( cdiTarget.getSession().getConfiguration() );
setThreadList( new ArrayList( 5 ) );
setDisassemblyManager( new DisassemblyManager( this ) );
createDisassembly();
setSharedLibraryManager( new CSharedLibraryManager( this ) );
setSignalManager( new CSignalManager( this ) );
@ -986,13 +978,6 @@ public class CDebugTarget extends CDebugElement
return this;
if ( adapter.equals( ICDebugTargetType.class ) )
return this;
if ( adapter.equals( ISourceMode.class ) )
{
if ( getSourceLocator() instanceof IAdaptable )
{
return ((IAdaptable)getSourceLocator()).getAdapter( ISourceMode.class );
}
}
if ( adapter.equals( ICMemoryManager.class ) )
return getMemoryManager();
if ( adapter.equals( IDebuggerProcessSupport.class ) )
@ -1011,8 +996,6 @@ public class CDebugTarget extends CDebugElement
return this;
if ( adapter.equals( CBreakpointManager.class ) )
return getBreakpointManager();
if ( adapter.equals( DisassemblyManager.class ) )
return getDisassemblyManager();
if ( adapter.equals( ICSharedLibraryManager.class ) )
return getSharedLibraryManager();
if ( adapter.equals( ICSignalManager.class ) )
@ -1252,7 +1235,6 @@ public class CDebugTarget extends CDebugElement
disposeSharedLibraryManager();
disposeSignalManager();
disposeRegisterManager();
disposeDisassemblyManager();
disposeDisassembly();
disposeSourceManager();
disposeBreakpointManager();
@ -1967,19 +1949,6 @@ public class CDebugTarget extends CDebugElement
return ( getTargetType() == ICDebugTargetType.TARGET_TYPE_LOCAL_CORE_DUMP );
}
protected int getRealSourceMode()
{
ISourceLocator sl = getSourceLocator();
if ( sl != null &&
sl instanceof IAdaptable &&
((IAdaptable)sl).getAdapter( ICSourceLocator.class ) != null &&
((IAdaptable)sl).getAdapter( ICSourceLocator.class ) instanceof CSourceManager )
{
return ((CSourceManager)((IAdaptable)sl).getAdapter( ICSourceLocator.class )).getRealMode();
}
return ISourceMode.MODE_SOURCE;
}
protected CMemoryManager getMemoryManager()
{
return fMemoryManager;
@ -2084,16 +2053,6 @@ public class CDebugTarget extends CDebugElement
};
}
protected void setDisassemblyManager( DisassemblyManager dm )
{
fDisassemblyManager = dm;
}
protected DisassemblyManager getDisassemblyManager()
{
return fDisassemblyManager;
}
protected void setSharedLibraryManager( CSharedLibraryManager libman )
{
fSharedLibraryManager = libman;
@ -2129,11 +2088,6 @@ public class CDebugTarget extends CDebugElement
fRegisterManager.dispose();
}
protected void disposeDisassemblyManager()
{
fDisassemblyManager.dispose();
}
/**
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long)
*/

View file

@ -37,7 +37,6 @@ import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.core.model.ISwitchToFrame;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
@ -1025,11 +1024,6 @@ public class CThread extends CDebugElement
}
}
private int getRealSourceMode()
{
return ((CDebugTarget)getDebugTarget()).getRealSourceMode();
}
private void setLastStackFrame( CStackFrame frame )
{
fLastStackFrame = frame;

View file

@ -9,12 +9,9 @@ package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@ -34,12 +31,9 @@ import org.eclipse.debug.core.model.IStackFrame;
*/
public class CSourceManager implements ICSourceLocator,
IPersistableSourceLocator,
ISourceMode,
IAdaptable
{
private ISourceLocator fSourceLocator = null;
private int fMode = ISourceMode.MODE_SOURCE;
private int fRealMode = fMode;
private ILaunch fLaunch = null;
private CDebugTarget fDebugTarget = null;
@ -56,21 +50,14 @@ public class CSourceManager implements ICSourceLocator,
*/
public int getLineNumber( IStackFrame frame )
{
if ( getRealMode() == ISourceMode.MODE_SOURCE )
if ( getCSourceLocator() != null )
{
if ( getCSourceLocator() != null )
{
return getCSourceLocator().getLineNumber( frame );
}
IStackFrameInfo info = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
if ( info != null )
{
return info.getFrameLineNumber();
}
return getCSourceLocator().getLineNumber( frame );
}
if ( getRealMode() == ISourceMode.MODE_DISASSEMBLY && getDisassemblyManager( frame ) != null )
IStackFrameInfo info = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
if ( info != null )
{
return getDisassemblyManager( frame ).getLineNumber( frame );
return info.getFrameLineNumber();
}
return 0;
}
@ -102,33 +89,6 @@ public class CSourceManager implements ICSourceLocator,
return ( getCSourceLocator() != null ) ? getCSourceLocator().contains( resource ) : false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.ISourceMode#getMode()
*/
public int getMode()
{
return fMode;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.ISourceMode#setMode(int)
*/
public void setMode( int mode )
{
fMode = mode;
setRealMode( mode );
}
public int getRealMode()
{
return fRealMode;
}
protected void setRealMode( int mode )
{
fRealMode = mode;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
*/
@ -138,8 +98,6 @@ public class CSourceManager implements ICSourceLocator,
return this;
if ( adapter.equals( ICSourceLocator.class ) )
return this;
if ( adapter.equals( ISourceMode.class ) )
return this;
if ( adapter.equals( IPersistableSourceLocator.class ) )
return this;
if ( adapter.equals( IResourceChangeListener.class ) &&
@ -154,21 +112,8 @@ public class CSourceManager implements ICSourceLocator,
public Object getSourceElement( IStackFrame stackFrame )
{
Object result = null;
boolean autoDisassembly = CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY );
if ( getMode() == ISourceMode.MODE_SOURCE && getSourceLocator() != null )
if ( getSourceLocator() != null )
result = getSourceLocator().getSourceElement( stackFrame );
if ( result == null &&
( autoDisassembly || getMode() == ISourceMode.MODE_DISASSEMBLY ) &&
getDisassemblyManager( stackFrame ) != null )
{
setRealMode( ISourceMode.MODE_DISASSEMBLY );
result = getDisassemblyManager( stackFrame ).getSourceElement( stackFrame );
}
else
{
setRealMode( ISourceMode.MODE_SOURCE );
}
return result;
}
@ -193,15 +138,6 @@ public class CSourceManager implements ICSourceLocator,
fSourceLocator = sl;
}
protected DisassemblyManager getDisassemblyManager( IStackFrame stackFrame )
{
if ( stackFrame != null )
{
return (DisassemblyManager)stackFrame.getDebugTarget().getAdapter( DisassemblyManager.class );
}
return null;
}
public void addSourceLocation( ICSourceLocation location )
{
ICSourceLocation[] locations = getSourceLocations();

View file

@ -1,247 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.util.ArrayList;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.internal.core.DisassemblyStorage;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
import org.eclipse.debug.core.model.IStackFrame;
/**
* Enter type comment.
*
* @since: Oct 8, 2002
*/
public class DisassemblyManager implements Preferences.IPropertyChangeListener
{
// move to preferences ???
final static private int DISASSEMBLY_BLOCK_SIZE = 100;
private CDebugTarget fDebugTarget;
private DisassemblyStorage fStorage = null;
/**
* Constructor for DisassemblyManager.
*/
public DisassemblyManager( CDebugTarget target )
{
setDebugTarget( target );
CDebugCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener( this );
}
public int getLineNumber( IStackFrame frame )
{
IStackFrameInfo info = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
if ( info != null )
{
DisassemblyStorage storage = getSourceElement( info );
if ( storage != null )
{
return storage.getLineNumber( info.getAddress() );
}
}
return 0;
}
public Object getSourceElement( IStackFrame stackFrame )
{
if ( stackFrame != null )
{
return getSourceElement( (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class ) );
}
return null;
}
public Object getSourceElement( long address )
{
DisassemblyStorage storage = null;
if ( getDisassemblyStorage() != null && getDisassemblyStorage().containsAddress( address ) )
{
storage = getDisassemblyStorage();
}
else
{
storage = loadDisassemblyStorage( address );
}
return storage;
}
private void setDebugTarget( CDebugTarget target )
{
fDebugTarget = target;
}
public CDebugTarget getDebugTarget()
{
return fDebugTarget;
}
private void setDisassemblyStorage( DisassemblyStorage ds )
{
fStorage = ds;
}
protected DisassemblyStorage getDisassemblyStorage()
{
return fStorage;
}
private DisassemblyStorage getSourceElement( IStackFrameInfo frameInfo )
{
DisassemblyStorage storage = null;
if ( frameInfo != null )
{
long address = frameInfo.getAddress();
if ( address != 0 )
{
if ( getDisassemblyStorage() != null && getDisassemblyStorage().containsAddress( address ) )
{
storage = getDisassemblyStorage();
}
else
{
storage = loadDisassemblyStorage( frameInfo );
}
}
}
return storage;
}
private DisassemblyStorage loadDisassemblyStorage( IStackFrameInfo frameInfo )
{
setDisassemblyStorage( null );
if ( frameInfo != null && getDebugTarget() != null && getDebugTarget().isSuspended() )
{
ICDISourceManager sm = getDebugTarget().getCDISession().getSourceManager();
if ( sm != null )
{
String fileName = frameInfo.getFile();
int lineNumber = frameInfo.getFrameLineNumber();
ICDIInstruction[] instructions = new ICDIInstruction[0];
long address = frameInfo.getAddress();
if ( fileName != null && fileName.length() > 0 )
{
try
{
instructions = sm.getInstructions( fileName,
lineNumber,
CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) );
}
catch( CDIException e )
{
}
}
if ( instructions.length == 0 ||
// Double check if debugger returns correct address range.
!containsAddress( instructions, address ) )
{
if ( address >= 0 )
{
try
{
instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) );
}
catch( CDIException e )
{
CDebugCorePlugin.log( e );
}
}
}
if ( instructions.length > 0 )
{
setDisassemblyStorage( new DisassemblyStorage( getDebugTarget(), instructions ) );
}
}
}
return getDisassemblyStorage();
}
private DisassemblyStorage loadDisassemblyStorage( long address )
{
setDisassemblyStorage( null );
if ( getDebugTarget() != null && getDebugTarget().isSuspended() )
{
ICDISourceManager sm = getDebugTarget().getCDISession().getSourceManager();
if ( sm != null )
{
ICDIInstruction[] instructions = new ICDIInstruction[0];
if ( instructions.length == 0 )
{
if ( address >= 0 )
{
try
{
instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) );
}
catch( CDIException e )
{
CDebugCorePlugin.log( e );
}
}
}
if ( instructions.length > 0 )
{
setDisassemblyStorage( new DisassemblyStorage( getDebugTarget(), instructions ) );
}
}
}
return getDisassemblyStorage();
}
private ICDIInstruction[] getFunctionInstructions( ICDIInstruction[] rawInstructions )
{
if ( rawInstructions.length > 0 &&
rawInstructions[0].getFuntionName() != null &&
rawInstructions[0].getFuntionName().length() > 0 )
{
ArrayList list = new ArrayList( rawInstructions.length );
list.add( rawInstructions[0] );
for ( int i = 1; i < rawInstructions.length; ++i )
{
if ( rawInstructions[0].getFuntionName().equals( rawInstructions[i].getFuntionName() ) )
{
list.add( rawInstructions[i] );
}
}
return (ICDIInstruction[])list.toArray( new ICDIInstruction[list.size()] );
}
return rawInstructions;
}
private boolean containsAddress( ICDIInstruction[] instructions, long address )
{
for ( int i = 0; i < instructions.length; ++i )
{
if ( instructions[i].getAdress() == address )
return true;
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
*/
public void propertyChange( PropertyChangeEvent event )
{
if ( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS.equals( event.getProperty() ) )
setDisassemblyStorage( null );
}
public void dispose()
{
CDebugCorePlugin.getDefault().getPluginPreferences().removePropertyChangeListener( this );
}
}

View file

@ -1,3 +1,20 @@
2004-05-13 Mikhail Khodjaiants
Removed old disassembly implementation.
* SwitchToDisassemblyActionDelegate.java: deleted
* src/org/eclipse/cdt/debug/internal/ui/editors/DisassemblyDocumentProvider.java: deleted
* src/org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditor.java: deleted
* src/org/eclipse/cdt/debug/internal/ui/editors/DisassemblyEditorInput.java: deleted
* src/org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotation.java: deleted
* src/org/eclipse/cdt/debug/internal/ui/editors/DisassemblyMarkerAnnotationModel.java: deleted
* src/org/eclipse/cdt/debug/internal/ui/editors/DisassemblySourceViewerConfiguration.java: deleted
* CDTDebugModelPresentation.java
* JumpToLineActionDelegate.java
* CDebugPreferencePage.java
* CDebugUIPlugin.java
* DefaultSourceLocator.java
* plugin.properties
* plugin.xml
2004-05-13 Mikhail Khodjaiants
Added the "Instruction Stepping Mode" action.
* ToggleInstructionStepModeActionDelegate.java

View file

@ -25,9 +25,6 @@ RestartAction.tooltip=Restart
ToggleInstructionStepModeAction.label=Instruction Stepping Mode
ToggleInstructionStepModeAction.tooltip=Instruction Stepping Mode
SwitchToDisassemblyAction.label=Disassembly Mode
SwitchToDisassemblyAction.tooltip=Disassembly Mode On/Off
ShowDebuggerConsoleAction.label=Show Debugger Console
ShowDebuggerConsoleAction.tooltip=Show Debugger Console On Target Selection

View file

@ -76,8 +76,8 @@
<view
relative="org.eclipse.debug.ui.VariableView"
visible="false"
id="org.eclipse.cdt.debug.ui.MemoryView"
relationship="stack">
relationship="stack"
id="org.eclipse.cdt.debug.ui.MemoryView">
</view>
<viewShortcut
id="org.eclipse.cdt.debug.ui.MemoryView">
@ -85,8 +85,8 @@
<view
relative="org.eclipse.debug.ui.VariableView"
visible="false"
id="org.eclipse.cdt.debug.ui.SharedLibrariesView"
relationship="stack">
relationship="stack"
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
</view>
<viewShortcut
id="org.eclipse.cdt.debug.ui.SharedLibrariesView">
@ -94,8 +94,8 @@
<view
relative="org.eclipse.debug.ui.VariableView"
visible="false"
id="org.eclipse.cdt.debug.ui.SignalsView"
relationship="stack">
relationship="stack"
id="org.eclipse.cdt.debug.ui.SignalsView">
</view>
<viewShortcut
id="org.eclipse.cdt.debug.ui.SignalsView">
@ -106,8 +106,8 @@
<view
relative="org.eclipse.ui.views.ContentOutline"
visible="false"
id="org.eclipse.cdt.debug.ui.DisassemblyView"
relationship="stack">
relationship="stack"
id="org.eclipse.cdt.debug.ui.DisassemblyView">
</view>
<viewShortcut
id="org.eclipse.cdt.debug.ui.DisassemblyView">
@ -277,22 +277,6 @@
</pluginState>
</enablement>
</action>
<action
label="%SwitchToDisassemblyAction.label"
icon="icons/full/clcl16/disassembly.gif"
style="toggle"
helpContextId="switch_to_disassembly_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
menubarPath="renderGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
<action
state="false"
style="toggle"
@ -306,8 +290,8 @@
tooltip="%ToggleInstructionStepModeAction.tooltip">
<enablement>
<pluginState
id="org.eclipse.cdt.debug.ui"
value="activated">
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
@ -693,8 +677,8 @@
label="%LoadSymbolsAction.label"
icon="icons/full/clcl16/load_symbols_co.gif"
helpContextId="load_symbols_action_context"
tooltip="%LoadSymbolsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate"
tooltip="%LoadSymbolsAction.tooltip"
menubarPath="sharedLibrariesGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsActionDelegate">
@ -713,8 +697,8 @@
label="%SignalAction.label"
icon="icons/full/clcl16/signal_co.gif"
helpContextId="signal_action_context"
tooltip="%SignalAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"
tooltip="%SignalAction.tooltip"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate">
@ -729,8 +713,8 @@
label="%SignalPropertiesAction.label"
style="pulldown"
helpContextId="signal_properties_action_context"
tooltip="%SignalPropertiesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate"
tooltip="%SignalPropertiesAction.tooltip"
enablesFor="1"
id="org.eclipse.cdt.debug.ui.SignalPropertiesAction">
<enablement>
@ -766,8 +750,8 @@
<action
label="%RestoreDefaultTypeAction.label"
helpContextId="restore_default_type_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"
tooltip="%RestoreDefaultTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate">
@ -782,8 +766,8 @@
label="%CastToTypeAction.label"
icon="icons/full/clcl16/casttotype_co.gif"
helpContextId="cast_to_type_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"
tooltip="%CastToTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate">
@ -798,8 +782,8 @@
label="%CastToArrayAction.label"
icon="icons/full/clcl16/showasarray_co.gif"
helpContextId="cast_to_array_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"
tooltip="%CastToArrayAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate">
@ -818,8 +802,8 @@
label="%ManageFunctionBreakpointAction.label"
icon="icons/full/obj16/funbrkp_obj.gif"
helpContextId="manage_function_breakpoint_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
tooltip="%ManageFunctionBreakpointAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"
menubarPath="additions"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate">
@ -838,8 +822,8 @@
label="%DisableVariablesAction.label"
icon="icons/full/clcl16/disabled_co.gif"
helpContextId="disable_variables_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"
tooltip="%DisableVariablesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"
menubarPath="variableGroup"
enablesFor="2+"
id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate">
@ -851,8 +835,8 @@
label="%EnableVariablesAction.label"
icon="icons/full/clcl16/enabled_co.gif"
helpContextId="enable_variables_action_context"
class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"
tooltip="%EnableVariablesAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"
menubarPath="variableGroup"
enablesFor="2+"
id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate">
@ -875,8 +859,8 @@
disabledIcon="icons/full/dlcl16/restart.gif"
enablesFor="1"
icon="icons/full/elcl16/restart.gif"
label="%RestartAction.label"
helpContextId="restart_action_context"
label="%RestartAction.label"
tooltip="%RestartAction.tooltip">
<enablement>
<pluginState
@ -886,36 +870,17 @@
</enablement>
</action>
<action
style="toggle"
id="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
toolbarPath="renderGroup"
hoverIcon="icons/full/clcl16/disassembly.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.SwitchToDisassemblyActionDelegate"
disabledIcon="icons/full/dlcl16/disassembly.gif"
enablesFor="1"
icon="icons/full/elcl16/disassembly.gif"
label="%SwitchToDisassemblyAction.label"
helpContextId="switch_to_disassembly_action_context"
tooltip="%SwitchToDisassemblyAction.tooltip">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement>
</action>
<action
style="toggle"
state="false"
toolbarPath="renderGroup"
style="toggle"
id="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
toolbarPath="renderGroup"
hoverIcon="icons/full/clcl16/instr_step.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.ToggleInstructionStepModeActionDelegate"
disabledIcon="icons/full/dlcl16/instr_step.gif"
enablesFor="1"
icon="icons/full/elcl16/instr_step.gif"
helpContextId="toggle_instruction_step_mode_action_context"
enablesFor="1"
label="%ToggleInstructionStepModeAction.label"
helpContextId="toggle_instruction_step_mode_action_context"
tooltip="%ToggleInstructionStepModeAction.tooltip">
<enablement>
<pluginState
@ -930,11 +895,11 @@
id="org.eclipse.cdt.debug.ui.debugView.menu">
<action
label="%ShowFullPathsAction.label"
style="toggle"
icon="icons/full/clcl16/show_paths.gif"
style="toggle"
helpContextId="show_full_paths_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
@ -954,11 +919,11 @@
id="org.eclipse.cdt.debug.ui.breakpointView.menu">
<action
label="%ShowFullPathsAction.label"
style="toggle"
icon="icons/full/clcl16/show_paths.gif"
style="toggle"
helpContextId="show_full_paths_context"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
@ -980,8 +945,8 @@
disabledIcon="icons/full/dlcl16/watch_globals.gif"
enablesFor="1"
icon="icons/full/elcl16/watch_globals.gif"
label="%AddGlobalsAction.label"
helpContextId="add_globals_action_context"
label="%AddGlobalsAction.label"
tooltip="%AddGlobalsAction.tooltip">
<enablement>
<pluginState
@ -996,11 +961,11 @@
id="org.eclipse.debug.ui.sharedLibrariesView.menu">
<action
label="%ShowFullPathsAction.label"
icon="icons/full/clcl16/show_paths.gif"
style="toggle"
icon="icons/full/clcl16/show_paths.gif"
helpContextId="show_full_paths_context"
tooltip="%ShowFullPathsAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction"
tooltip="%ShowFullPathsAction.tooltip"
menubarPath="cDebugActions"
id="org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction">
<enablement>
@ -1091,20 +1056,20 @@
<extension
point="org.eclipse.debug.core.statusHandlers">
<statusHandler
code="10000"
plugin="org.eclipse.cdt.debug.core"
code="10000"
class="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.QuestionStatusHandler">
</statusHandler>
<statusHandler
code="10001"
plugin="org.eclipse.cdt.debug.core"
code="10001"
class="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.InfoStatusHandler">
</statusHandler>
<statusHandler
code="10002"
plugin="org.eclipse.cdt.debug.core"
code="10002"
class="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler"
id="org.eclipse.cdt.debug.internal.ui.ErrorStatusHandler">
</statusHandler>
@ -1161,16 +1126,16 @@
point="org.eclipse.ui.editors">
<editor
name="%DisassemblyEditor.name"
extensions="dasm"
icon="icons/full/obj16/disassembly_obj.gif"
extensions="dasm"
class="org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditor"
id="org.eclipse.cdt.debug.ui.DisassemblyEditor">
</editor>
<editor
name="%CDebugEditor.name"
icon="icons/full/obj16/filenotfound_obj.gif"
class="org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor"
contributorClass="org.eclipse.cdt.internal.ui.editor.CEditorActionContributor"
class="org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor"
id="org.eclipse.cdt.debug.ui.editor.CDebugEditor">
</editor>
</extension>
@ -1192,8 +1157,8 @@
<context
name="Debugging C/C++"
description="Debugging C/C++ Programs"
id="org.eclipse.cdt.debug.ui.debugging"
parentId="org.eclipse.debug.ui.debugging">
parentId="org.eclipse.debug.ui.debugging"
id="org.eclipse.cdt.debug.ui.debugging">
</context>
</extension>
<extension
@ -1225,8 +1190,8 @@
<extension
point="org.eclipse.ui.editors.annotationTypes">
<type
super="org.eclipse.debug.core.breakpoint"
markerType="org.eclipse.cdt.debug.core.cBreakpointMarker"
super="org.eclipse.debug.core.breakpoint"
name="org.eclipse.cdt.debug.core.breakpoint">
</type>
<type
@ -1255,8 +1220,8 @@
highlightPreferenceValue="true"
presentationLayer="6"
icon="icons/full/obj16/inst_ptr_top.gif"
textPreferenceValue="false"
label="%DisassemblyCurrentInstructionPointer"
textPreferenceValue="false"
textPreferenceKey="currentDisassemblyIPIndication"
verticalRulerPreferenceKey="currentDisassemblyIPVerticalRuler"
overviewRulerPreferenceKey="currentDisassemblyIPOverviewRuler">
@ -1271,8 +1236,8 @@
highlightPreferenceValue="true"
presentationLayer="6"
icon="icons/full/obj16/inst_ptr.gif"
textPreferenceValue="false"
label="%DisassemblySecondaryInstructionPointer"
textPreferenceValue="false"
textPreferenceKey="secondaryDisassemblyIPIndication"
verticalRulerPreferenceKey="secondaryDisassemblyIPVerticalRuler"
overviewRulerPreferenceKey="secondaryDisassemblyIPOverviewRuler">
@ -1319,8 +1284,8 @@
</themeElementCategory>
<colorDefinition
label="%DisassemblySourceLineColor.label"
value="COLOR_DARK_BLUE"
categoryId="org.eclipse.cdt.debug.ui.presentation"
value="COLOR_DARK_BLUE"
id="org.eclipse.cdt.debug.ui.disassembly.sourceLineColor">
<description>
%DisassemblySourceLineColor.description

View file

@ -31,13 +31,9 @@ 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.IExecFileInfo;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
import org.eclipse.cdt.debug.internal.ui.editors.CDebugEditor;
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.editors.EditorInputDelegate;
import org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
@ -154,10 +150,6 @@ public class CDTDebugModelPresentation extends LabelProvider
{
return new FileEditorInput( (IFile)element );
}
if ( element instanceof ICAddressBreakpoint )
{
return getDisassemblyEditorInput( (ICAddressBreakpoint)element );
}
if ( element instanceof ICLineBreakpoint )
{
IFile file = (IFile)((ICLineBreakpoint)element).getMarker().getResource().getAdapter( IFile.class );
@ -168,10 +160,6 @@ public class CDTDebugModelPresentation extends LabelProvider
{
return new ExternalEditorInput( (IStorage)element );
}
if ( element instanceof IDisassemblyStorage )
{
return new DisassemblyEditorInput( (IStorage)element );
}
if ( element instanceof FileNotFoundElement )
{
return new EditorInputDelegate( (FileNotFoundElement)element );
@ -960,37 +948,6 @@ public class CDTDebugModelPresentation extends LabelProvider
return CDebugUIPlugin.getImageDescriptorRegistry().get( CDebugImages.DESC_OBJS_SHARED_LIBRARY );
}
protected DisassemblyEditorInput getDisassemblyEditorInput( ICAddressBreakpoint breakpoint )
{
IDebugTarget[] targets = DebugPlugin.getDefault().getLaunchManager().getDebugTargets();
for ( int i = 0; i < targets.length; ++i )
{
IResource resource = breakpoint.getMarker().getResource();
if ( resource != null && resource instanceof IFile &&
targets[i].getAdapter( IExecFileInfo.class )!= null &&
((IFile)resource).getLocation().toOSString().equals( ((IExecFileInfo)targets[i].getAdapter( IExecFileInfo.class )).getExecFile().getLocation().toOSString() ) )
{
if ( targets[i].getAdapter( DisassemblyManager.class ) != null )
{
try
{
long address = Long.parseLong( breakpoint.getAddress() );
IStorage storage = (IStorage)(((DisassemblyManager)targets[i].getAdapter( DisassemblyManager.class )).getSourceElement( address ) );
if ( storage != null )
return new DisassemblyEditorInput( storage );
}
catch( NumberFormatException e )
{
}
catch( CoreException e )
{
}
}
}
}
return null;
}
private String getVariableTypeName( ICType type )
{
String typeName = type.getName();

View file

@ -8,7 +8,6 @@ package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
import org.eclipse.cdt.debug.core.model.IJumpToLine;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IStorage;
@ -104,15 +103,6 @@ public class JumpToLineActionDelegate extends AbstractEditorActionDelegate
jumpToLine( path.lastSegment(), lineNumber );
}
}
else if ( storage != null && storage.getAdapter( IDisassemblyStorage.class ) != null )
{
IDisassemblyStorage disassemblyStorage = (IDisassemblyStorage)storage.getAdapter( IDisassemblyStorage.class );
ITextSelection selection = (ITextSelection)((ITextEditor)getTargetPart()).getSelectionProvider().getSelection();
int lineNumber = selection.getStartLine();
long address = disassemblyStorage.getAddress( lineNumber );
if ( address > 0 )
jumpToAddress( address );
}
}
catch( CoreException e )
{

View file

@ -1,130 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
import org.eclipse.cdt.debug.internal.core.model.CDebugElement;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.IViewPart;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Oct 11, 2002
*/
public class SwitchToDisassemblyActionDelegate extends AbstractListenerActionDelegate
{
private IViewPart fViewPart = null;
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(Object)
*/
protected void doAction( Object element ) throws DebugException
{
if ( element != null && element instanceof CDebugElement && getAction() != null && getAction().isEnabled() )
{
ISourceMode sourceMode = (ISourceMode)((CDebugElement)element).getDebugTarget().getAdapter( ISourceMode.class );
if ( sourceMode != null )
{
sourceMode.setMode( ( getAction().isChecked() ) ? ISourceMode.MODE_DISASSEMBLY : ISourceMode.MODE_SOURCE );
((CDebugElement)element).fireChangeEvent( DebugEvent.CLIENT_REQUEST );
if ( fViewPart != null && fViewPart instanceof ISelectionChangedListener )
{
final AbstractDebugView view = (AbstractDebugView)fViewPart;
fViewPart.getViewSite().getShell().getDisplay().asyncExec(
new Runnable()
{
public void run()
{
Viewer viewer = view.getViewer();
viewer.setSelection( viewer.getSelection() );
}
} );
}
}
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(Object)
*/
protected boolean isEnabledFor( Object element )
{
if ( element != null && element instanceof CDebugElement )
{
return ( ((CDebugElement)element).getDebugTarget().getAdapter( ISourceMode.class ) != null );
}
return false;
}
/**
* @see AbstractDebugActionDelegate#enableForMultiSelection()
*/
protected boolean enableForMultiSelection()
{
return false;
}
/**
* @see AbstractDebugActionDelegate#getStatusMessage()
*/
protected String getStatusMessage()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.SwitchToDisassemblyActionDelegate.Exceptions_occurred_attempting_to_switch_to_disassemblysource_mode."); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
*/
protected String getErrorDialogMessage()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.SwitchToDisassemblyActionDelegate.1"); //$NON-NLS-1$
}
/**
* @see AbstractDebugActionDelegate#getErrorDialogTitle()
*/
protected String getErrorDialogTitle()
{
return CDebugUIPlugin.getResourceString("internal.ui.actions.SwitchToDisassemblyActionDelegate.2"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged( IAction action, ISelection selection )
{
super.selectionChanged( action, selection );
boolean checked = false;
if ( selection != null && selection instanceof IStructuredSelection )
{
Object element = ((IStructuredSelection)selection).getFirstElement();
if ( element != null && element instanceof CDebugElement )
{
ISourceMode sourceMode = (ISourceMode)((CDebugElement)element).getDebugTarget().getAdapter( ISourceMode.class );
checked = ( sourceMode != null && sourceMode.getMode() == ISourceMode.MODE_DISASSEMBLY );
}
}
action.setChecked( checked );
}
/* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(IViewPart)
*/
public void init( IViewPart view )
{
super.init( view );
fViewPart = view;
}
}

View file

@ -1,44 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.editors;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.ui.editors.text.StorageDocumentProvider;
/**
* Enter type comment.
*
* @since: Jan 6, 2003
*/
public class DisassemblyDocumentProvider extends StorageDocumentProvider
{
/**
* Constructor for DisassemblyDocumentProvider.
*/
public DisassemblyDocumentProvider()
{
super();
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractDocumentProvider#createAnnotationModel(Object)
*/
protected IAnnotationModel createAnnotationModel( Object element ) throws CoreException
{
if ( element != null && element instanceof DisassemblyEditorInput )
{
IResource resource = (IResource)((DisassemblyEditorInput)element).getAdapter( IResource.class );
IStorage storage = ((DisassemblyEditorInput)element).getStorage();
if ( resource != null && storage != null && storage instanceof IDisassemblyStorage )
return new DisassemblyMarkerAnnotationModel( (IDisassemblyStorage)storage, resource );
}
return super.createAnnotationModel( element );
}
}

View file

@ -1,32 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.editors;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor;
import org.eclipse.cdt.ui.CUIPlugin;
/**
* Enter type comment.
*
* @since: Jan 6, 2003
*/
public class DisassemblyEditor extends AsmTextEditor
{
static final public String DISASSEMBLY_EDITOR_ID = "org.eclipse.cdt.debug.ui.DisassemblyEditor"; //$NON-NLS-1$
/**
* Constructor for DisassemblyEditor.
*/
public DisassemblyEditor()
{
super();
setDocumentProvider( CDebugUIPlugin.getDefault().getDisassemblyDocumentProvider() );
setSourceViewerConfiguration( new DisassemblySourceViewerConfiguration( CUIPlugin.getDefault().getAsmTextTools(), this ) );
setEditorContextMenuId("#DisassemblyEditorContext"); //$NON-NLS-1$
setRulerContextMenuId("#DisassemblyEditorRulerContext"); //$NON-NLS-1$
}
}

View file

@ -1,143 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.editors;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
/**
* Enter type comment.
*
* @since: Oct 8, 2002
*/
public class DisassemblyEditorInput implements IStorageEditorInput
{
private final static String FILE_NAME_EXTENSION = ".dasm"; //$NON-NLS-1$
protected IStorage fStorage;
/**
* Constructor for DisassemblyEditorInput.
*/
public DisassemblyEditorInput( IStorage storage )
{
fStorage = storage;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IStorageEditorInput#getStorage()
*/
public IStorage getStorage() throws CoreException
{
return fStorage;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#exists()
*/
public boolean exists()
{
return true;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getImageDescriptor()
*/
public ImageDescriptor getImageDescriptor()
{
return CDebugImages.DESC_OBJS_DISASSEMBLY;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getName()
*/
public String getName()
{
try
{
if ( getStorage() != null )
{
return getStorage().getName() + FILE_NAME_EXTENSION;
}
}
catch( CoreException e )
{
// ignore
}
return ""; //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getPersistable()
*/
public IPersistableElement getPersistable()
{
return null;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IEditorInput#getToolTipText()
*/
public String getToolTipText()
{
return CDebugUIPlugin.getResourceString("internal.ui.editors.DisassemblyEditorInput.Disassembly"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
*/
public Object getAdapter( Class adapter )
{
if ( adapter.equals( IResource.class ) )
{
try
{
IStorage storage = getStorage();
if ( storage != null )
{
return storage.getAdapter( adapter );
}
}
catch( CoreException e )
{
// ignore
}
}
if ( adapter.equals( DisassemblyEditorInput.class ) )
{
return this;
}
return null;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(Object)
*/
public boolean equals( Object obj )
{
if ( obj != null && obj instanceof DisassemblyEditorInput )
{
try
{
IStorage storage = ((DisassemblyEditorInput)obj).getStorage();
if ( storage != null && storage.equals( fStorage ) )
return true;
else if ( storage == null && fStorage == null )
return true;
}
catch( CoreException e )
{
}
}
return false;
}
}

View file

@ -1,55 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.editors;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.core.resources.IMarker;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.ui.texteditor.MarkerUtilities;
/**
* Enter type comment.
*
* @since: Jan 6, 2003
*/
public class DisassemblyMarkerAnnotation extends MarkerAnnotation
{
private IDebugModelPresentation fPresentation;
/**
* Constructor for DisassemblyMarkerAnnotation.
* @param marker
*/
public DisassemblyMarkerAnnotation( IMarker marker )
{
super( marker );
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.MarkerAnnotation#initialize()
*/
protected void initialize()
{
IMarker marker = getMarker();
if ( MarkerUtilities.isMarkerType( marker, CLineBreakpoint.getMarkerType() ) ||
MarkerUtilities.isMarkerType( marker, CFunctionBreakpoint.getMarkerType() ) ||
MarkerUtilities.isMarkerType( marker, CAddressBreakpoint.getMarkerType() ) )
{
if ( fPresentation == null )
fPresentation = DebugUITools.newDebugModelPresentation();
setLayer( 4 );
setImage( fPresentation.getImage( marker ) );
return;
}
super.initialize();
}
}

View file

@ -1,319 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.editors;
import java.util.ArrayList;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Position;
import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
import org.eclipse.ui.texteditor.MarkerAnnotation;
/**
* Enter type comment.
*
* @since: Jan 9, 2003
*/
public class DisassemblyMarkerAnnotationModel extends AbstractMarkerAnnotationModel
{
/**
* Internal resource change listener.
*/
class ResourceChangeListener implements IResourceChangeListener
{
/*
* @see IResourceChangeListener#resourceChanged
*/
public void resourceChanged( IResourceChangeEvent e )
{
IResourceDelta delta = e.getDelta();
try
{
if ( delta != null )
delta.accept( getResourceDeltaVisitor() );
}
catch( CoreException x )
{
doHandleCoreException( x, CDebugUIPlugin.getResourceString("internal.ui.editors.DisassemblyMarkerAnnotationModel.Resource_Changed") ); //$NON-NLS-1$
}
}
}
/**
* Internal resource delta visitor.
*/
class ResourceDeltaVisitor implements IResourceDeltaVisitor
{
/*
* @see IResourceDeltaVisitor#visit
*/
public boolean visit( IResourceDelta delta ) throws CoreException
{
if ( delta != null && /*getResource().equals( delta.getResource() )*/delta.getResource() instanceof IFile )
{
update( delta.getMarkerDeltas() );
return false;
}
return true;
}
}
/** The workspace */
private IWorkspace fWorkspace;
/** The resource */
private IResource fResource;
/** The resource change listener */
private IResourceChangeListener fResourceChangeListener = new ResourceChangeListener();
/** The resource delta visitor */
private IResourceDeltaVisitor fResourceDeltaVisitor = new ResourceDeltaVisitor();
private IDisassemblyStorage fStorage = null;
/**
* Constructor for DisassemblyMarkerAnnotationModel.
*/
public DisassemblyMarkerAnnotationModel( IDisassemblyStorage storage, IResource resource )
{
fResource = resource;
fWorkspace = resource.getWorkspace();
fStorage = storage;
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#retrieveMarkers()
*/
protected IMarker[] retrieveMarkers() throws CoreException
{
if ( fStorage == null )
return null;
IDebugTarget target = fStorage.getDebugTarget();
if ( target != null )
{
IBreakpointManager bm = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] brkpts = bm.getBreakpoints();
ArrayList list = new ArrayList( brkpts.length );
for ( int i = 0; i < brkpts.length; ++i )
{
if ( target.supportsBreakpoint( brkpts[i] ) && isAcceptable( brkpts[i].getMarker() ) )
{
list.add( brkpts[i].getMarker() );
}
}
return (IMarker[])list.toArray( new IMarker[list.size()] );
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#deleteMarkers(IMarker[])
*/
protected void deleteMarkers( final IMarker[] markers ) throws CoreException
{
fWorkspace.run( new IWorkspaceRunnable()
{
public void run( IProgressMonitor monitor ) throws CoreException
{
for ( int i = 0; i < markers.length; ++i )
{
markers[i].delete();
}
}
}, null );
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#listenToMarkerChanges(boolean)
*/
protected void listenToMarkerChanges( boolean listen )
{
if ( listen )
fWorkspace.addResourceChangeListener( fResourceChangeListener );
else
fWorkspace.removeResourceChangeListener( fResourceChangeListener );
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#isAcceptable(IMarker)
*/
protected boolean isAcceptable( IMarker marker )
{
try
{
return ( marker.getType().equals( CLineBreakpoint.getMarkerType() ) ||
marker.getType().equals( CFunctionBreakpoint.getMarkerType() ) ||
marker.getType().equals( CAddressBreakpoint.getMarkerType() ) );
}
catch( CoreException e )
{
}
return false;
}
protected IResourceDeltaVisitor getResourceDeltaVisitor()
{
return fResourceDeltaVisitor;
}
/**
* Updates this model to the given marker deltas.
*
* @param markerDeltas the list of marker deltas
*/
protected void update( IMarkerDelta[] markerDeltas )
{
if ( markerDeltas.length == 0 )
return;
for( int i = 0; i < markerDeltas.length; i++ )
{
IMarkerDelta delta = markerDeltas[i];
switch( delta.getKind() )
{
case IResourceDelta.ADDED :
addMarkerAnnotation( delta.getMarker() );
break;
case IResourceDelta.REMOVED :
removeMarkerAnnotation( delta.getMarker() );
break;
case IResourceDelta.CHANGED :
modifyMarkerAnnotation( delta.getMarker() );
break;
}
}
fireModelChanged();
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#createPositionFromMarker(IMarker)
*/
protected Position createPositionFromMarker( IMarker marker )
{
try
{
if ( marker.getType().equals( CLineBreakpoint.getMarkerType() ) )
{
return createPositionFromLineBreakpoint( marker );
}
if ( marker.getType().equals( CFunctionBreakpoint.getMarkerType() ) )
{
return createPositionFromLineBreakpoint( marker );
}
if ( marker.getType().equals( CAddressBreakpoint.getMarkerType() ) )
{
return createPositionFromAddressBreakpoint( marker );
}
}
catch( CoreException e )
{
}
return null;
}
private Position createPositionFromLineBreakpoint( IMarker marker )
{
// if ( fStorage != null )
// {
// IBreakpoint breakpoint = DebugPlugin.getDefault().getBreakpointManager().getBreakpoint( marker );
// if ( breakpoint instanceof ICBreakpoint )
// {
// IDebugTarget target = fStorage.getDebugTarget();
// if ( target != null && target.getAdapter( ICBreakpointManager.class ) != null )
// {
// ICBreakpointManager bm = (ICBreakpointManager)target.getAdapter( ICBreakpointManager.class );
// long address = bm.getBreakpointAddress( (ICBreakpoint)breakpoint );
// if ( address != 0 )
// return createPositionFromAddress( address );
// }
// }
// }
return null;
}
private Position createPositionFromAddressBreakpoint( IMarker marker ) throws CoreException
{
try
{
return createPositionFromAddress( Long.parseLong( marker.getAttribute( ICAddressBreakpoint.ADDRESS, "0" ) ) ); //$NON-NLS-1$
}
catch( NumberFormatException e )
{
}
return null;
}
private Position createPositionFromAddress( long address )
{
try
{
int start = -1;
int line = fStorage.getLineNumber( address );
if ( line > 0 && fDocument != null )
{
start = fDocument.getLineOffset( line - 1 );
if ( start > -1 )
{
return new Position( start, fDocument.getLineLength( line - 1 ) );
}
}
}
catch ( BadLocationException x )
{
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#createMarkerAnnotation(IMarker)
*/
protected MarkerAnnotation createMarkerAnnotation( IMarker marker )
{
return new DisassemblyMarkerAnnotation( marker );
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#getMarkerPosition(IMarker)
*/
public Position getMarkerPosition( IMarker marker )
{
return createPositionFromMarker( marker );
}
protected void doHandleCoreException( CoreException e, String message )
{
handleCoreException( e, message );
}
protected IResource getResource()
{
return fResource;
}
}

View file

@ -1,61 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.editors;
import org.eclipse.cdt.internal.ui.editor.asm.AsmSourceViewerConfiguration;
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextEditor;
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools;
import org.eclipse.cdt.internal.ui.text.CAnnotationHover;
import org.eclipse.cdt.internal.ui.text.HTMLTextPresenter;
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
/**
* Enter type comment.
*
* @since May 5, 2003
*/
public class DisassemblySourceViewerConfiguration extends AsmSourceViewerConfiguration
{
public DisassemblySourceViewerConfiguration( AsmTextTools tools, AsmTextEditor editor )
{
super( tools, editor );
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getAnnotationHover(org.eclipse.jface.text.source.ISourceViewer)
*/
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer)
{
return new CAnnotationHover();
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getInformationControlCreator(org.eclipse.jface.text.source.ISourceViewer)
*/
public IInformationControlCreator getInformationControlCreator( ISourceViewer sourceViewer )
{
return getInformationControlCreator( sourceViewer, true );
}
public IInformationControlCreator getInformationControlCreator( ISourceViewer sourceViewer, final boolean cutDown )
{
return new IInformationControlCreator()
{
public IInformationControl createInformationControl( Shell parent )
{
int style = cutDown ? SWT.NONE : ( SWT.V_SCROLL | SWT.H_SCROLL );
return new DefaultInformationControl( parent, style, new HTMLTextPresenter( cutDown ) );
}
};
}
}

View file

@ -57,8 +57,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
private Combo fVariableFormatCombo;
private Combo fExpressionFormatCombo;
private Combo fRegisterFormatCombo;
// Disassembly setting widgets
private Button fAutoDisassemblyButton;
// Maximum number of disassembly instructions to display
private IntegerFieldEditor fMaxNumberOfInstructionsText;
@ -155,7 +153,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
fRefreshRegistersButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH ) );
fRefreshSolibsButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH ) );
fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) );
getMaxNumberOfInstructionsText().setStringValue( new Integer( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) ).toString() );
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
@ -185,7 +182,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
{
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false );
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, true );
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_AUTO_DISASSEMBLY, false );
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS, ICDebugConstants.DEF_NUMBER_OF_INSTRUCTIONS );
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, ICDIFormat.NATURAL );
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, ICDIFormat.NATURAL );
@ -223,7 +219,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
private void createDisassemblySettingPreferences( Composite parent )
{
Composite comp = createGroupComposite( parent, 1, CDebugUIPlugin.getResourceString("internal.ui.preferences.CDebugPreferencePage.Disassembly_options") ); //$NON-NLS-1$
fAutoDisassemblyButton = createCheckButton( comp, CDebugUIPlugin.getResourceString("internal.ui.preferences.CDebugPreferencePage.autoDisassemblyButton") ); //$NON-NLS-1$
createMaxNumberOfInstructionsField( comp );
}
@ -362,7 +357,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
store.setValue( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, fPathsButton.getSelection() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH, fRefreshRegistersButton.getSelection() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH, fRefreshSolibsButton.getSelection() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_AUTO_DISASSEMBLY, fAutoDisassemblyButton.getSelection() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS, getMaxNumberOfInstructionsText().getIntValue() );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, getFormatId( fVariableFormatCombo.getSelectionIndex() ) );
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, getFormatId( fExpressionFormatCombo.getSelectionIndex() ) );
@ -385,7 +379,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
fPathsButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
fRefreshRegistersButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH ) );
fRefreshSolibsButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH ) );
fAutoDisassemblyButton.setSelection( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultBoolean( ICDebugConstants.PREF_AUTO_DISASSEMBLY ) );
getMaxNumberOfInstructionsText().setStringValue( new Integer( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_MAX_NUMBER_OF_INSTRUCTIONS ) ).toString() );
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );

View file

@ -19,17 +19,13 @@ import java.util.ResourceBundle;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.model.ISwitchToFrame;
import org.eclipse.cdt.debug.core.model.ISwitchToThread;
import org.eclipse.cdt.debug.core.sourcelookup.IDisassemblyStorage;
import org.eclipse.cdt.debug.internal.ui.CBreakpointUpdater;
import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
import org.eclipse.cdt.debug.internal.ui.ColorManager;
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyDocumentProvider;
import org.eclipse.cdt.debug.internal.ui.editors.DisassemblyEditorInput;
import org.eclipse.cdt.debug.internal.ui.preferences.CDebugPreferencePage;
import org.eclipse.cdt.debug.internal.ui.preferences.MemoryViewPreferencePage;
import org.eclipse.cdt.debug.ui.sourcelookup.DefaultSourceLocator;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@ -38,12 +34,8 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IThread;
@ -57,9 +49,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
@ -69,9 +58,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* The main plugin class to be used in the desktop.
*/
public class CDebugUIPlugin extends AbstractUIPlugin
implements ISelectionListener,
IDebugEventSetListener
public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListener
{
//The shared instance.
private static CDebugUIPlugin plugin;
@ -82,9 +69,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin
private CDebugImageDescriptorRegistry fImageDescriptorRegistry;
// Document provider for disassembly editor
private DisassemblyDocumentProvider fDisassemblyDocumentProvider = null;
/**
* The constructor.
*/
@ -338,7 +322,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin
*/
public void shutdown() throws CoreException
{
DebugPlugin.getDefault().removeDebugEventListener( this );
CDebugCorePlugin.getDefault().removeCBreakpointListener( CBreakpointUpdater.getInstance() );
// TODO: PR 52155, this is big hammer approach, but it is ok for
// Since the code will be remove when we align ourselves
@ -372,7 +355,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin
ww.getSelectionService().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
}
CDebugCorePlugin.getDefault().addCBreakpointListener( CBreakpointUpdater.getInstance() );
DebugPlugin.getDefault().addDebugEventListener( this );
}
/* (non-Javadoc)
@ -424,78 +406,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(DebugEvent[])
*/
public void handleDebugEvents( DebugEvent[] events )
{
for ( int i = 0; i < events.length; i++ )
{
DebugEvent event = events[i];
if ( event.getKind() == DebugEvent.TERMINATE )
{
Object element = event.getSource();
if ( element != null && element instanceof IDebugTarget )
{
closeDisassemblyEditors( (IDebugTarget)element );
}
}
}
}
private void closeDisassemblyEditors( final IDebugTarget target )
{
IWorkbenchWindow[] windows = getWorkbench().getWorkbenchWindows();
for ( int i = 0; i < windows.length; ++i )
{
IWorkbenchPage[] pages = windows[i].getPages();
for ( int j = 0; j < pages.length; ++j )
{
IEditorReference[] refs = pages[j].getEditorReferences();
for ( int k = 0; k < refs.length; ++k )
{
IEditorPart editor = refs[k].getEditor( false );
if ( editor != null )
{
IEditorInput input = editor.getEditorInput();
if ( input != null && input instanceof DisassemblyEditorInput )
{
try
{
IStorage storage = ((DisassemblyEditorInput)input).getStorage();
if ( storage != null && storage instanceof IDisassemblyStorage &&
target.equals( ((IDisassemblyStorage)storage).getDebugTarget() ) )
{
Shell shell = windows[i].getShell();
if ( shell != null )
{
Display display = shell.getDisplay();
if ( display != null )
{
final IWorkbenchPage page = pages[j];
final IEditorPart editor0 = editor;
display.asyncExec( new Runnable()
{
public void run()
{
page.closeEditor( editor0, false );
}
} );
}
}
}
}
catch( CoreException e )
{
// ignore
}
}
}
}
}
}
}
private boolean sameThread( IDebugElement element ) throws DebugException
{
if ( element.getDebugTarget() instanceof ISwitchToThread )
@ -512,16 +422,6 @@ public class CDebugUIPlugin extends AbstractUIPlugin
return false;
}
/**
* Returns the document provider used for the disassembly editor
*/
public DisassemblyDocumentProvider getDisassemblyDocumentProvider()
{
if ( fDisassemblyDocumentProvider == null )
fDisassemblyDocumentProvider = new DisassemblyDocumentProvider();
return fDisassemblyDocumentProvider;
}
public static IPersistableSourceLocator createDefaultSourceLocator()
{
return new DefaultSourceLocator();

View file

@ -22,7 +22,6 @@ 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.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
import org.eclipse.cdt.debug.core.sourcelookup.SourceLookupFactory;
import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
@ -264,10 +263,6 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
{
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
}
if ( adapter.equals( ISourceMode.class ) )
{
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
}
}
return null;
}