ObjectReference object located in JDI and JPDA

In particular, in the context of JDI and JPDA , I have the following questions:

  • Why ObjectReferencedoes not disclose its main object? Is it based on some specifications? Are all implementations like the Eclipse Debug Project the same as not displaying the underlying object?

  • Given that you have uniqueID()from ObjectReference, is there a way to resolve the underlying object from the JVM ?

  • If not in the previous question, what is the best way to resolve the underlying object? I must add that I am familiar with how Valueto get StackFrameinformation from it, but I really need a reference to the object, not internal values ​​or the structure of the fields.

+3
source share
1 answer

Why doesn't the ObjectReference reveal its main object?

I assume you mean the interface com.sun.jdi.ObjectReference. If so, this is a combination of two things:

  • At first glance, this does not make sense. The ObjectReference is in the JVM starting the debugger, but the corresponding Java object exists on the target machine.

  • Assuming this makes sense, then it would be bad to expose the actual pbject addresses and the contents of the memory. This will allow the debugger to do something with the target JVM, which will lead to hard crashes.

Given that you have a uniqueID () from an ObjectReference, is there a way to resolve the underlying object from the JVM?

No.

If not in the previous question, what is the best way to resolve the underlying object?

AFAIK, , C/++ JVM Tool Interface JVM .

+2

Source: https://habr.com/ru/post/1774533/


All Articles