Eclipse 调试器中的 toString() 不可用错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1972682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:15:28  来源:igfitidea点击:

toString() unavailable error in Eclipse debugger

javaeclipsedebuggingtostring

提问by Miss Cellanie

While stepping through a method using the Eclipse debugger, I started seeing "toString() unavailable - no suspended threads" for all the variables I wanted to inspect.

在使用 Eclipse 调试器逐步执行一个方法时,我开始看到我想要检查的所有变量的“toString() 不可用 - 没有挂起的线程”。

Why did I get that error, and what should I do next to narrow down the problem in my code?

为什么我会收到那个错误,接下来我应该怎么做来缩小代码中的问题?

editMy code does create a new process, but the variables I wanted to examine exist in the main application thread, and that thread didn't appear dead (in the Debug panel or the Console).

编辑我的代码确实创建了一个新进程,但我想检查的变量存在于主应用程序线程中,并且该线程没有出现死机(在调试面板或控制台中)。

I'm using Eclipse 3.4.

我正在使用 Eclipse 3.4。

采纳答案by Eli Acherkan

I can think of a few scenarios when a method (in particular, toString()) would be unavailable:

我可以想到一些方法(特别是toString())不可用时的场景:

  • When the execution is suspended by pressing the "Suspend" button (the one with the "pause" icon), as opposed to reaching a breakpoint.
  • When you've reached a breakpoint, and you're in the middle of evaluating an expression.
  • 当通过按下“暂停”按钮(带有“暂停”图标的按钮)暂停执行时,而不是到达断点。
  • 当您到达断点时,您正处于对表达式求值的过程中。

In any case, even with toString()unavailable, you should be able to inspect the current values in the upper part of the "Variables" view.

在任何情况下,即使toString()不可用,您也应该能够检查“变量”视图上部的当前值。

Also, try looking at the relevant preferences (Window → Preferences → Java → Debug), in particular the ones under "Detail Formatters". You can also try the "Restore Defaults" button.

此外,尝试查看相关首选项(窗口 → 首选项 → Java → 调试),尤其是“详细信息格式器”下的首选项。您也可以尝试“恢复默认值”按钮。

回答by Joe Daley

This sounds like a bug in early versions of Eclipse 3.1: https://bugs.eclipse.org/bugs/show_bug.cgi?id=81249

这听起来像是 Eclipse 3.1 早期版本中的一个错误:https: //bugs.eclipse.org/bugs/show_bug.cgi?id=81249

Try upgrading your Eclipse?

尝试升级您的 Eclipse?