GCC如何产生core dump

先决条件

1.安装apport(automatically generate crash reports for debugging)

2.修改/etc/security/limits.conf文件,使允许core dump,或者用ulimit -c unlimited设置core dump文件的大小为unlimited

3.C/C++的编译开关-g(产生调试符号)

######运行编译好的程序testc(我的程序)

kimi@kimi-desktop:~/testc/bin/Debug$ ./testc

######下面一行显示了core dumped表示成功,core文件在/var/crash或者在当前目录

段错误 (core dumped)

kimi@kimi-desktop:~/testc/bin/Debug$ ls

######果然在当前目录

core testc

######gdb一下

kimi@kimi-desktop:~/testc/bin/Debug$ gdb testc core

GNU gdb 6.8-debian

Copyright (C) 2008 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. Type "show copying"

and "show warranty" for details.

This GDB was configured as "i486-linux-gnu"...

warning: Can't read pathname for load map: Input/output error.

Reading symbols from /usr/lib/libstdc++.so.6...done.

Loaded symbols for /usr/lib/libstdc++.so.6

Reading symbols from /lib/tls/i686/cmov/libm.so.6...done.

Loaded symbols for /lib/tls/i686/cmov/libm.so.6

Reading symbols from /lib/libgcc_s.so.1...done.

Loaded symbols for /lib/libgcc_s.so.1

Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.

Loaded symbols for /lib/tls/i686/cmov/libc.so.6

Reading symbols from /lib/ld-linux.so.2...done.

Loaded symbols for /lib/ld-linux.so.2

