所以,我已經閱讀了這篇文章Counting machine instructions of a process using PTRACE_SINGLESTEP,我明白動態鏈接一個測試程序到我的ptrace程序將返回一個指令計數,它也計算運行時庫的初始化。不過,我想獲得一個有效的計數爲我的測試程序,它是: int main(){
return 0;
}
我ptrace的程序首先也回到
我使用ptrace來跟蹤進程的系統調用。在分解過程之後,我使用PTRACE_TRACEME開始跟蹤過程。代碼如下所示: while (true) {
int status;
int gotPid;
gotPid = waitpid(pid, &status, 0);
if (WIFEXITED(status) || WIFSIGNALED(status))