Master Advanced IntelliJ Debugging: Conditional Breakpoints, Drop Frame, Multithread & Remote Debugging

This guide walks you through powerful IntelliJ debugging techniques—including conditional breakpoints, the Drop Frame feature, multithread breakpoint control, remote JVM debugging setup, and on‑the‑fly expression evaluation—to help you troubleshoot complex Java applications efficiently.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
Master Advanced IntelliJ Debugging: Conditional Breakpoints, Drop Frame, Multithread & Remote Debugging

1. Conditional Breakpoints

When iterating over a large list, you can pause execution at a specific value by adding a condition to a breakpoint. Right‑click the red dot next to the breakpoint, choose Condition , and enter an expression such as i == 10. The debugger will stop only when the condition is true.

2. Drop Frame (Return to "Previous Step")

This feature is useful in deeply nested method calls. After stopping at a breakpoint inside method2, click the Drop Frame icon (red arrow) to discard the current stack frame and move the execution pointer back to the caller ( method1). Variables revert to their previous state, allowing you to re‑inspect earlier values without restarting the program.

3. Multithread Debugging

In a multithreaded environment, breakpoints may jump between threads, making it hard to follow a specific execution path. Set each breakpoint’s Suspend policy to Thread instead of All . Right‑click the red dot of each breakpoint, choose Suspend: Thread , then run the program. When a breakpoint hits, you can select the desired thread from the dropdown list (e.g., a thread named "Sky Bird") to view its stack and variables.

4. Remote Debugging

Remote debugging lets you attach IntelliJ to a JVM running on another machine without launching the project locally. Start the remote JVM with debug options, for example:

java -server -Xms512m -Xmx512m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9081 ${main_class}

Place these parameters before the -jar flag or the main class name. Ensure the remote port (e.g., 9081) is open and not conflicted. In IntelliJ, create a Remote run configuration with the same port, then set breakpoints in the source code. When the remote code reaches a breakpoint, execution will pause locally, allowing full inspection.

5. Evaluating Expressions & Modifying Variable Values

During a debugging session, you can evaluate arbitrary expressions on the fly. Click the + icon in the debugger’s console, type an expression such as i + 5, and press Enter to see the result instantly.

To change a variable’s value, right‑click the variable in the Variables pane, choose Set Value , enter the new value, and confirm. The program will continue with the updated state.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingJavaremote debuggingExpression EvaluationIntelliJConditional BreakpointDrop FrameMultithread
Code Ape Tech Column
Written by

Code Ape Tech Column

Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.