如何设置 Eclipse 观察点在对象/基元更改时激活?
我现在正在尝试重构一些相当可怕的代码。它以一种非常复杂的方式传递对象,我无法跟踪并且显然直接访问代码中其他位置的对象内的原语。我试图弄清楚如何使用调试器来找出我感兴趣的对象在传递到传递这些对象的令人困惑的代码黑匣子后何时/何处被使用。
我想要的是一种设置观察点的方法,该观察点在修改对象(或基元)时会中断。我知道可以在变量上设置观察点,但这不是我想要的。指向我感兴趣的对象的变量在函数调用结束时消失,我想要一种方法在该函数返回后继续跟踪该对象。
谁能告诉我Eclipse有这个功能吗?我正在使用赫利俄斯。
谢谢
I'm trying to refactor some rather horrible code at the moment. It's passing around objects in a very convoluted manner I can't keep track of and apparently directly accessing primitives within the objects at some other location in the code. I'm trying to figure out how I can use the debugger to find out when/where an object I'm interested in is used after it gets passed into the confusing black box of code which passes these objects.
What I would like is a way to set a watchpoints that breaks when an Object (or primitive) is modified. I know that watchpoints can be set on variables, but this isn't what I want. The variable pointing to the object I'm interested in disappears at the end of the function call, I want a way to continue to track the object after this function returns.
Can anyone tell me if Eclipse has this functionality? I'm using Helios.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在您感兴趣的类的每个字段上设置观察点。
或者,您可以使用调用层次结构查找源中引用某个字段的所有位置(单击该字段,然后按 Ctrl-Alt-H)。这样做的优点是,您不仅可以查找在程序的特定执行中访问该字段的位置,还可以查找所有可能的执行。
请注意,这两种方法都不会注意到是否使用反射访问该字段。
You can set a watchpoint on each field of the class you are interested in.
Alternatively, you can find all places in the source referring a certain field by using the call hierarchy (click on the field, and press Ctrl-Alt-H). This has the advantage that you are not only finding where the field is accessed in a particular execution of the program, but for all possible executions.
Note that neither method will notice if the field is accessed using reflection.