Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I drag execution point in IntelliJ (I can in Visual Studio)

In Visual Studio, when debugging, one can drag the execution point (current instruction pointer, yellow dot) to another place in the current method.

This is impossible in IntelliJ, and some have stated it's generally impossible in Java. Why?

like image 640
ripper234 Avatar asked Jun 21 '09 07:06

ripper234


People also ask

How do I move the Debug pointer in IntelliJ?

If you press and hold the Ctrl / ⌘ button while dragging the arrow, the IDE will highlight all the lines in green. When you drop the arrow, you won't jump to the line of code. Instead, the IDE will act as if you have used the Run to Cursor (⌥F9) action.

How do I move the Debug pointer in Visual Studio?

With the debugger paused on a line of code, use the mouse to grab the yellow arrow pointer on the left. Move the yellow arrow pointer to a different point in the code execution path. Then you use F5 or a step command to continue running the app.

What is run to cursor in IntelliJ?

Run to Cursor If line numbers are displayed in the editor, and Click line number to perform run to cursor is enabled on the Build, Execution, Deployment | Debugger page of JetBrains Rider settings Ctrl+Alt+S , you can run to this line by clicking its line number.

What is drop frame IntelliJ?

IntelliJ IDEA lets you fall back to a previous stack frame in a program's execution flow. This can be useful, for example, if you've mistakenly stepped too far, or want to re-enter a method where you missed a critical spot. Click the Drop Frame icon. on the toolbar of the Debug tool window.


1 Answers

IntelliJ interacts with a running JVM through the standard Java debugging interface, so it can debug programs' against different JDKs. This does not support moving the execution point around as you describe.

It does let you wind the call stack back and perform a method call again. In IntelliJ, use the threads window to select a stack frame of a suspended thread and wind back to it. Then continue the thread to re-call the method at that point in the program.

Note: this will not roll back the state of the objects, so strange effects may occur.

like image 138
Nat Avatar answered Oct 01 '22 15:10

Nat