linux 调试
来源:互联网 发布:淘宝天猫类目采集器 编辑:程序博客网 时间:2024/05/24 22:43
ulimit -c unlimited 崩溃生成core文件
gdb -c corefile ./excute.
记一个bug:一个线程通过malloc分配内存,将该内存放入到list中,另一个线程读取这个list,总是在特定的次数后发生free崩溃,提示:invalid pointer.
解决思路:跟踪 malloc 和 free.使用了__malloc_hook.__free_hook.https://github.com/GisKook/codeset/blob/master/civilmanager_access/test/mallochook_test.c
同事使用了backtrace。打印调用堆栈。没有发现有价值的东西,想到一般malloc时都在生成的pointer之前放置一些大小信息,跟踪过程中发现出问题时malloc那个cookie都成为了0.所以推断是被其他线程覆盖了,gdb使用awatch命令找到了源头。
如何寻找类型的定义:如 time_t gcc -E xxx.c | grep time_t (Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of preprocessed source code, which is sent to the standard output. Input files which don’t require preprocessing are ignored.)
0 0
- linux调试
- linux调试
- Linux 调试
- linux调试
- linux调试
- linux调试
- linux调试
- Linux调试
- linux 调试
- LINUX调试
- linux调试
- linux 调试
- linux 调试
- linux 调试
- linux调试
- linux 调试
- linux 调试
- 掌握 Linux 调试技术
- 第十三周项目1.5 折腾数组(5) 在数组中插入新数值
- 定制自己的eclipse 的5个小提示
- 多智能体合作求解与网络信息传播研究
- java并发2.5-活跃度与性能
- SQLServer无法使用特殊主体'sa'的解决
- linux 调试
- 淘宝技术发展历程(《淘宝技术这十年》阅后总结)
- Android自定义适配器
- 大数取模
- java 打开word文档等文件
- solr4.10.2源码接口- SolrRequestHandler
- 2D射影平面
- 让asp.net网站支持多语言,使用资源文件
- Eclipse Exception in thread "main" java.lang.NoSuchMethodException