Core was generated by `./testc'.

######程序是由于段错误退出的

Program terminated with signal 11, Segmentation fault.

[New process 13072]

######段错误的地方在dummy_function - main.c的第5行

#0 0x080483a4 in dummy_function () at /home/kimi/testc/main.c:5

5 *ptr = 0x00;

######打印一下调用堆栈

(gdb) bt

#0 0x080483a4 in dummy_function () at /home/kimi/testc/main.c:5

#1 0x080483bc in main () at /home/kimi/testc/main.c:12

(gdb)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/445119.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

经典的进程同步问题

经典的进程同步问题 普通版&#xff1a;一类进程作为生产者&#xff0c;生产产品&#xff0c;生产的产品放入一个缓冲区&#xff0c;消费者从缓冲区中取出产品&#xff0c;需要保证生产者不可以向满的缓冲区中添加产品&#xff0c;消费者不可以从空的缓冲区中取出产品。同一时刻…

面试题汇总---深度学习(图像识别,NLP内容)

文章目录1.基本概念1.1 为什么神经网络中深度网络的表现比广度网络表现好&#xff1f;1.2 推导BP算法1.3 什么是梯度消失和梯度爆炸&#xff1f;1.4 常用的激活函数有哪些&#xff1f;1.5 常用的参数更新方法有哪些&#xff1f;1.6 解决过拟合的方法&#xff1f;数据层面模型层…

Linux-2.6.25 TCPIP函数调用大致流程

Linux-2.6.25 TCPIP函数调用大致流程学习目的&#xff0c;随手笔记。函数和文字说明会不断补充更新。Changelog2008.10.08 最近找工作忙。暂时缓缓插口层系统调用sendsys_sendsys_sendtosendtosys_sendtosock_sendmsgsendmsgsys_sendmsgsock_sendmsgwritesys_writevfs_write…

Python(28)-文件,os模块

文件1. 文件2. 文件的基本操作3. 读取文件open()3.1 文件指针: 标记从哪一个位置开始读取数据.3.2 文件的打开方式mode3.3 文件按行读取3.3.1 readline()3.3.2 readlines()4.文件输出f.write(),print()5.文件复制5.1 小文件复制&#xff08;搬家&#xff09;5.2 大文件复制&…

IOCP的程序

C代码 #include <winsock2.h> #include <mswsock.h> #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "vld.h" #pragma message("automatic link to ws2_32.lib and…

PaperNotes(3)-图像分割-RCNN-FCN-Boxsup

图像分割算法对比小结1.{基本概念}2.{R-CNN}2.1R-CNN 网络结构选择性搜索算法为什么选择SVM作分类器边框回归2.2{R-CNN 训练}2.3{R-CNN实验结果}2.4{R-CNN语义分割}2.5{补充材料}2.5.1{R-CNN建议区域放缩}2.5.2{IOU阈值设置不一样的原因}2.5.3{Bounding-box回归修正}2.6{R-CNN存…

Python模块(3)--PIL 简易使用教程

PIL模块-用与记1.图片导入Image.open()2.图像显示.show()4.查看图片属性.format,.size,.mode3.图像格式转换.convert()4.图像模式“L”&#xff0c;“RGB”,"CYMK"5. 图片旋转.rotate()旋转方式1&#xff1a;旋转不扩展旋转方式2&#xff1a;旋转扩展旋转方式3&#…

日志级别 debug info warn eirror fatal

日志级别 debug info warn eirror fatal 软件中总免不了要使用诸如 Log4net, Log4j, Tracer 等东东来写日志&#xff0c;不管用什么&#xff0c;这些东东大多是大同小异的&#xff0c;一般都提供了这样5个日志级别&#xff1a; Debug Info Warn Error Fatal一个等级比一个高&…

输入输出系统

I/O设备&#xff1a;输入输出和存储功能的设备 I/O设备的分类 按传输的速度&#xff1a; 低速设备&#xff08;如键盘、鼠标、语音输入输出设备&#xff09; 中速设备&#xff08;如行式打印机、激光打印机等&#xff09; 高速设备&#xff08;如磁带机、磁盘机、光盘机等&…

vue2源码解析---v-model双向数据绑定

什么是v-model v-model 是 Vue 中的一个指令&#xff0c;用于实现表单元素与 Vue 实例中数据的双向绑定。这意味着当表单元素的值发生变化时&#xff0c;Vue 实例中的数据也会随之更新 工作原理 生成ast树 本质上是语法糖 结合了v-bind和v-on两个指令 示例代码 new Vue({e…

php收集的精典代码

1. οncοntextmenu"window.event.return&#xff06;#118aluefalse" 将彻底屏蔽鼠标右键 <table border οncοntextmenureturn(false)><td>no</table> 可用于Table 2. <body onselectstart"return false"> 取消选取、防止复制…

python外卷(7)--glob

glob模块1.glob.glob()2.对比os.listdir()glob是python自带的一个操作文件的模块&#xff0c;可用于查找 指定路径 中 匹配的 文件。1.glob.glob() 下面是一个测试文件路径&#xff1a; (base) pppp-System-Product-Name:~/Desktop/test_glob$ tree . ├── a │ ├── 1…

Sublime Text 2配置强大的IDE开发环境,运行java

Sublime Text 2是我无意中发现的、据说十分强大的、便捷的编辑器&#xff0c;许多程序员都投入到Sublime Text 2的怀抱中。 1 配置java开发环境的方法如下&#xff1a; 在jdk安装目录下的bin文件夹下新建一个bat格式的文件&#xff0c;文件命为javacexec.bat。 如果是在Wind…

thinkphp的快捷方法实例化对象

D、F、S、C、L、A、I 他们都在functions.php这个文件家 下面我分别说明一下他们的功能 D&#xff08;&#xff09; 加载Model类 M&#xff08;&#xff09; 加载Model类 A&#xff08;&#xff09; 加载Action类 L&#xff08;&#xff09; 获取语言定义 C&#xff08;&#xf…

Python外卷(8)--pdist, squareform

pdist, squareform1.pdist, squareform使用例子2.通过矩阵的四则运算实现上述pdist, squareformscipy.spatial.distance 距离计算库中有两个函数&#xff1a;pdist, squareform&#xff0c;用于计算样本对之间的欧式距离&#xff0c;并且将样本间距离用方阵表示出来。&#xff…

模拟进程调度

功能 data.h #ifndef _Data_h_ #define _Data_h_#include <stdio.h> #include <stdlib.h> #include <string.h>#define ElemType PCB #define Status int #define OK 1 #define ERROR 0 #define TimeSlice 1 #define Infinity 10 //INT_MAX#define NAME_M…

gdb调试多进程和多线程命令

1. 默认设置下&#xff0c;在调试多进程程序时GDB只会调试主进程。但是GDB&#xff08;>V7.0&#xff09;支持多进程的 分别以及同时 调试&#xff0c;换句话说&#xff0c;GDB可以同时调试多个程序。只需要设置follow-fork-mode(默认值&#xff1a;parent)和detach-on-fork…

python外卷(10)--取整

"取整"那些事1.python 内置函数1.1int()--向下取整1.2round()--四舍五入2.math模块取整函数2.1 math.floor()--向下取整2.2 math.ceil()--向上取整2.3 math.modf()--分别取小数部分和整数部分3.numpy模块取整函数3.1 numpy.floor()--向下取整3.2 numpy.ceil()--向上取…

模拟银行家算法

介绍 data.h #ifndef _Data_h_ #define _Data_h_#include <stdio.h> #include <stdlib.h> #include <string.h>#define ElemType PCB #define Status int #define true 1 #define false 0 #define OK 1 #define ERROR 0 #define RESOURCE_NUM …

Lua 与 C混合编程 .

本文通过程序实例说明C调用lua脚本和lua调用C的方法: 先建立一个 test.c文件: #include <stdio.h> #include <stdlib.h> #include "lua.h" #include "lualib.h" #include "lauxlib.h" #pragma comment(lib, "lua5.1.lib&qu…