ltrace能够跟踪进程的库函数调用,它会显现出哪个库函数被调用,而strace则是跟踪程序的每个系统调用.
1.系统调用的输出对比
程序代码:
用 #ltrace跟踪程序:
用 #strace跟踪程序:
1.系统调用的输出对比
程序代码:
#include <stdio.h>
main(){
char str[]= "Abcde";
printf("\n string = %s length = %d \n",str,str_length(str));
}
int str_length (const char *s){
int length = 0;
while (*s++){
length++;
}
return (length);
}
用 #ltrace跟踪程序:
用 #strace跟踪程序: