ltrace能够跟踪进程的库函数调用,它会显现出哪个库函数被调用,而strace则是跟踪程序的每个系统调用.
1.系统调用的输出对比
程序代码:
用 #ltrace跟踪程序:
用 #strace跟踪程序:
我们看到程序调用write()系统调用做了输
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跟踪程序:
我们看到程序调用write()系统调用做了输

本文介绍了如何使用strace和ltrace工具来诊断和解决软件运行中的问题,通过跟踪系统调用和库函数调用来排查程序的'疑难杂症'。
最低0.47元/天 解锁文章
280

被折叠的 条评论
为什么被折叠?



