Eclipse tip debugging in eclipse
This presentation is the property of its rightful owner.
Sponsored Links
1 / 9

Eclipse Tip – Debugging in Eclipse PowerPoint PPT Presentation


  • 107 Views
  • Uploaded on
  • Presentation posted in: General

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

Download Presentation

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


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

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


The debugger in eclipse

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


The debugger in eclipse1

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


Setting a breakpoint

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


Breakpoints

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”


Debugging perspective

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


Eclipse tip debugging in eclipse

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


Eclipse tip debugging in eclipse

Step over

Step into

Hover mouse over variable to see its value

Tooltip with value


  • Login