JDI 和 JPDA 中的 ObjectReference 底层对象
非常具体地,在 JDI 和 JPDA 上下文中,我有以下问题:
为什么
ObjectReference
不公开其底层对象?它基于某些规范吗?诸如 Eclipse 调试项目之类的所有实现是否都相同,不公开底层对象?考虑到您拥有来自
ObjectReference
的uniqueID()
的情况,有没有办法从 JVM 解析底层对象?< /p>如果上一个问题是否定的,那么解析底层对象的最佳方法是什么?我应该补充一点,我熟悉如何从
StackFrame
信息中获取Value
,但我确实需要对象引用 不是字段的内部值或结构。
Very specifically, in JDI and JPDA context, I have the following questions:
Why
ObjectReference
does not expose its underlying object? Is it based on some specification? Are all implementations such as Eclipse Debug Project the same that do not expose the underlying object?Considering the situation that you have the
uniqueID()
fromObjectReference
, is there any way to resolve the underlying object from JVM?If no to the previous question, then what is the best way to resolve the underlying object? I should add that I am familiar with how
Value
's can be obtained fromStackFrame
information, but I really need the object reference not the internal values or structure of the fields.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您指的是 com.sun.jdi.ObjectReference 接口。如果是这样,那么它是两件事的结合:
从表面上看,这是没有意义的。 ObjectReference 位于运行调试器的 JVM 中,但相应的 Java 对象存在于目标计算机上。
假设它确实有意义,那么暴露实际的 pbject 地址和内存内容将是一件坏事。这将允许调试器对目标 JVM 执行一些会导致硬崩溃的操作。
不。
AFAIK,除了使用 JVM 工具接口用 C / C++ 编写自己的调试代理并配置目标 JVM 来运行它之外,没有办法做到这一点。
I am assuming that you are referring to the
com.sun.jdi.ObjectReference
interface. If so, it is a combination of two things:On the face of it, it wouldn't make sense. The ObjectReference is in the JVM running the debugger, but the corresponding Java object exists on the target machine.
Assuming that it did make sense, then it would be a bad thing to expose the actual pbject addresses and memory contents. This would allow the debugger to do things to the target JVM that would lead to hard crashes.
No.
AFAIK, there is no way to do this, apart from writing your own debug agent in C / C++ using the JVM Tool Interface and configuring the target JVM to run it.