简体   繁体   中英

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. I can see the stack trace in the Eclispe debug view when I have the object selected in the Expressions view.

Is there anyway to debug calls from the Eclipse debugger to the toString() ? I tried setting breakpoints inside the toString() method and I put a global break point on all caught and uncaught RuntimeExceptions. But all breakpoints inside the toString() method is ignored and Eclipse never breaks on the line that generates the RuntimeException inside toString() .

It seems that i found the answer in an old Bug-thread for Eclipse:

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.

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,

I predict maybe you are trying to access toString from an un-instantiated variable.

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. so you might need to change you starting breakpoint and breakdown you code to lines and see where it is thrown.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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