操作系统:Ubuntu10.04

前言:
    在程序崩溃后,如何快速定位问题。
    以下方法适用于开发调试阶段,不太适用成品。
    本文着眼于嵌入式,PC方面更简单。
    核心:gdbserver + coredump

一,安装,配置,使用 gdbserver
    arm linux下安装gdb,gdbserver调试器

二,启动 coredump
   linux下ulimit命令下的coredump

三,实例
    1,源码

点击(此处)折叠或打开

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. static    void    fun(char* a,char *b)
  5. {
  6. strcpy(a,"hello world");
  7. strcpy(b,"wo shi zhong guo ren");
  8. printf("%s,%s\n",a,b);
  9. }
  10. int main(int argc,char *argv[])
  11. {
  12. char temp[5] = {0};
  13. char temp2[5] = {0};
  14. fun(temp,temp2);
  15. return 0;
  16. }

2,结果
    

 3,通过gdbserver来查看异常所在
        a,设备,启动gdbserver
        

 b,pc机,调试设备中的程序
        

c,pc机上的gdb中输入where,定位异常
        

from:http://blog.chinaunix.net/uid-28458801-id-4349219.html

最新文章

  1. 奇怪的Hibernate——当?遇上%
  2. java 24 - 7 GUI之 创建多级菜单窗体
  3. java调用存储过程
  4. Windows上安装使用MongoDB(一)
  5. ASP.NET MVC下判断用户登录和授权的方法
  6. cocos2d-x UserDefault
  7. Muduo-Base-TimeStamp类
  8. ManagerDay-2
  9. Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50096, now running 50173.
  10. bash:command not found
  11. ffmpeg的安装--opencv视频处理必备
  12. iOS中UITextField 使用全面解析 分类: ios技术 2015-04-10 14:37 153人阅读 评论(0) 收藏
  13. 各种语言一句话反弹shell
  14. windows越用越卡怎么办?(转)
  15. win10 uwp 横向 AppBarButton
  16. 点击 Button触发事件将GridView1 CheckBox勾选的行添加到GridView2中
  17. 图解HTTPS协议
  18. java面试题复习(六)
  19. 兼容ie10及以上css3加载进度动画
  20. hdu1081 To The Max 2016-09-11 10:06 29人阅读 评论(0) 收藏

热门文章

  1. 转:SVN 出现This client is too old to work with working copy...错误
  2. 试用mysql的infobright引擎
  3. html 表单初步学习
  4. Python多进程(multiprocessing)
  5. python list 去重
  6. 一、cocos2dx概念简介
  7. EffectiveC#02--仅在对基类进行强制更新时才使用new修饰符
  8. java String常见的处理
  9. Ubuntu自定义命令
  10. COMException 依赖服务或组无法启动(0x8007042C)处理办法