IDE Tutorials CSE 219 Fall 2005


  TOC: AkA Tactical Operations Center
Table of Contents: NetBeans Eclipse
Basics Tutorial NetBeans Eclipse
Debugging Tutorial NetBeans Eclipse
JUnit Testing Tutorial NetBeans Eclipse
CVS Tutorial NetBeans Eclipse
JAR Files Tutorial NetBeans Eclipse
CSE 219 HomePage

Eclipse Debugging

This tutorial is to help students get acquainted with some key concepts of debugging and how to use a debugger.

http://www.eclipse.org/

  The Opening
This is our familiar eclipse environment. We will start the tutorial here by opening up a project we wish to debug.




  Setting a Debug Profile
The first thing we need to do it setup a debug profile for our project to do this we click the triangle next to the bug icon on the tool bar then click debug. This will popup our next window.




  Enter the Profile
Just Like our run profile we can create a new config for running the application. To do this we click new for java application and then browse for our project then click search to find all of our main classes.




  Placing a breakpoint
A break point is a debugging mechanism which tells the program that when you reach this point you want to stop the program. To set a break point you goto the line of code that you wish to set it on and then right click on the blue bar where the line is and click toggle breakpoint. After this click on the debug perspective to put us into the mode for debugging.




  The Debug Perspective
This is the debug perspective if you notice we have our code windows at the bottom and two more windows on the top. The top left window will show us all running applications and the stack for it. On the top right we will see our variables and also our breakpoints and expessions.




  Let the Debugging Bein
To start debugging the application hit the bug icon and it will run the last debug configuration. If you had several configurations you could click the triangle next to it and then click on the profile you would like.




  Information Glorious Information
You may have noticed that the program has stopped executing and now we have all this awsome information. You can see in the upper left the main program and what it has called and in the top right our local variables. In addition to this the line with the breakpoint is green. This means that this is the next line that will be executed.




  Stepping Into it
We have several operations we can perform. One of the more basic of them are the step operations. you can step into a function which means you will go to the next line of the code and if it is a function call it will now go into that function. Likewise if you want to keep stepping witout going into a function you can use step over to execute the line and move on without entereing the function.




  Stepping Out
Assuming we used step into to get into a function call and started debugging in there we can now use a corresponding step called return. This will finish executing the rest of the function that you are currently in and will place you on the next line to be executed after the function.




  Resume Executing
Lets assume we are done stepping through our code and we want to finish executing the program. To do this we click the resume button which is located in our top left window.




  The End
Alternatly if we do not want to debug anymore and we dont want the program to end or it never does end you can just hit the terminate button which is located to the right of our resume button in the top left window.




  Questions Comments Complaints?
If you have any questions or a way to make the tutorials better please speak with me or email me at dquigley at ic dot sunysb dot edu



(c) David Quigley