Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-debug-dev] Evaluation engines

> Hi,
> I need to do evaluations programatically in the context of a stack frame 
of 
> the suspended JVM. For this purpose, I have been using Eclipse's AST 
> evaluation engine. But my code is a little more demanding than typical 
> snippets in the expression view, in fact it is arbitary java code. In my 

> opinion, because of its interpreting nature, AST EE will never be able 
to 
> execute the code 100% correctly as it would have been executed by the 
VM.

Correct - AST evaluations are interpretted, and do no run exactly as if 
executed by the VM. However, there are many benefits to this approach - it 
works on VMs that do not support hot swap, regardless of their location 
(remote/local), class loaders, and classpath. It requires no extra support 
code to be running in the debuggable VM (besides the debug/tools agent).

> So I was thinking about using the LocalEvaluationEngine instead. But I 
ran 
> into a couple of obvious problems, one of them is 
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=267561 , suggesting that 
Local 
> EE hasn't been updated / used in a while. In fact, I discovered that 
only 
> java snippet editor is still using it, and in a limited fashion (never 
in a 
> context of a stack frame).
> My question is: do you have plans to update / fix Local EE? Or you have 
> stopped developing it?

Thanks for the report - we will try to look at the bug.

The Local evaluation engine is used only by the scrapbook. It works by 
compiling and deploying class files locally with a known name, known entry 
point (method), in a known location so the class loader of a launched VM 
can find the classes. This only works in a controlled environment.

> I have an idea for a new evaluation engine, which would be based on hot 
code 
> replace. It would be 100% correct, but it would require a dummy method 
in a 
> class to operate on it's stack frames :-) (since JVM does not support 
adding 
> new methods to classes). This makes it useless to be used generally, but 
for 
> my own domain it might not be a big issue. Any input on this??

Hot swap only works in certain situations as well, and that is why we do 
not use it to perform debugger evaluations. As you suggest, it could be 
used for a specific use case in a controlled environment.

Darin Wright



Back to the top