diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/IStackFrameInfo.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/IStackFrameInfo.java new file mode 100644 index 00000000000..7d5031a6f8e --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/IStackFrameInfo.java @@ -0,0 +1,54 @@ +/* + *(c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ + +package org.eclipse.cdt.debug.core; + +/** + * + * Provides the access to the stack frame information. + * + * @since Aug 16, 2002 + */ +public interface IStackFrameInfo +{ + /** + * Returns the address of this stack frame. + * + * @return the address of this stack frame + */ + long getAddress(); + + /** + * Returns the source file of this stack frame or null + * if the source file is unknown. + * + * @return the source file of this stack frame + */ + String getFile(); + + /** + * Returns the function of this stack frame or null + * if the function is unknown. + * + * @return the function of this stack frame + */ + String getFunction(); + + /** + * Returns the line number of this stack frame or 0 + * if the line number is unknown. + * + * @return the line number of this stack frame + */ + int getFrameLineNumber(); + + /** + * Returns the level of this stack frame. + * + * @return the level of this stack frame + */ + int getLevel(); +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java index 3ca37ab2d3c..b490919d3aa 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java @@ -47,6 +47,8 @@ public interface ICDIStackFrame extends ICDIObject /** * Returns the level of the stack frame. + * + * @return the level of the stack frame */ int getLevel(); } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CStackFrame.java index e2584436e7a..8a49c55b6b9 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CStackFrame.java @@ -3,21 +3,20 @@ * All Rights Reserved. * */ + package org.eclipse.cdt.debug.internal.core; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Iterator; import java.util.List; +import org.eclipse.cdt.debug.core.IStackFrameInfo; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; -import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; -import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.debug.core.DebugException; @@ -33,7 +32,8 @@ import org.eclipse.debug.core.model.IVariable; * @since Aug 7, 2002 */ public class CStackFrame extends CDebugElement - implements IStackFrame, + implements IStackFrame, + IStackFrameInfo, ICDIEventListener { /** @@ -484,8 +484,6 @@ public class CStackFrame extends CDebugElement */ protected static boolean equalFrame( ICDIStackFrame frameOne, ICDIStackFrame frameTwo ) { - //return ( frameOne.getParent().equals( frameTwo.getParent() ) && - // frameOne.getLocation().equals( frameTwo.getLocation() ) ); return ( frameOne != null && frameTwo != null && frameOne.getLocation().equals( frameTwo.getLocation() ) ); } @@ -507,6 +505,10 @@ public class CStackFrame extends CDebugElement { return getCDIStackFrame(); } + if ( adapter == IStackFrameInfo.class ) + { + return this; + } return super.getAdapter( adapter ); } @@ -576,4 +578,42 @@ public class CStackFrame extends CDebugElement ((CVariable)it.next()).dispose(); } } + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getAddress() + */ + public long getAddress() + { + return getCDIStackFrame().getLocation().getAddress(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFile() + */ + public String getFile() + { + return getCDIStackFrame().getLocation().getFile(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFunction() + */ + public String getFunction() + { + return getCDIStackFrame().getLocation().getFunction(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getLevel() + */ + public int getLevel() + { + return getCDIStackFrame().getLevel(); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.IStackFrameInfo#getFrameLineNumber() + */ + public int getFrameLineNumber() + { + return getCDIStackFrame().getLocation().getLineNumber(); + } }