-
Notifications
You must be signed in to change notification settings - Fork 0
/
overview.txt
67 lines (48 loc) · 1.83 KB
/
overview.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Section 11: Overview
----------------------------------------------------------------------------------
Techniques and Tools
- Tracing/Using print statements
+ Output values of variables at certain points
of a program
+ Show the flow of execution
+ Can help isolate the error
- Debuggers
+ Monitor the execution of a program, stop it, restart it,
set breakpoints and watch variables in memory
- Log Files
+ Can be used for analysis, add "good" log statements to
your code
- Monitoring Software
+ Run-time analysis of memory usage, network traffic,
thread and object information
Common Debugging Tools
- Exception Handling helps a great deal to identify catastrophic
errors
+ Unfortunately, C does not have this capability
- Static Analyzers
+ Analyze source code for specific set of known problems
+ Semantic checker, does not analyze syntax
+ Can detect things like uninitialized variables, memory
leaks, unreachable code, deadlocks or race conditions
- Test Suites
+ Run a set of comprehensive system end-to-end tests
- Debugging the program after it has crashed
+ Analyze the call stack
+ Analyze memory dump (core file)
Preventing Errors
- Write high quality code (follow good design principles
and good programming practices)
- Unit Tests
+ Automatically executed when compiling
+ Helps avoid regression
+ Finds errors in new code before it is delivered
+ TDD (Test Driven Development)
- Provide good documentation and proper planning (write
down design on paper and utilize pseudocode)
- Work in steps and constantly test after each step
+ Avoid too many changes at once
+ When making changes, apply them incrementally. Add
one change, then test thoroughly before starting
the next step
+ Helps reduce the possible sources of bugs, limits
problem set