IntelliJ Idea(调试)条件断点依赖于其他断点

时间:2023-01-18 08:25:47

I want to set a debug breakpoint in IntelliJ Idea that is only active, if another previous breakpoint was activated. For example i have a breakpoint B1 on line 10, and another breakpoint B2 on line 20. Even if B2s condition is true, the debugger should only halt if B1s condition was true before B2s.

我想在IntelliJ Idea中设置一个只有活动的调试断点,如果激活了另一个先前的断点。例如,我在第10行有一个断点B1,在第20行有另一个断点B2。即使B2s条件为真,调试器也应该只在B2s之前B1s条件为真时停止。

Is something like this possible in Idea?

在Idea中有可能是这样的吗?

Update:

更新:

Currently i'm working with this workaround:

目前我正在使用此解决方法:

  1. set the two breakpoints
  2. 设置两个断点
  3. disable breakpoint #2
  4. 禁用断点#2
  5. start the debugger, wait until breakpoint #1 is active
  6. 启动调试器,等到断点#1处于活动状态
  7. activate breakpoint #2
  8. 激活断点#2

I hope there is a cleaner way to do this :)

我希望有一个更清洁的方法来做到这一点:)

1 个解决方案

#1


22  

You can do that in the View Breakpoints... view:

您可以在View Breakpoints ...视图中执行此操作:

IntelliJ Idea(调试)条件断点依赖于其他断点

In your case you will first have to set a conditional breakpoint on B1 so that when it is hit then and only then B2 will be triggered.

在你的情况下,你首先必须在B1上设置一个条件断点,这样当它被击中时,只有B2才会被触发。

IntelliJ Idea(调试)条件断点依赖于其他断点

#1


22  

You can do that in the View Breakpoints... view:

您可以在View Breakpoints ...视图中执行此操作:

IntelliJ Idea(调试)条件断点依赖于其他断点

In your case you will first have to set a conditional breakpoint on B1 so that when it is hit then and only then B2 will be triggered.

在你的情况下,你首先必须在B1上设置一个条件断点,这样当它被击中时,只有B2才会被触发。

IntelliJ Idea(调试)条件断点依赖于其他断点