eclipse 无法删除某些断点

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

eclipse can't remove certain breakpoints

javaeclipsebreakpoints

提问by portforwardpodcast

Double-clicking in the blue bar on the left of eclipse sets a breakpoint. Double-clicking again removes the breakpoint. This works great for me but if I use git to checkout a different branch, often times the blue dots for breakpoints get "confused" or something. I can no longer double-click to unset them. I am forced to go into debug perspective, and find the breakpoint in the "breakpoints" view and then right click and remove. Does anybody have an easier solution for this? I am coding in java on windows 7 for what it's worth.

双击 eclipse 左侧的蓝色条设置断点。再次双击可删除断点。这对我很有用,但是如果我使用 git 来检查不同的分支,断点的蓝点经常会“混淆”或其他什么。我无法再双击来取消设置。我被迫进入调试视角,并在“断点”视图中找到断点,然后右键单击并删除。有没有人对此有更简单的解决方案?我正在 Windows 7 上用 Java 编码,以了解它的价值。

I can reproduce this bug with this code (assume the if is line 1):

我可以用这段代码重现这个错误(假设 if 是第 1 行):

if(bool)
{
  // comment
  doSomething();
} else {
  doOther();
}

I breakpoint on line 4 - doSomething(). Then I put a new line above the if to shift everything down. (moving the breakpoint on line 5). Then I do git stash save. When I click back to eclipse, the blue dot is displayed on the correct line, but the breakpoint window still says line 5. If I double click to disable, it actually adds a second breakpoint on line 4.

我在第 4 行断点 - doSomething()。然后我在 if 上方添加一个新行以将所有内容向下移动。(移动第 5 行的断点)。那我做git stash save。当我点回 eclipse 时,蓝点显示在正确的行上,但断点窗口仍然显示第 5 行。如果我双击禁用,它实际上在第 4 行添加了第二个断点。

I feel like I should report this to the Eclipse guys.

我觉得我应该向 Eclipse 人员报告这个问题。

采纳答案by user

Right click on the break point -> Disable break point. Should work. Also, if you click (in the same menu) on the "toggle breakpoint" again, it disappears fully; In the first case it just disables it, but it remains existing.

右键单击断点 -> 禁用断点。应该管用。此外,如果您再次单击(在同一菜单中)“切换断点”,它会完全消失;在第一种情况下,它只是禁用它,但它仍然存在。

回答by TheWhiteRabbit

open debugperspective [right conrer]

开放的debug视角[右conrer]

go to breakpoints

breakpoints

click clear all breakpoints[double X] or scroll until you find the breakpoint which doesn't want to go away and delete it.

单击clear all breakpoints[double X] 或滚动直到找到不想消失的断点并删除它。

回答by Ad Infinitum

None of the solutions here worked for me. Because I removed the breakpoints from breakpoints view but could not get rid of them in the editor. I think this is a kind of bug. What it worked for me is simply

这里没有一个解决方案对我有用。因为我从断点视图中删除了断点,但无法在编辑器中删除它们。我认为这是一种错误。它对我有用的只是

  1. Select the whole class (Ctrl+ a)

  2. Cut the whole class (Ctrl+ x)

  3. Paste it back (Ctrl+ v)

  1. 选择整个班级 ( Ctrl+ a)

  2. 剪掉整个班级 ( Ctrl+ x)

  3. 粘贴回去 ( Ctrl+ v)

Sometimes, the solution is easier than we think:)

有时,解决方案比我们想象的要容易:)

回答by Heshan

Goto Run -> Remove All Breakpoints. This will clear all breakpoints which cannot be removed individually.

转到运行-> 删除所有断点。这将清除所有无法单独删除的断点。

回答by SiggeLund

This happens to me sometimes. In the Debug Perspective there is a breakpoints tab. Even if breakpoints have become invisible in the editor, they are probable visible in that list. So you can safely remove the breakpoints that you want to get rid off.

这有时会发生在我身上。在 Debug Perspective 中有一个断点选项卡。即使断点在编辑器中变得不可见,它们也可能在该列表中可见。因此,您可以安全地删除要摆脱的断点。