Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea (debugging) conditional breakpoint dependent on other breakpoints

Tags:

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.

Is something like this possible in Idea?

Update:

Currently i'm working with this workaround:

  1. set the two breakpoints
  2. disable breakpoint #2
  3. start the debugger, wait until breakpoint #1 is active
  4. activate breakpoint #2

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

like image 905
klingt.net Avatar asked May 17 '13 11:05

klingt.net


People also ask

How do you set a conditional breakpoint?

To set a conditional breakpoint, activate the context menu in the source pane, on the line where you want the breakpoint, and select “Add Conditional Breakpoint”. You'll then see a textbox where you can enter the expression. Press Return to finish.

Is a conditional breakpoint that is not associated with any particular line but with a variable?

A more sophisticated approach uses dynamic (or "conditional") breakpoints. These are not bound to a particular line, but rather to a particular situation. When you run it, the PowerShell debugger will automatically stop the script whenever a new value is assigned to the variable $a.

What are conditional breakpoints How do you step through the code using breakpoints?

Conditional breakpoints allow you to break inside a code block when a defined expression evaluates to true. Conditional breakpoints highlight as orange instead of blue. Add a conditional breakpoint by right clicking a line number, selecting Add Conditional Breakpoint , and entering an expression.


1 Answers

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

enter image description here

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.

enter image description here

like image 200
maba Avatar answered Jan 03 '23 11:01

maba