Linux/ubuntu下core文件的产生与使用
2012-07-04 22:44
330 查看
一.相关知识
1)何为core文件?
核心文件(core file),也称核心转储(core dump),是操作系统在进程收到某些信号而终止运行时,将此时进程地址空间的内容以及有关进程状态的其他信息写出的一个磁盘文件。这种信息往往用于调试。[摘自百度百科]
A core dump is the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally (crashed). In practice, other key pieces of program state are usually
dumped at the same time, including the processor registers, which may include the program counter and stack pointer, memory management information, and other processor and operating system flags and information. The name comes from the once-standard memory
technology core memory. Core dumps are often used to diagnose or debug errors in computer programs.
On many operating systems, a fatal error in a program automatically triggers a core dump, and by extension the phrase "to dump core" has come to mean, in many cases, any fatal error, regardless of whether a record of the program memory is created.[摘自维基百科]
二.示例 ubuntu下core文件的产生
1)查看相关环境,如下图中
注:core file size 为 0,core file产生还没打开
2)写一个简单的存在问题的c++程序并运行
注:运行出错,提示段错误(访问空指针),由于没有打开core文件的开关,故没有产生core文件的信息
3)打开core文件产生的”开关“
注:设置core file size来开否core文件的产生,这里的1024是喜好值,可以根据实值情况调整
4)运生程序出错并生成core文件
注:默认在当前工作目录产生core文件,而文件名为core
[更改core文件产生的格式]
注:修改/proc/sys/kernel/core_pattern的内容为core-%p-%e-%t,原来的内容为core
5)使用gdb调试core文件
三.有关core文件相关的知识汇总
四.参考文章
1)http://hi.baidu.com/donghaozheng/blog/item/1ef1ebdda53a38e376c63898.html
2)http://blog.csdn.net/shaovey/article/details/2744487
1)何为core文件?
核心文件(core file),也称核心转储(core dump),是操作系统在进程收到某些信号而终止运行时,将此时进程地址空间的内容以及有关进程状态的其他信息写出的一个磁盘文件。这种信息往往用于调试。[摘自百度百科]
A core dump is the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally (crashed). In practice, other key pieces of program state are usually
dumped at the same time, including the processor registers, which may include the program counter and stack pointer, memory management information, and other processor and operating system flags and information. The name comes from the once-standard memory
technology core memory. Core dumps are often used to diagnose or debug errors in computer programs.
On many operating systems, a fatal error in a program automatically triggers a core dump, and by extension the phrase "to dump core" has come to mean, in many cases, any fatal error, regardless of whether a record of the program memory is created.[摘自维基百科]
二.示例 ubuntu下core文件的产生
1)查看相关环境,如下图中
注:core file size 为 0,core file产生还没打开
2)写一个简单的存在问题的c++程序并运行
注:运行出错,提示段错误(访问空指针),由于没有打开core文件的开关,故没有产生core文件的信息
3)打开core文件产生的”开关“
注:设置core file size来开否core文件的产生,这里的1024是喜好值,可以根据实值情况调整
4)运生程序出错并生成core文件
注:默认在当前工作目录产生core文件,而文件名为core
[更改core文件产生的格式]
注:修改/proc/sys/kernel/core_pattern的内容为core-%p-%e-%t,原来的内容为core
5)使用gdb调试core文件
三.有关core文件相关的知识汇总
四.参考文章
1)http://hi.baidu.com/donghaozheng/blog/item/1ef1ebdda53a38e376c63898.html
2)http://blog.csdn.net/shaovey/article/details/2744487
相关文章推荐
- Linux/ubuntu下core文件的产生与使用
- Linux---ubuntu下core文件的产生与使用
- 在AIX上用IBM的JVM,内存溢出时默认地会产生javacore文件(关于cpu的)和heapdump文件(关于内存的)。手动产生堆栈文件的方法是使用kill -3
- MiniGUI应用程序使用 Ctrl+c 结束进程,发现产生core文件
- 使用nobody运行的进程无法产生core文件的解决方法。
- linux ulimit的使用,如何产生core文件,调试段错误
- 使用gcore工具产生core文件而不杀死进程
- 为什么tiaoshi不产生core文件?
- ubuntu使用ssh远程登录服务器及上传本地文件到服务器
- 在Linux下产生并调试core文件
- ubuntu64使用adt是出错(r文件没有找到)
- Ubuntu下使用VI编辑文件必知的常用命令-
- ASP.NET core Web中使用appsettings.json配置文件的方法
- Ubuntu使用dd复制文件到sd卡上有问题,
- 在ubuntu/deepin/mint等系统中使用命令删除文件或文件夹
- Ubuntu7.04使用totem-xine,安装libxine1-ffmpeg后,rm文件播放无声问题的解决办法
- ubuntu下使用CGAL的pro文件
- 开始使用linux的core文件
- ubuntu 产生core的相关设置
- linux下core文件使用