Tips to Handle Linux APPs Crack Shit

来源:互联网 发布:jdk 7u9 windows i586 编辑:程序博客网 时间:2024/06/06 10:01
 

Problem 1: linux应用程序段错误挺常见,得淡定。一般处理手法:
Solution:
1.编译时加入标志-g。
2.设置core文件大小。
 struct rlimit res = { .rlim_cur = RLIM_INFINITY, .rlim_max = RLIM_INFINITY };   setrlimit(RLIMIT_CORE, &res); 
3.守株待崩,然后gdb appname corename。

Problem 2: linux应用程序不死但hold住了,也挺常见,得淡定。一般处理手法:
Solution:
1.编译时加入标志-g。
2.ps获得pid。
3.gdb -> attach pid -> input gdb command(like 'thread apply all bt' or something)。

原创粉丝点击