彙編

在使用 gcov 之前,應使用兩個標誌 -fprofile-arcs 和 -ftest-coverage 使用 gcc 編譯原始碼。這告訴編譯器生成 gcov 所需的資訊和額外的目標檔案程式碼。

gcc -fprofile-arcs -ftest-coverage hello.c

連結還應該使用 -fprofile-arcs 標誌。