0

我目前正在开发一个增强调试可能性的 Eclipse 插件。在调试会话期间,我通过以下方式调用 Scala 方法com.sun.jdi.ObjectReference#invokeMethod

public int callMethod_Reactive_Level(final ObjectReference o) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException {
    final Method m = apiValues.getMethod_Reactive_level(o); // com.sun.jdi.Method
    final IntegerValue intVal = (IntegerValue) o.invokeMethod(thread, m, new LinkedList<Value>(), ObjectReference.INVOKE_SINGLE_THREADED);
    return intVal.intValue();
}

之后,调用 toorg.eclipse.debug.core.model.IVariable#getValue会导致InvalidStackFrameException. 整个错误信息是:

Status ERROR: org.scala-ide.sdt.debug code=5010 Exception while retrieving variable's value com.sun.jdi.InvalidStackFrameException

Exception while retrieving variable's value当我在调用如上所示的方法后检查变量视图中的变量时,会显示该消息。

知道如何解决这个问题吗?我不明白为什么会有这么大的问题,因为 JDI 明确地提供了这样做的可能性。

更新:由于它可能是 Scala IDE 中的错误,因此在Scala IDE 开发组中有一个讨论和教程如何重现该问题。

4

1 回答 1

1

错误消息似乎来自 Scala IDE 实现IVariable.getValue。它委托给StackFrame.getValue抛出的 JDI。根据文档,“如果此堆栈帧变得无效,则可能发生这种情况。一旦帧的线程恢复,堆栈帧将不再有效。”

我的猜测是invokeMethod在同一个线程上执行会使堆栈帧无效。

于 2014-05-21T11:48:34.837 回答