在IntelliJ IDEA中进行调试时,如何防止变量在线程暂停时受到影响?

huangapple go评论77阅读模式
英文:

When debugging in IntelliJ IDEA, how do I prevent variables from being affected while the thread is suspended?

问题

抱歉,标题可能有些混乱,但我对手头的问题感到困惑。

目前,在我通过调试器运行我的简单程序时,当我逐步执行程序时,刚刚设置的变量会变成 null。然后这会影响我正在逐步执行的其余代码行。

当正常运行程序时,它完全正常地按预期工作。就好像在调试暂停的时候,Java 将其视为垃圾进行回收,而在正常运行时,变量的活动使用会阻止这种情况。

步骤 1:

在IntelliJ IDEA中进行调试时,如何防止变量在线程暂停时受到影响?

步骤 2:

在IntelliJ IDEA中进行调试时,如何防止变量在线程暂停时受到影响?

英文:

Sorry for the confusing titles but I confused on the issue at hand.

Currently when I run my simple program through the debugger, as I step through the program the variables that were just set are changed to null. This then affects the rest of the lines I am stepping through.

When running the program regularly it works perfectly normal and as expected. It's almost as if java is collecting it as garbage while the program is suspended in debug and when it runs normally, the active use of the variables prevents this.

Step 1:

在IntelliJ IDEA中进行调试时,如何防止变量在线程暂停时受到影响?

Step 2:

在IntelliJ IDEA中进行调试时,如何防止变量在线程暂停时受到影响?

答案1

得分: 2

禁用设置(macOS上的首选项)| 构建、执行、部署 | 调试器 | 数据视图 | Java | 启用 'toString()' 对象视图。

英文:

Disable Settings (Preferences on macOS) | Build, Execution, Deployment | Debugger | Data Views | Java | Enable 'toString()' object view.

huangapple
  • 本文由 发表于 2020年10月15日 04:52:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/64361338.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定