Accessing variable's instance through debug information


I'm trying to create plugin wich will allow to copy JSON representation of variable's or expression's instance from debug tool windows (variables, watches, inspection, etc.)
Using BaseValueAction from community edition sources I created own action, but I'm stuck with obtaining actual instance from com.sun.jdi.Value through DebugProcess

For example, I can call some method from ObjectReference by it's Method instance using following code:

result = debugProcess.invokeInstanceMethod(evaluationContext, objRef, method, Collections.emptyList(), 0);     

But how can I get instance of "this" for specified ObjectReference?
I just need to get whole expression value instance, not it's descriptor, to pass it to Gson

Can anyone help with this question?

Comment actions Permalink

Meanwhile I use workaround using recursive processiong of JDI references and JsonWritter
But it's very inconvenient, and looks like reinventing of wheel.
I have to add manual support for json-related annotations and a lot of other thigs that already implemented with normal json generation flow.


Please sign in to leave a comment.