1 / 9

Eclipse Tip – Debugging in Eclipse

Eclipse Tip – Debugging in Eclipse. Using the Debugger in Eclipse to Find and Fix Run-Time Errors. Run-time and Logic Errors. Eclipse provides help in correcting errors at compile-time through messages, tooltips, and other approaches

gerry
Télécharger la présentation

Eclipse Tip – Debugging in Eclipse

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Eclipse Tip – Debugging in Eclipse Using the Debugger in Eclipse to Find and Fix Run-Time Errors

  2. Run-time and Logic Errors • Eclipse provides help in correcting errors at compile-time through messages, tooltips, and other approaches • This presentation focuses on the other common types of errors: run-time errors • Program exceptions (crashes) • Logic errors: the program runs but produces incorrect results

  3. The Debugger in Eclipse • Often, the causesof logic errors and even program crashes can be determined by “watching the program run” one line at a time • Step through the program by executing one line at a time and watch the results of each line as it executes • When something unexpected happens, we have identified a segment of the program that requires additional attention

  4. The Debugger in Eclipse • The Debugger in Eclipse allows us to execute parts of a program at full speed, pause on certain lines (called breakpoints), and execute subsequent code one line at a time • When paused at a breakpoint or executing one line at a time, the debugger allows us to inspect the current values of variables, arrays, ArrayLists, and so forth in scope at the moment • This is a “snapshot” at that point in the program

  5. Setting a Breakpoint • Select a line of executable code where you want the program to pause • Double-click in the left-margin of the editor to set a breakpoint Blue ball indicates a breakpoint on this line

  6. Breakpoints • You may set as many breakpoints as you wish • Breakpoints can only be set on lines that are executable (not comments, blank lines, etc.) • Breakpoints can be toggledoff by double-clicking on the blue ball • Breakpoints have no effect when executing the program normally • Executionpauses at every breakpoint when in “debuggingmode”

  7. Debugging Perspective • Normally, when editing and testing a program, Eclipse is in the Java Perspective and looks as you have come to expect • When debugging, the appearance of Eclipse changes to the DebugPerspective • One can go back to the normal JavaPerspective by clicking the Javabutton in the upper right corner of the Eclipsewindow

  8. Now in Debug Perspective Click this button to run the program in “Debug Mode” Return to Java Perspective Values of relevant variables shown here Execution paused here

  9. Step over Step into Hover mouse over variable to see its value Tooltip with value

More Related