JDI 和 JPDA 中的 ObjectReference 底层对象

发布于 2024-10-01 14:28:47 字数 551 浏览 8 评论 0原文

非常具体地,在 JDI 和 JPDA 上下文中,我有以下问题:

  • 为什么 ObjectReference 不公开其底层对象?它基于某些规范吗?诸如 Eclipse 调试项目之类的所有实现是否都相同,不公开底层对象?

  • 考虑到您拥有来自 ObjectReferenceuniqueID() 的情况,有没有办法从 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() from ObjectReference, 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 from StackFrame information, but I really need the object reference not the internal values or structure of the fields.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多孤肩上扛 2024-10-08 14:28:47

为什么 ObjectReference 不公开其底层对象?

我假设您指的是 com.sun.jdi.ObjectReference 接口。如果是这样,那么它是两件事的结合:

  • 从表面上看,这是没有意义的。 ObjectReference 位于运行调试器的 JVM 中,但相应的 Java 对象存在于目标计算机上。

  • 假设它确实有意义,那么暴露实际的 pbject 地址和内存内容将是一件坏事。这将允许调试器对目标 JVM 执行一些会导致硬崩溃的操作。

考虑到您从 ObjectReference 获得 uniqueID() 的情况,有没有办法从 JVM 解析底层对象?

不。

如果上一个问题是否定的,那么解析底层对象的最佳方法是什么?

AFAIK,除了使用 JVM 工具接口用 C / C++ 编写自己的调试代理并配置目标 JVM 来运行它之外,没有办法做到这一点。

Why ObjectReference does not expose its underlying object?

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.

Considering the situation that you have the uniqueID() from ObjectReference, is there any way to resolve the underlying object from JVM?

No.

If no to the previous question, then what is the best way to resolve the underlying object?

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文