简体   繁体   English

Eclipse Debugger toString()调用

[英]Eclipse Debugger toString() calls

I am debugging a Java code database (not mine) and in one class the toString() method is overriden, and it has the side effect of generating a RuntimeException. 我正在调试Java代码数据库(不是我的数据库),并且在一个类中, toString()方法被覆盖,并且它具有生成RuntimeException的副作用。 I can see the stack trace in the Eclispe debug view when I have the object selected in the Expressions view. 当我在“表达式”视图中选择了对象时,可以在Eclispe调试视图中看到堆栈跟踪。

Is there anyway to debug calls from the Eclipse debugger to the toString() ? 无论如何,有没有调试从Eclipse调试器到toString()调用? I tried setting breakpoints inside the toString() method and I put a global break point on all caught and uncaught RuntimeExceptions. 我尝试在toString()方法中设置断点,并在所有捕获和未捕获的RuntimeExceptions上放置了全局断点。 But all breakpoints inside the toString() method is ignored and Eclipse never breaks on the line that generates the RuntimeException inside toString() . 但是toString()方法内部的所有断点都将被忽略,并且Eclipse永远不会在toString()内部生成RuntimeException的行上中断。

It seems that i found the answer in an old Bug-thread for Eclipse: 看来我在Eclipse的旧Bug线程中找到了答案:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=12592 https://bugs.eclipse.org/bugs/show_bug.cgi?id=12592

Breakpoints are disabled when toString() is called in the detail pane, in the debug view, by the debugger. 当调试器在详细信息窗格的调试视图中调用toString()时,将禁用断点。

I can not see how it is not possible for eclipse to debug inside overridden toString method, perhaps the exception was never thrown from toString, 我看不到eclipse如何无法在覆盖的toString方法中进行调试,也许从来没有从toString抛出异常,

I predict maybe you are trying to access toString from an un-instantiated variable. 我预测也许您正在尝试从未实例化的变量访问toString。

Can you be please more specific or elaborate? 您能更具体还是更详细些? you can post your code though .. :) 您可以尽管发布代码.. :)

UPDATE: i assume breakpoint was not invoked by eclipse because error was throws even before the breakpoints was hit. 更新:我认为断点没有被eclipse调用,因为甚至在命中断点之前都会引发错误。 so you might need to change you starting breakpoint and breakdown you code to lines and see where it is thrown. 因此,您可能需要更改起始断点,并将代码分解为行,然后查看将其扔到何处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM