1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Implementation of disassembly mode.

This commit is contained in:
Mikhail Khodjaiants 2002-10-09 17:56:17 +00:00
parent 364318b050
commit be32b96116
9 changed files with 108 additions and 39 deletions

View file

@ -1,23 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core.internal.sourcelookup;
/**
* Enter type comment.
*
* @since: Oct 8, 2002
*/
public class DisassemblyManager
{
/**
* Constructor for DisassemblyManager.
*/
public DisassemblyManager()
{
super();
}
}

View file

@ -36,7 +36,7 @@ public interface ICSourceLocator extends ISourceLocator
* @param fileName the file name for which to locate source * @param fileName the file name for which to locate source
* @return an object representing a source element. * @return an object representing a source element.
*/ */
Object getSourceElement( String fileName ); // Object getSourceElement( String fileName );
/** /**
* Returns the source locations of this locator. * Returns the source locations of this locator.

View file

@ -53,9 +53,9 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread; import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
import org.eclipse.cdt.debug.core.internal.sourcelookup.CSourceLocator; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
import org.eclipse.cdt.debug.core.internal.sourcelookup.CSourceManager; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
import org.eclipse.cdt.debug.core.internal.sourcelookup.DisassemblyManager; import org.eclipse.cdt.debug.internal.core.sourcelookup.DisassemblyManager;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint; import org.eclipse.cdt.debug.internal.core.breakpoints.CBreakpoint;
@ -1805,7 +1805,7 @@ public class CDebugTarget extends CDebugElement
protected ISourceLocator createSourceLocator( IProject project ) protected ISourceLocator createSourceLocator( IProject project )
{ {
return new CSourceManager( ( getLaunch().getSourceLocator() != null ) ? getLaunch().getSourceLocator() : new CSourceLocator( project ), return new CSourceManager( ( getLaunch().getSourceLocator() != null ) ? getLaunch().getSourceLocator() : new CSourceLocator( project ),
new DisassemblyManager() ) ; new DisassemblyManager( this ) ) ;
} }
protected void setSourceSearchPath() protected void setSourceSearchPath()

View file

@ -3,7 +3,7 @@
* All Rights Reserved. * All Rights Reserved.
* *
*/ */
package org.eclipse.cdt.debug.core.internal.sourcelookup; package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File; import java.io.File;

View file

@ -3,7 +3,7 @@
* All Rights Reserved. * All Rights Reserved.
* *
*/ */
package org.eclipse.cdt.debug.core.internal.sourcelookup; package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.io.File; import java.io.File;

View file

@ -4,7 +4,7 @@
* *
*/ */
package org.eclipse.cdt.debug.core.internal.sourcelookup; package org.eclipse.cdt.debug.internal.core.sourcelookup;
import java.util.ArrayList; import java.util.ArrayList;
@ -106,6 +106,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICSourceLocator#getSourceElement(String) * @see org.eclipse.cdt.debug.core.ICSourceLocator#getSourceElement(String)
*/ */
/*
public Object getSourceElement( String fileName ) public Object getSourceElement( String fileName )
{ {
Object result = null; Object result = null;
@ -128,7 +129,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
} }
return result; return result;
} }
*/
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.ICSourceLocator#contains(IResource) * @see org.eclipse.cdt.debug.core.ICSourceLocator#contains(IResource)
*/ */

View file

@ -4,7 +4,7 @@
* *
*/ */
package org.eclipse.cdt.debug.core.internal.sourcelookup; package org.eclipse.cdt.debug.internal.core.sourcelookup;
import org.eclipse.cdt.debug.core.IStackFrameInfo; import org.eclipse.cdt.debug.core.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation; import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
@ -32,8 +32,8 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable
*/ */
public CSourceManager( ISourceLocator sourceLocator, DisassemblyManager disassemblyManager ) public CSourceManager( ISourceLocator sourceLocator, DisassemblyManager disassemblyManager )
{ {
fSourceLocator = sourceLocator; setSourceLocator( sourceLocator );
fDisassemblyManager = disassemblyManager; setDisassemblyManager( disassemblyManager );
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -58,11 +58,12 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#getSourceElement(String) * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#getSourceElement(String)
*/ */
/*
public Object getSourceElement( String fileName ) public Object getSourceElement( String fileName )
{ {
return ( getCSourceLocator() != null ) ? getCSourceLocator().getSourceElement( fileName ) : null; return ( getCSourceLocator() != null ) ? getCSourceLocator().getSourceElement( fileName ) : null;
} }
*/
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#getSourceLocations() * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#getSourceLocations()
*/ */
@ -106,7 +107,7 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable
fMode = mode; fMode = mode;
} }
protected int getRealMode() public int getRealMode()
{ {
return fRealMode; return fRealMode;
} }
@ -129,7 +130,21 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable
*/ */
public Object getSourceElement( IStackFrame stackFrame ) public Object getSourceElement( IStackFrame stackFrame )
{ {
return ( getSourceLocator() != null ) ? getSourceLocator().getSourceElement( stackFrame ) : null; Object result = null;
if ( getMode() == ISourceMode.MODE_SOURCE && getSourceLocator() != null )
{
result = getSourceLocator().getSourceElement( stackFrame );
}
if ( result == null && getDisassemblyManager() != null )
{
setRealMode( ISourceMode.MODE_DISASSEMBLY );
result = getDisassemblyManager().getSourceElement( stackFrame );
}
else
{
setRealMode( ISourceMode.MODE_SOURCE );
}
return result;
} }
protected ICSourceLocator getCSourceLocator() protected ICSourceLocator getCSourceLocator()
@ -143,4 +158,19 @@ public class CSourceManager implements ICSourceLocator, ISourceMode, IAdaptable
{ {
return fSourceLocator; return fSourceLocator;
} }
protected void setSourceLocator( ISourceLocator sl )
{
fSourceLocator = sl;
}
protected void setDisassemblyManager( DisassemblyManager dm )
{
fDisassemblyManager = dm;
}
protected DisassemblyManager getDisassemblyManager()
{
return fDisassemblyManager;
}
} }

View file

@ -0,0 +1,61 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.core.sourcelookup;
import org.eclipse.cdt.debug.core.IStackFrameInfo;
import org.eclipse.cdt.debug.internal.core.DisassemblyStorage;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.debug.core.model.IStackFrame;
/**
* Enter type comment.
*
* @since: Oct 8, 2002
*/
public class DisassemblyManager
{
private CDebugTarget fDebugTarget;
private DisassemblyStorage fStorage = null;
/**
* Constructor for DisassemblyManager.
*/
public DisassemblyManager( CDebugTarget target )
{
setDebugTarget( target );
}
public int getLineNumber( IStackFrameInfo frameInfo )
{
return 0;
}
public Object getSourceElement( IStackFrame stackFrame )
{
return null;
}
private void setDebugTarget( CDebugTarget target )
{
fDebugTarget = target;
}
public CDebugTarget getDebugTarget()
{
return fDebugTarget;
}
private void setDisassemblyStorage( DisassemblyStorage ds )
{
fStorage = ds;
}
protected DisassemblyStorage getDisassemblyStorage()
{
return fStorage;
}
}

View file

@ -8,7 +8,7 @@ package org.eclipse.cdt.debug.ui;
import java.text.MessageFormat; import java.text.MessageFormat;
import org.eclipse.cdt.debug.core.IStackFrameInfo; import org.eclipse.cdt.debug.core.IStackFrameInfo;
import org.eclipse.cdt.debug.core.internal.sourcelookup.CSourceLocator; import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;