eclipse line by line debugging [message #253501] |
Tue, 08 April 2008 16:38 |
Eclipse User |
|
|
|
Originally posted by: priyankascsharma.gmail.com
Hi,
I wanted to know if there is some way to debug my Java code in eclipse
line by line, similar to an interpreter as in C/C++.
If yes, can you please explain how to do it.
Thanks
Priyanka
|
|
|
|
|
|
Re: eclipse line by line debugging [message #1718434 is a reply to message #1233637] |
Wed, 23 December 2015 15:49 |
Christopher Hoffman Messages: 11 Registered: December 2015 |
Junior Member |
|
|
Alright there is one thing you can try...When you are running in debug mode all the threads java creates to execute your program appear in the top left box that says Debug.
If your project is rather large you don't have to worry much, but if your project is small and you want to see where the current execution point is, as soon as you begin running your program, and you have Eclipse running in debug mode, hit the Pause button on the GUI. This will stop the program execution and open the thread where the program currently is in execution.
You can then click on the different classes listed there to see where the thread is executing.
After you have your point of insertion, you can add more break points in those classes to assist you in seeing how the code works.
So if there is a method call in a loop add a break point at the function call, and Eclipse will add the values of the variables passed to the Variables window in the upper right and as the loop progresses you can watch all your objects being called and see them listed as variables in your screen,
I hope this helps you dealing with larger projects. There are tutorials for setting up in Debug mode, depending on how big your application is, you may have to do some leg work getting your code imported, and running your application in debug mode so Eclipse can remotely connect through the JVM. To setup your application to connect remotely in Mars, click Run->Debug Configurations->Browse for your project.
Next set the port to run on the Debug port that your application runs at, and click Debug, if all goes well you will see your layout change to the debug layout automatically, and all your running threads will be in the upper left screen, where you can now pause them for inspection. Depending on your application size, you may have to be quick to pause your application, where as if you have a GUI and there are pause states, you will have plenty of time to pause, inspect, and add break points.
This requires you have a working project with all your imported source, and you are running your application in Debug mode so Eclipse can connect to it on the JVM backend. Good luck!
-Chris
|
|
|
Powered by
FUDForum. Page generated in 0.07594 seconds