diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index d35323ee061..6f69756a9b1 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,13 @@ +2004-10-07 Mikhail Khodjaiants + Pass the current stack frame to the registers manager to provide the evaluation context. + * ICRegisterManager.java + * IDummyStackFrame.java + * CRegisterManager.java + * CDebugTarget.java + * CDummyStackFrame.java + * CRegisterGroup.java + * CStackFrame.java + 2004-10-07 Mikhail Khodjaiants Provide a context for expression evaluation. * ICValue.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICRegisterManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICRegisterManager.java index 3a17c5f49c0..a12eab473be 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICRegisterManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICRegisterManager.java @@ -8,31 +8,19 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.debug.core; import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IRegisterGroup; /** - * Enter type comment. - * - * @since Mar 31, 2003 + * Provides the access to the register groups' management functions. */ -public interface ICRegisterManager extends ICUpdateManager, IAdaptable -{ - void initialize(); - - IRegisterGroup[] getRegisterGroups() throws DebugException; - +public interface ICRegisterManager extends ICUpdateManager, IAdaptable { + void addRegisterGroup( IRegisterGroup group ); - + void removeRegisterGroup( IRegisterGroup group ); void removeAllRegisterGroups(); - - void reset(); - - void dispose(); -} +} \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDummyStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDummyStackFrame.java index c379007e9e2..7a9d3d782b1 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDummyStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IDummyStackFrame.java @@ -11,10 +11,8 @@ package org.eclipse.cdt.debug.core.model; /** - * Enter type comment. - * - * @since: Nov 13, 2002 + * Represents a dummy stack frame used to indicate that the stack depth is greater + * than the number of displayed frames. */ -public interface IDummyStackFrame -{ -} +public interface IDummyStackFrame { +} \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CRegisterManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CRegisterManager.java index 151990ce416..04205507c93 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CRegisterManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CRegisterManager.java @@ -8,13 +8,11 @@ * Contributors: * QNX Software Systems - Initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.debug.internal.core; import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.ICRegisterManager; @@ -23,34 +21,36 @@ import org.eclipse.cdt.debug.core.cdi.ICDIManager; import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterObject; import org.eclipse.cdt.debug.internal.core.model.CDebugTarget; import org.eclipse.cdt.debug.internal.core.model.CRegisterGroup; +import org.eclipse.cdt.debug.internal.core.model.CStackFrame; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IRegisterGroup; /** - * Enter type comment. - * - * @since Mar 31, 2003 + * Manages all register groups in a debug target. */ -public class CRegisterManager extends CUpdateManager implements ICRegisterManager -{ +public class CRegisterManager extends CUpdateManager implements ICRegisterManager { + /** * Collection of register groups added to this target. Values are of type CRegisterGroup. */ private List fRegisterGroups; /** - * + * The last stack frame. */ - public CRegisterManager( CDebugTarget target ) - { + private CStackFrame fStackFrame; + + /** + * Constructor for CRegisterManager. + */ + public CRegisterManager( CDebugTarget target ) { super( target ); } /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ - public Object getAdapter( Class adapter ) - { + public Object getAdapter( Class adapter ) { if ( ICRegisterManager.class.equals( adapter ) ) return this; if ( CRegisterManager.class.equals( adapter ) ) @@ -58,11 +58,8 @@ public class CRegisterManager extends CUpdateManager implements ICRegisterManage return super.getAdapter( adapter ); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICRegisterManager#dispose() - */ - public void dispose() - { + public void dispose() { + setStackFrame( null ); removeAllRegisterGroups(); super.dispose(); } @@ -70,25 +67,16 @@ public class CRegisterManager extends CUpdateManager implements ICRegisterManage /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.ICRegisterManager#addRegisterGroup(org.eclipse.debug.core.model.IRegisterGroup) */ - public void addRegisterGroup( IRegisterGroup group ) - { + public void addRegisterGroup( IRegisterGroup group ) { // TODO Auto-generated method stub - } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICRegisterManager#getRegisterGroups() - */ - public IRegisterGroup[] getRegisterGroups() throws DebugException - { + public IRegisterGroup[] getRegisterGroups( CStackFrame frame ) throws DebugException { + setStackFrame( frame ); return (IRegisterGroup[])fRegisterGroups.toArray( new IRegisterGroup[fRegisterGroups.size()] ); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICRegisterManager#initialize() - */ - public void initialize() - { + public void initialize() { fRegisterGroups = new ArrayList( 20 ); boolean autoRefresh = CDebugCorePlugin.getDefault().getPluginPreferences().getBoolean( ICDebugConstants.PREF_REGISTERS_AUTO_REFRESH ); if ( getCDIManager() != null ) @@ -99,11 +87,9 @@ public class CRegisterManager extends CUpdateManager implements ICRegisterManage /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.ICRegisterManager#removeAllRegisterGroups() */ - public void removeAllRegisterGroups() - { + public void removeAllRegisterGroups() { Iterator it = fRegisterGroups.iterator(); - while( it.hasNext() ) - { + while( it.hasNext() ) { ((CRegisterGroup)it.next()).dispose(); } fRegisterGroups.clear(); @@ -112,44 +98,25 @@ public class CRegisterManager extends CUpdateManager implements ICRegisterManage /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.ICRegisterManager#removeRegisterGroup(org.eclipse.debug.core.model.IRegisterGroup) */ - public void removeRegisterGroup( IRegisterGroup group ) - { + public void removeRegisterGroup( IRegisterGroup group ) { fRegisterGroups.remove( group ); } - private void createMainRegisterGroup() - { + private void createMainRegisterGroup() { ICDIRegisterObject[] regObjects = null; - try - { + try { regObjects = getDebugTarget().getCDISession().getRegisterManager().getRegisterObjects(); } - catch( CDIException e ) - { + catch( CDIException e ) { CDebugCorePlugin.log( e ); } - if ( regObjects != null ) - { + if ( regObjects != null ) { fRegisterGroups.add( new CRegisterGroup( getDebugTarget(), "Main", regObjects ) ); //$NON-NLS-1$ } } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.ICRegisterManager#reset() - */ - public void reset() - { - Iterator it = fRegisterGroups.iterator(); - while( it.hasNext() ) - { - ((CRegisterGroup)it.next()).resetChangeFlags(); - } - } - - protected ICDIManager getCDIManager() - { - if ( getDebugTarget() != null ) - { + protected ICDIManager getCDIManager() { + if ( getDebugTarget() != null ) { return getDebugTarget().getCDISession().getRegisterManager(); } return null; @@ -161,4 +128,12 @@ public class CRegisterManager extends CUpdateManager implements ICRegisterManage ((CRegisterGroup)it.next()).targetSuspended(); } } + + public CStackFrame getStackFrame() { + return fStackFrame; + } + + private void setStackFrame( CStackFrame stackFrame ) { + fStackFrame = stackFrame; + } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index 349548d3b1e..04e1033ecc7 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -1387,10 +1387,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv return getLaunch().getSourceLocator(); } - protected void resetRegisters() { - getRegisterManager().reset(); - } - protected CMemoryManager getMemoryManager() { return fMemoryManager; } @@ -1627,8 +1623,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv fRegisterManager = registerManager; } - public IRegisterGroup[] getRegisterGroups() throws DebugException { - return getRegisterManager().getRegisterGroups(); + public IRegisterGroup[] getRegisterGroups( CStackFrame frame ) throws DebugException { + return getRegisterManager().getRegisterGroups( frame ); } protected void disposeSourceManager() { diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDummyStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDummyStackFrame.java index 2a14866f639..f11240d7c45 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDummyStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDummyStackFrame.java @@ -18,12 +18,10 @@ import org.eclipse.debug.core.model.IThread; import org.eclipse.debug.core.model.IVariable; /** - * Enter type comment. - * - * @since: Nov 13, 2002 + * Implementation of the dummy stack frame. */ -public class CDummyStackFrame extends CDebugElement implements IStackFrame, IDummyStackFrame -{ +public class CDummyStackFrame extends CDebugElement implements IStackFrame, IDummyStackFrame { + /** * Containing thread. */ @@ -31,198 +29,222 @@ public class CDummyStackFrame extends CDebugElement implements IStackFrame, IDum /** * Constructor for CDummyStackFrame. + * * @param target */ - public CDummyStackFrame( CThread thread ) - { + public CDummyStackFrame( CThread thread ) { super( (CDebugTarget)thread.getDebugTarget() ); setThread( thread ); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#getThread() */ - public IThread getThread() - { + public IThread getThread() { return fThread; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#getVariables() */ - public IVariable[] getVariables() throws DebugException - { + public IVariable[] getVariables() throws DebugException { return new IVariable[0]; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#hasVariables() */ - public boolean hasVariables() throws DebugException - { + public boolean hasVariables() throws DebugException { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#getLineNumber() */ - public int getLineNumber() throws DebugException - { + public int getLineNumber() throws DebugException { return 0; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#getCharStart() */ - public int getCharStart() throws DebugException - { + public int getCharStart() throws DebugException { return 0; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#getCharEnd() */ - public int getCharEnd() throws DebugException - { + public int getCharEnd() throws DebugException { return 0; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#getName() */ - public String getName() throws DebugException - { + public String getName() throws DebugException { return "..."; //$NON-NLS-1$ } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() */ - public IRegisterGroup[] getRegisterGroups() throws DebugException - { - return ((CDebugTarget)getDebugTarget()).getRegisterGroups(); + public IRegisterGroup[] getRegisterGroups() throws DebugException { + return new IRegisterGroup[0]; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() */ - public boolean hasRegisterGroups() throws DebugException - { - return ((CDebugTarget)getDebugTarget()).getRegisterGroups().length > 0; + public boolean hasRegisterGroups() throws DebugException { + return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStep#canStepInto() */ - public boolean canStepInto() - { + public boolean canStepInto() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStep#canStepOver() */ - public boolean canStepOver() - { + public boolean canStepOver() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStep#canStepReturn() */ - public boolean canStepReturn() - { + public boolean canStepReturn() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStep#isStepping() */ - public boolean isStepping() - { + public boolean isStepping() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStep#stepInto() */ - public void stepInto() throws DebugException - { + public void stepInto() throws DebugException { } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStep#stepOver() */ - public void stepOver() throws DebugException - { + public void stepOver() throws DebugException { } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.IStep#stepReturn() */ - public void stepReturn() throws DebugException - { + public void stepReturn() throws DebugException { } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ISuspendResume#canResume() */ - public boolean canResume() - { + public boolean canResume() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend() */ - public boolean canSuspend() - { + public boolean canSuspend() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended() */ - public boolean isSuspended() - { + public boolean isSuspended() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ISuspendResume#resume() */ - public void resume() throws DebugException - { + public void resume() throws DebugException { } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ISuspendResume#suspend() */ - public void suspend() throws DebugException - { + public void suspend() throws DebugException { } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ITerminate#canTerminate() */ - public boolean canTerminate() - { + public boolean canTerminate() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ITerminate#isTerminated() */ - public boolean isTerminated() - { + public boolean isTerminated() { return false; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.model.ITerminate#terminate() */ - public void terminate() throws DebugException - { + public void terminate() throws DebugException { } /** @@ -230,20 +252,20 @@ public class CDummyStackFrame extends CDebugElement implements IStackFrame, IDum * * @param thread the containing thread */ - protected void setThread( CThread thread ) - { + protected void setThread( CThread thread ) { fThread = thread; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) */ - public Object getAdapter( Class adapter ) - { + public Object getAdapter( Class adapter ) { if ( adapter.equals( IDummyStackFrame.class ) ) return this; if ( adapter.equals( IStackFrame.class ) ) return this; - return super.getAdapter(adapter); + return super.getAdapter( adapter ); } -} +} \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterGroup.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterGroup.java index a112ee80bf2..4a6c9a0165a 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterGroup.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegisterGroup.java @@ -89,14 +89,6 @@ public class CRegisterGroup extends CDebugElement implements IRegisterGroup { return register; } - public void resetChangeFlags() { - for ( int i = 0; i < fRegisters.length; ++i ) { - if ( fRegisters[i] != null ) { - ((CRegister)fRegisters[i]).setChanged( false ); - } - } - } - public void targetSuspended() { for ( int i = 0; i < fRegisters.length; ++i ) { if ( fRegisters[i] != null && ((CRegister)fRegisters[i]).hasErrors() ) { diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java index be7e0bb8ab2..08ee1986a77 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java @@ -216,14 +216,14 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart * @see org.eclipse.debug.core.model.IStackFrame#getRegisterGroups() */ public IRegisterGroup[] getRegisterGroups() throws DebugException { - return ((CDebugTarget)getDebugTarget()).getRegisterGroups(); + return ((CDebugTarget)getDebugTarget()).getRegisterGroups( this ); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStackFrame#hasRegisterGroups() */ public boolean hasRegisterGroups() throws DebugException { - return ((CDebugTarget)getDebugTarget()).getRegisterGroups().length > 0; + return ((CDebugTarget)getDebugTarget()).getRegisterGroups( this ).length > 0; } /* (non-Javadoc)