Javatpoint Logo
Javatpoint Logo

JDB Stepping

Stepping is a very common method of debugging that executes the code line by line. So, this approach can be used when there is a requirement to check one line at a time. It simply controls the flow of program.

Techniques of Stepping

There are three techniques of stepping:-

  • Step Over
  • Step Into
  • Step Return

Step Over

In this approach, the particular line where the program is paused will get executed and now the program will paused on the next line.

Step Into

In this technique, debugger entered into the method and start debugging line by line by using step over approach.

Step Return

Once the method is debugged, step return is used to exit the control of program from that particular method.

Through this example, we will try to understand the JDB stepping.

JStep.java

  • Compile the above program and create a JDB session.
  • Now, set the breakpoints.
  • Run the debugger by using the following command: -
jdb Stepping run JStep
  • Now use the following command to step up the execution to next line: -
jdb Stepping step
  • Then use the below command to find out the position where the control has been reached.

If you notice in the below screenshot, the arrow (=>) indicates the current position of program control.

jdb Stepping list
  • To continue the execution of code follow the below command
jdb Stepping cont
Next TopicJDB Options




?

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA