2019.11.26.pdf - Announcements ‣ Please complete today's poll 1 Quote of the Day ‣ To err is human to really foul up requires the root password

2019.11.26.pdf - Announcements ‣ Please complete today's...

This preview shows page 1 - 21 out of 61 pages.

Announcements Please complete today's poll 1
Image of page 1
Quote of the Day 2 To err is human... to really foul up requires the root password. •anonymous
Image of page 2
Class Announcements Assignment 3 •source code •whole versus portions •late submissions Assignment 4 Complete Course Evaluation 3
Image of page 3
CS Announcements CS Origin Stories: Eric Neufeld •Wednesday, November 27, 3:30 p.m. – 4:30 p.m. •Biology 106 Career Prep Workshop Presented by ESTI Consulting Services Thursday, November 28, 4:00pm - 5:00pm Thorvaldson 159 4
Image of page 4
Picking up from last day … 5
Image of page 5
C Example C programming example: queens14.c in examples from November 21 6
Image of page 6
git Example example showing workflow: Example_1.* Example_2.* Example_3?.* •assignment: study these examples 7
Image of page 7
git Example example showing git workflow and branching with n-queens program: Example_4.* assignment: study this example 8
Image of page 8
Debugging 9
Image of page 9
Definitions testing : designing and/or implementing test cases to verify correct operation and to expose bugs. •The latter involves trying to get the software to fail. debugging : active process of identifying and/or correcting problems in the run-time behaviour of the software 10
Image of page 10
Types of Bugs principle: reproducible bugs easier than transient ones some colloquial terminology Bohr bug : a repeatable bug; one that manifests reliably under a possibly unknown but well-defined set of conditions Heisenbug : a bug that disappears or alters its behaviour when one attempts to probe or isolate it 11
Image of page 11
Common Types of Bugs syntax bugs = vs. == ! vs. ~ (in C/C++, negation vs. one's complement) x++ vs. ++x & vs. && , | vs. || •using ^ (XOR) as exponentiation in C/C++ 12
Image of page 12
Common Types of Bugs arithmetic bugs •div by 0 •overflow/underflow - precision allowed by numerical representation - e.g. example_87.c 13
Image of page 13
Common Types of Bugs arithmetic bugs •div by 0 •overflow/underflow - precision allowed by numerical representation - e.g. example_87.c 14 % cc -Wall -Wextra example_87.c % ./a.out i,j,k = 2147483640, 1073741824, -1073741832, respectively
Image of page 14
Common Types of Bugs arithmetic bugs •floating-point - round-off/truncation - inexact representation and values not equal - e.g. example_88.c 15
Image of page 15
Common Types of Bugs arithmetic bugs •floating-point - round-off/truncation - inexact representation and values not equal - e.g. example_88.c - more on floating point in Cmpt 215 16 % cc -Wall -Wextra example_88.c % ./a.out y != 1234567890123.0 (long int)y != i y != (float)i
Image of page 16
Common Types of Bugs logic bugs •infinite loops •infinite recursion •off-by-one error 17
Image of page 17
Common Types of Bugs resource bugs •null pointer dereference •using uninitialized variable •didn't free/delete all dynamically allocated memory - memory leak •re-use of already-freed memory •confusing statically-allocated, local, and dynamically- allocated memory 18
Image of page 18
Common Types of Bugs resource bugs •array over-run •buffer over/underflow - often the source of "Heisenbugs" - major security vulnerability 19
Image of page 19
Debugging Techniques DEBUG flag and printf() statements •example: solver.cc and modified makefiles -
Image of page 20
Image of page 21

You've reached the end of your free preview.

Want to read all 61 pages?

  • Spring '14