DataGrip 2024.3 Help

Step through the program

Stepping is the process of controlling step-by-step execution of the program.

DataGrip provides a set of stepping actions, which are used depending on your strategy, such as whether you need to go directly to the next line or inspect the intermediate method calls as well.

The stepping buttons are located on the Debug window toolbar.

Stepping buttons in the Debug tool window

Step over

Steps over the current line of code and takes you to the next line even if the highlighted line has method calls in it. The implementation of the methods is skipped, and you move straight to the next line of the caller method.

  • Click the Step Over button Step Over button or press F8.

Step into

Enters the method to show what happens inside it. Use this option when you are not sure the method is returning a correct result.

  • Click the Step Into button Step Into button or press F7.

Step out

Steps out of the current method and takes you to the caller method.

  • Click the Step Out button Step Out button or press Shift+F8.

In the example, stepping out skips all iterations of the loop and takes you straight to the main method (the caller) .

Run to cursor

Continues the execution until the position of the caret is reached.

  1. Place the caret at the line where you want the program to pause.

  2. Select Run to Cursor from the menu or press Alt+F9.

Also, you can Run to Cursor by hovering over the line and clicking the Run to Cursor icon.

Run to Cursor with a single click

You can configure whether you want Run to Cursor to work on clicking a line number in Settings | Tools | Debugger.

When a breakpoint is reached , the Debug tool window becomes active and enables you to get control over the program's execution. For this purpose, you can use the Run menu commands, or the icons on the stepping toolbar of in the Debug tool window.

Each stepping action advances the execution point to the next execution location, depending on the action you choose.

Stepping modes

When you debug PL/SQL code, you can select between two stepping modes: Graceful and Native.

In Graceful mode, you can pause the session that you debug (the target session), set and remove breakpoints. If no valid breakpoints are set, the debugger steps through code on a line-by-line basis.

In Native mode, the debugger uses Oracle native debugging commands. You cannot pause the target session or manage breakpoints but you might experience a boost in performance in CPU-intensive operations (operations that include a lot of computations and loops). You can read more about Oracle debugging commands in the official Oracle documentation. If no valid breakpoints are set, the debugger executes the whole routine.

Change the stepping mode

  1. Open settings (Ctrl+Alt+S) and navigate to Tools | Debugger | Stepping.

  2. From the Stepping mode list, select the stepping mode that you need.

Pause at the beginning of debuggable code

You can force the debugger to pause at the beginning of debuggable code. The place where the debugger pauses is detected automatically. If you assign variable values in the declaration section, the debugger pauses at the variable declaration. If no values are assigned to variables, the debugger skips the declaration section and pauses at the BEGIN keyword in the execution section.

  1. Open settings (Ctrl+Alt+S) and navigate to Tools | Debugger | Stepping.

  2. Select Pause at begin.

Pause at the beginning of debuggable code
Last modified: 14 November 2024