Lecture 20: November 8, 2019

Reading: Handout, The Dynamic Debugger gdb
Due: Homework #3, due November 8, 2019


  1. Greetings and felicitations!
    1. Homework
      1. Homework 1 grades are out
      2. Homework 3: submit through Gradescope
      3. Homework 2 is now reopened until Wednesday so you can fix things that you lost points for on homework 1
    2. In discussion section, ask questions of the TAs — they are there to help! And when they ask something, try to answer.
    3. Some errors by the TAs and me are because we’re human; others are deliberate, to see who will spot it; this tells us if we need to cover something more thoroughly
    4. If you get a message like “Attempted stack smashing”, look at your local arrays; it probably means you overflowed one of them
  2. Static debugging
    1. How to narrow down where the problem is using printf [sample1.c, sample2.c]
    2. Handle multiple bugs [sample3.c]
  3. Dynamic debugging with gdb [sample1.c, sample2.c, sample3.c, nfact2.c]
    1. Bringing a program into gdb
    2. Breakpoints, conditions, commands
    3. Stepping through it
    4. Printing values
    5. Watchpoints

UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 36A, Programming and Problem Solving
Version of November 15, 2019 at 9:29PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh