如何在 Eclipse 的调试透视图中突出显示当前执行行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6537803/
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 16:32:23  来源:igfitidea点击:

How to highlight current line of execution in debug perspective in Eclipse

javaeclipse

提问by Viidhya

I would like to see the current execution line highlighted in green with arrow at the left in my Eclipse Debug perspective.

我希望在 Eclipse Debug 透视图中看到当前执行行以绿色突出显示,并在左侧带有箭头。

Unfortunately I don't know how to set it. I have seen it in some Eclipse platform and wondering if I can set it to display.

不幸的是我不知道如何设置它。我在某些 Eclipse 平台上看到过它,想知道是否可以将其设置为显示。

I am using Eclipse Ganymede 3.4.2.

我正在使用 Eclipse Ganymede 3.4.2。

回答by Tristan

In debug perspective, double click to the left of a line to set a break point. Once a break point is set, you can highlight running code line by line.

在调试视角中,双击一行的左侧以设置断点。设置断点后,您可以逐行突出显示正在运行的代码。

If it doesn't work as expected, just check your preferences here: Window > Preferences > General > Editors > All Text Editors > Annotations > Debug Call Stack and Debug Current Instruction Pointer

如果它没有按预期工作,只需在此处检查您的首选项: Window > Preferences > General > Editors > All Text Editors > Annotations > Debug Call Stack and Debug Current Instruction Pointer

回答by Andrew Lyubovsky

I just had to reboot eclipse, and everything started working perfectly.

我只需要重新启动 eclipse,一切都开始完美运行。

回答by Sami

Check your class path and be sure the project source directory is in there. If you are debugging an enterprise application clean temp and working directories and republish your application.

检查您的类路径并确保项目源目录在那里。如果您正在调试企业应用程序,请清除临时目录和工作目录并重新发布您的应用程序。

回答by Mallik

For others, if it can solve yours. I had similar issue. I see it highlighted, stopped at breakpoint. But I wasn't able to use step by step (F6) debug. Reason was that eclipse stopped due to break point and highlighted/selected top thread in debug.

对于其他人,如果它可以解决您的问题。我有类似的问题。我看到它突出显示,停在断点处。但我无法使用逐步 (F6) 调试。原因是 Eclipse 由于断点和在调试中突出显示/选择的顶级线程而停止。

So I selected current thread, by verifying one by one, till the current code(stopped due to breakpoint) highlighted.

所以我选择了当前线程,通过一一验证,直到当前代码(由于断点而停止)突出显示。

To see threads running add debug view if not shown. Window > Show view > Debug.

要查看正在运行的线程,请添加调试视图(如果未显示)。窗口 > 显示视图 > 调试。

This also helped me while debugging 2 threads separately on running programme.

这也有助于我在运行程序时分别调试 2 个线程。

There seems no short keys to locate current Thread from code stopped due to breakpoint.

似乎没有快捷键可以从由于断点而停止的代码中定位当前线程。

回答by busterroni

My problem was that I hadn't terminated the debugger. Clicking the button (shown in the screenshot below) and then running the debug again made the current line show up highlighted again.

我的问题是我没有终止调试器。单击按钮(如下面的屏幕截图所示),然后再次运行调试使当前行再次突出显示。

screenshot showing the terminate button

显示终止按钮的屏幕截图

回答by Samuel Andrian

DebugConfigurations > Source tab > Add... > Java Project > Select All (or select your project) > Ok > Ok > Apply Relaunch debugger

DebugConfigurations > Source 选项卡 > Add... > Java Project > Select All(或选择您的项目)> Ok > Ok > Apply Relaunch debugger

i just repost what Sudhanshu has writen, it worked very well for me.

我只是重新发布了 Sudhanshu 所写的内容,它对我来说效果很好。