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.

  • 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

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA