Linux下程序崩溃,ulimit,coredump,gdbserver
2024-08-22 23:30:17
操作系统:Ubuntu10.04
前言:
在程序崩溃后,如何快速定位问题。
以下方法适用于开发调试阶段,不太适用成品。
本文着眼于嵌入式,PC方面更简单。
核心:gdbserver + coredump
一,安装,配置,使用 gdbserver
arm linux下安装gdb,gdbserver调试器
二,启动 coredump
linux下ulimit命令下的coredump
三,实例
1,源码
点击(此处)折叠或打开
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- static void fun(char* a,char *b)
- {
- strcpy(a,"hello world");
- strcpy(b,"wo shi zhong guo ren");
- printf("%s,%s\n",a,b);
- }
- int main(int argc,char *argv[])
- {
- char temp[5] = {0};
- char temp2[5] = {0};
- fun(temp,temp2);
- return 0;
- }
2,结果
3,通过gdbserver来查看异常所在
a,设备,启动gdbserver
b,pc机,调试设备中的程序
c,pc机上的gdb中输入where,定位异常
from:http://blog.chinaunix.net/uid-28458801-id-4349219.html
最新文章
- 奇怪的Hibernate——当?遇上%
- java 24 - 7 GUI之 创建多级菜单窗体
- java调用存储过程
- Windows上安装使用MongoDB(一)
- ASP.NET MVC下判断用户登录和授权的方法
- cocos2d-x UserDefault
- Muduo-Base-TimeStamp类
- ManagerDay-2
- Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50096, now running 50173.
- bash:command not found
- ffmpeg的安装--opencv视频处理必备
- iOS中UITextField 使用全面解析 分类: ios技术 2015-04-10 14:37 153人阅读 评论(0) 收藏
- 各种语言一句话反弹shell
- windows越用越卡怎么办?(转)
- win10 uwp 横向 AppBarButton
- 点击 Button触发事件将GridView1 CheckBox勾选的行添加到GridView2中
- 图解HTTPS协议
- java面试题复习(六)
- 兼容ie10及以上css3加载进度动画
- hdu1081 To The Max 2016-09-11 10:06 29人阅读 评论(0) 收藏