6.4代码调试
当防御式编程和测试都无法挡住bug时,debug就不得不做了
为啥debug挺难的2 Process for debugging
(1)重现bug
从最小的测试用例集开始复现错误(2)诊断bug
(2)分治
(3)切片
(4)寻找差异(6)调试器
debugger
(7)借鉴别人
3debugging tools
(1)暴力debug
(2)其他
(1)(2) Post-mortem debugging: stack trace
(3)printf
(4)logging 见之前写的
(5) Compiler Warning Messages(6) Debugger: breakpoints, etc
Debugger: watchpoint