close
閱畢日期:2012/3/2

這本書是去年借的,借來以後就放在公司,輾轉到今年才看完。這本書比較適合當作參考書來使用,裡面除了GCC以外,也提到像autoconf、automake、libtool、gdb等等的相關開發工具。

下面就記我有筆記的部分,不依照章節順序。

Chapter 10 - info
主要就介紹info,提到info的歷史,看到這兒我才知道為什麼有了man還會有info,原來是因為GNU基金會只願意提供info格式的說明文件,但到了現在,其實man格式的文件也都有了。
info 是讀取 textinfo 文件,文件裡面,以'a'開頭的行有特殊的意義。 (筆記是寫'a',應該對吧...)
按鍵幾乎跟emacs相同。搜尋按 ? keyword,ctrl-x n/N 向後或向前找,ctrl-h 輔助說明。

Chapter 4 - gcc 進階功能
gcc擴充了許多特殊的語法跟用法,可以參考kernel或是gcc的說明文件。

Chapter 5 - 最佳化
-Os 可以較省記憶體,最佳化結果跟 -O2 相當。
有些最佳化功能,用 -f 才能指定、打開,用 -O 是用不到的。

Chapter 6 - 最佳化分析
介紹了一些書:
  • Automated software testing
  • Software test Automation
  • Software testing and continuous quality improvement
  • Systematic software testing
  • Testing computer software

編譯時加上 -fprofile-arcs 可以產生 call graph,但執行時,才會產生 .da,這個 .da 是會累計的,並不會在一開始執行就清除。-ftest-coverage 則是在編譯時就產生 .bb 或 .bbg,就可以用 gcov 來執行並產生 .gov 檔案:gcov xxx.c。
用 gprof 的話,編譯時要加上 -pg,然後執行過程式一次,得到gmon.out,就可以使用 gprof xxx
裡面最有用的參數是 -A,可以提供效能稽核資訊。
-finstrument=functions 可以在函式進入、返回去呼叫自訂函式。

Chapter 8 - libtool
libtool 主要參數是 --mode,--mode可以帶 clean、compile、execute、install、link。
這有免費電子書 GNU Autoconf, Automake and libtool 可以看,這本電子書以 OPL 釋出。

Chapter 12 - GDB
推薦書:
  • Debugging with GDB
  • GCC-The complete reference
  • GNU C library reference manual
  • GNU C programming tutorial
  • GNU Make
  • Using and porting GNU CC


Chapter 7 - autoconf/automake
大致步驟是:
  1. autoscan 產生 configure.scan
  2. 更名為configure.ac,並確定AM_INIT_AUTOMAKE巨集裡的檔名
  3. autoheader
  4. aclocal
  5. 建立Makefile.am
  6. automake
  7. autoconf


More about GCC完全指南

arrow
arrow

    elleryq 發表在 痞客邦 留言(0) 人氣()