6. 進階printf debug
S 用fprintf把輸入內容導到檔案
S __FUNCTION__
S printf(“in %s function, it crashed.n”, __FUNCTION__);
S Macro
S #define errexit(format,arg...) exit(printf(format,##arg))
S #define errexit2(format,arg...) do{printf(“In
%sn”, __FUNCTION__); printf(format,##arg);
exit(1);}while(0)
48. gdb
S GNU Debugger
S GNU GPLv2授權開放原始碼除錯器
S Dev C++、Code::Block、Eclipse甚至Xcode的除錯器都是
gdb
S 可參考此網頁教學基本gdb使用:
S http://nthusslab.blogspot.tw/2011/09/debugcgdb.html