Bitpath

Lesson 2 · Unit 03

The debugger

Breakpoints, stepping, the call stack and conditions: stop a running program and look inside

13 exercisesabout 3 min

What you practise

  • Breakpoints, step over, into and out, the call stack and local variables, conditional breakpoints, when it beats a print

Try a question from this lesson

Pick one

A loop handles 10,000 orders and the total goes wrong at order 7,412. Printing inside the loop gives you 10,000 lines to read. What would serve you better?

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Breakpoints

A breakpoint marks a line. Run the program under a debugger and it pauses just before that line executes.

While paused, everything is frozen and readable: every variable, in every function that is running. Then you let it go on.

No edits, no clean-up afterwards, and you choose what to look at once you are there.

Concept

The call stack

While paused, the call stack lists every function that is in the middle of running, newest on top.

Each entry is a frame: one function call with its own local variables and the line it has reached. Select a lower frame and you see the caller's variables as they are right now.

It is a stack trace you can walk around in.

10 more exercises in the app

  • 3× type the answer
  • 3× multiple choice
  • 1× match the pairs
  • 1× true or false
  • 1× fill the blanks
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy