Using a Debugger - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Using a Debugger

Description:

Sometimes you have to track down the problem. A Debugger can be a big help ... A debugger lets you step through your code line by line, statement by statement ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 13
Provided by: davidlm3
Category:
Tags: byline | debugger | using

less

Transcript and Presenter's Notes

Title: Using a Debugger


1
Using a Debugger
2
About Debuggers
  • Bugs happen
  • Sometimes you can figure the problem out right
    away
  • Sometimes you have to track down the problem
  • A Debugger can be a big help
  • Sometimes its exactly the tool you need
  • Sometimes it isnt
  • Debuggers are all basically pretty much alike
  • If you know one, you know them all
  • BlueJ comes with a nice, simple debugger that
    gives you all the most important functionality
  • Unfortunately, BlueJs debugger is crash-prone

3
What a debugger does
  • A debugger lets you step through your code line
    by line, statement by statement
  • At each step you can examine the values of all
    your variables
  • You can set breakpoints, and tell the debugger to
    just continue (run full speed ahead) until it
    reaches the next breakpoint
  • At the next breakpoint, you can resume stepping

4
Setting a breakpoint
5
Reaching a breakpoint
6
The Debugger window
  • When you reach a breakpoint, the debugger window
    will open
  • Or, you can open it yourself from the menus

7
Parts of the Debugger window
You can usually ignore Threads
This is how you got here
8
Viewing objects
This isnt very helpful
9
Debugger commands
Step ahead one statement but if it calls a
method, step into the method
Quit debugging and just run, until you hit
another breakpoint
Step ahead one statement
Quit
10
Stepping into a method
11
Cautions
  • The BlueJ debugger is very flakyuse with care
  • Debuggers can be very helpful, but they are no
    substitute for thinking about the problem
  • Often, print statements are still the better
    solution

12
The End
Write a Comment
User Comments (0)
About PowerShow.com