如何在Eclipse中运行正在调试的程序时中断它?
如何在 Eclipse 中中断(暂停)Java 程序?
我不是在谈论断点。我说的是随机暂停一个程序而不知道它当前正在执行什么,就像在 Visual Studio 中一样。
How do you break (pause) a Java program in Eclipse?
I'm not talking about breakpoints. I'm talking about randomly pausing a program without knowing what it's currently executing, like in Visual Studio.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您在调试模式下启动程序,您可以手动切换到调试视角。
从那里,在调试窗格(通常显示线程和堆栈位置)中,按下暂停按钮(看起来像黄色 VCR 暂停按钮)。
通过调试启动器启动代码是一项要求,因为它使用参数初始化 JVM 以打开 JDI(或 Java 调试接口)。该接口可以通过网络路由,从而允许在嵌入式设备上进行远程调试。
在 Eclipse 场景中,Eclipse 程序在调试时通过 JDI 与子 JVM 进程进行通信,这就是您如何暂停、单步执行以及通常跟踪程序的方式。
-- 好吧,您在找到它时遇到了问题,我将从“顶部菜单”角度为您提供所有内容 ---
如果您想要一种更好的方法来仅停止“主”线程,请选择(在顶部的调试窗口中)左屏幕)挂起之前的“Thread [main]”。否则,您将停止 JVM 中的所有线程。
Assuming you launched the program in debug mode, you can manually switch to the debug perspective.
From there, in the debug pane (which normally shows you the threads and stack location), press the pause button (which looks like a yellow VCR pause button).
Launching the code via the debug launcher is a requirement, as it initializes the JVM with the arguments to turn on the JDI (or Java Debug Interface). This interface can be routed through networks, which allows for remote debugging on embedded devices.
In the Eclipse scenario, the Eclipse program communicates to the child JVM process via JDI when debugging, which is how you can pause, step, and generally trace your way through a program.
-- Ok, you had problems finding it, I'll give you everything from the "top menu" perspective ---
If you want a better way to stop just the "main" thread, select (in the debug window at the top left screen) the "Thread [main]" prior to suspending. Otherwise, you'll stop all the threads in the JVM.
在调试配置中启动程序(并非绝对必要),进入调试视图,只需选择要暂停的线程并单击暂停即可。
这会工作得很好,尽管准确地说我认为它仍然只会在警卫点暂停(尽管这并不重要,因为无论如何都有足够多的人)
Start the program in a debug configuration (well not absolutely necessary), go into the debug view and there just select the thread you want to pause and click suspend.
That'll work just fine, although to be exact I think it'll still only pause at guard points (although that hardly matters since there are more than enough of those anyway)