* @param id stack frame id (0 is the bottom of the stack)
*/
public XDebugStackFrame(XDebugThread thread, int id, String type, int lineNumber, String where, /*URL*/String filename) {
- super(thread == null ? null : (XDebugTarget) thread.getDebugTarget());
+ super(/*thread == null ? null : */(XDebugTarget) thread.getDebugTarget());
fLevel = id;
fThread = thread;
public boolean setVariableValue(XDebugVariable variable, String expression) throws DebugException {
return ((XDebugTarget) getDebugTarget()).setVarValue("$" + variable.getName(), expression);
}
+
+ public Node eval(String expression) throws DebugException {
+ return ((XDebugTarget) getDebugTarget()).eval(expression);
+ }
}
\ No newline at end of file
import net.sourceforge.phpeclipse.xdebug.php.model.XDebugVariable;
-import net.sourceforge.phpeclipse.xdebug.php.model.XDebugTarget;
+import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IWatchExpressionDelegate;
import org.eclipse.debug.core.model.IWatchExpressionListener;
public class XDebugWatchExpressionDelegate implements IWatchExpressionDelegate {
public void evaluateExpression(String expression, IDebugElement context, IWatchExpressionListener listener) {
- IWatchExpressionResult x;
+ IWatchExpressionResult x = new XDebugWatchExpressionResult(expression, null, null);
- try {
- Node evalProperty = ((XDebugTarget) context.getDebugTarget()).eval(expression);
- XDebugVariable variable = new XDebugVariable(null, evalProperty);
- XDebugVariable result[] = {variable};
+ /* Active debug session */
+ if (context instanceof XDebugStackFrame) {
+ XDebugStackFrame frame = (XDebugStackFrame)context;
+ Node evalProperty = null;
- if (result.length == 0) {
- x = new XDebugWatchExpressionResult(expression, null, null);
- } else {
- x = new XDebugWatchExpressionResult(expression, result[0].getValue(), null);
- }
- } catch (Exception e) {
- String[] s1;
+ try {
+ evalProperty = frame.eval(expression);
+ } catch (Exception e) {
+ //
+ e.printStackTrace();
+ }
- s1 = new String[1];
- s1[0] = e.toString();
- x = new XDebugWatchExpressionResult(expression, null, s1);
+ XDebugVariable variable = null;
+ try {
+ variable = new XDebugVariable(frame, evalProperty);
+ x = new XDebugWatchExpressionResult(expression, variable.getValue(), null);
+ } catch (DebugException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
listener.watchEvaluationFinished(x);