1

在调试期间,例如在 Eclipse 中,可以评估观察表达式或条件断点。通常,这些是在客户端进行评估的。例如,在 Eclipse 中进行调试时,是 Eclipse 本身而不是调试目标 VM 来评估这些表达式。这可能非常昂贵,尤其是在条件断点的情况下,因为调试 VM(即 Eclipse)需要在每个断点命中时变为活动状态,即使条件评估为假。

我现在的问题是调试协议是否允许它改为在调试目标 VM 中评估此类表达式或条件断点,以便目标 VM 仅在表达式/条件真正评估为 TRUE 时通知调试 VM。

4

1 回答 1

0

Apart from the IDE (ab)using Hot Code Replacement to replace the method body by a body with an empty if block and putting the (conditional) breakpoint in there, I cannot find anything in http://download.oracle.com/javase/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html that might help for doing this.

There is an exprId in EventRequest.Set which is documented as "for the future" and not exposed wia JDI BreakpointRequest, so I don't think this has or will ever work.

By the way, the evaluation happens inside the target VM (i. e. if you use equals() in your expression, equals() will run in your target vm), but the evaluation will be triggered from the debugging VM.

于 2011-09-01T17:48:35.603 回答