Debugging at Scale
How to Debug At Scale Lesson 1: Don’t Test with small problems first Try to reproduce big problems at small scale In a big program, comment out parts, slowly add them back
How to Debug At Scale Lesson 2: Location of Bug != Location of Error This code crashes on line 25 Where is the bug?
How to Debug At Scale Lesson 2: Location of Bug != Location of Error Error prone code Pointing to things (what is lifespan of thing?) Deleting memory Copying things (deep copy??) What error prone code ran shortly before the bug?
How to Debug At Scale Lesson 2: Location of Bug != Location of Error Finding your error Run in debug mode so you know where you crash Put in break points or print statements to see: How far you get If your data is still valid Use binary search
How to Debug At Scale Lesson 3: Conditional Breakpoints Ignore first X hits of breakpoint Stop when code expression is true
How to Debug At Scale Lesson 4: Print It Out Reading a log can be easier than using debugger Print out Entering a particular function All parameters to each recursive call All information about current loop iteration Redirect output to a text file: myProgram.exe > output.txt
How to Debug At Scale Print It Out Tip Make a log function: You can turn off: