core dump + LINUX 内核系列博客
参考:http://www.cnblogs.com/ahuo/category/72819.html
http://blog.csdn.net/tenfyguo/article/details/8159176
http://blog.csdn.net/ylyuanlu/article/details/9115159 一.进程产生进程coredump 必备条件: ulimit-c x x取值 [,unlimited] 二.生成coredump文件 .指定格与路径生产coredump:需要自已健立mkdir -p /data/coredump目录,并且用户有写权限 echo “/data/coredump/core.%e.%p" > /proc/sys/kernel/core_pattern =========》core.xx.4944 进程 Core_pattern的格式 说明 %% 单个%字符 %p 所dump进程的进程ID %u 所dump进程的实际用户ID %g 所dump进程的实际组ID %s 导致本次core dump的信号 %t core dump的时间 (由1970年1月1日计起的秒数) %h 主机名 %e 程序文件名 .默认生成格式(程序的当前工作目录,chdir可能改变当前目录,不一定是程序的运行目录) [root@localhost ~]# cat /proc/sys/kernel/core_pattern
core 文件格式示例:core. 三.示例
gcc -g -Wall xx.c -oxx 有调试符号
[root@localhost ~]# cat -n xx.c
#include <stdio.h>
void func(char *p)
{
*p = 'p';
}
int main(int argc, char *argv[])
{
char *p=NULL;
func(p);
return ;
}
[root@localhost ~]# ./xx
Segmentation fault (core dumped)
[root@localhost ~]# gdb ./xx ./core.
GNU gdb (GDB) 7.7
Copyright (C) Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 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 "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./xx...done.
[New LWP ]
Core was generated by `./xx'.
Program terminated with signal SIGSEGV, Segmentation fault.
# 0x0000000000400454 in func (p=0x0) at xx.c:
*p = 'p';
(gdb) list #include <stdio.h> void func(char *p)
{
*p = 'p';
} int main(int argc, char *argv[])
{
(gdb)
char *p=NULL;
func(p); return ;
}
(gdb)
Line number out of range; xx.c has lines.
[root@localhost ~]# file core.
core.: ELF -bit LSB core file AMD x86-, version (SYSV), SVR4-style, from 'xx' [root@localhost ~]# readelf -h core.
ELF Header:
Magic: 7f 4c
Class: ELF64
Data: 's complement, little endian
Version: (current)
OS/ABI: UNIX - System V
ABI Version:
Type: CORE (Core file)
Machine: Advanced Micro Devices X86-
Version: 0x1
Entry point address: 0x0
Start of program headers: (bytes into file)
Start of section headers: (bytes into file)
Flags: 0x0
Size of this header: (bytes)
Size of program headers: (bytes)
Number of program headers:
Size of section headers: (bytes)
Number of section headers:
Section header string table index:
gcc xx.c -oxx 无调试符号 [root@localhost ~]# gdb ./xx ./core.
GNU gdb (GDB) 7.7
Copyright (C) Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 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 "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./xx...(no debugging symbols found)...done.
[New LWP ]
Core was generated by `./xx'.
Program terminated with signal SIGSEGV, Segmentation fault.
# 0x0000000000400454 in func ()
-------------------------------------------------------------------------------
(gdb) list
No symbol table is loaded. Use the "file" command.
(gdb) disas 0x0000000000400454
Dump of assembler code for function func:
0x0000000000400448 <+>: push %rbp
0x0000000000400449 <+>: mov %rsp,%rbp
0x000000000040044c <+>: mov %rdi,-0x8(%rbp)
0x0000000000400450 <+>: mov -0x8(%rbp),%rax
=> 0x0000000000400454 <+>: movb $0x70,(%rax)
0x0000000000400457 <+>: leaveq
0x0000000000400458 <+>: retq
End of assembler dump.
(gdb) bt
# 0x0000000000400454 in func ()
# 0x0000000000400479 in main ()
core dump + LINUX 内核系列博客的更多相关文章
- linux学习系列博客地址汇总
2018-09-28 16:03:43 CentOS7 yum命令:这是一个用来管理rpm包进行自动化安装的C/S模式的一个程序. CentOS7(无图形界面)支持中文显示的办法:系统安装好之后,有可 ...
- Linux内核总结博客 20135332武西垚
http://www.cnblogs.com/wuxiyao/p/5220677.htmlhttp://www.cnblogs.com/wuxiyao/p/5247571.htmlhttp://www ...
- LINUX 内核学习博客
http://www.cnblogs.com/yjf512/category/385367.html
- ARM的体系结构与编程系列博客——ARM处理器系列介绍
ARM处理器系列介绍 现在到了3月,过年过得过于舒服了.系列博客也停更了近半月,我果然是个慢(lan)性(gui)子,那么趁着到校的第一天晚上,就写一篇博客来继续我的系列博客了!众所周知,ARM处理器 ...
- 什么是core dump linux下用core和gdb查询出现"段错误"的地方
什么是core dump linux下用core和gdb查询出现"段错误"的地方 http://blog.chinaunix.net/uid-26833883-id-31932 ...
- Django 系列博客(十四)
Django 系列博客(十四) 前言 本篇博客介绍在 html 中使用 ajax 与后台进行数据交互. 什么是 ajax ajax(Asynchronous Javascript And XML)翻译 ...
- Django 系列博客(十三)
Django 系列博客(十三) 前言 本篇博客介绍 Django 中的常用字段和参数. ORM 字段 AutoField int 自增列,必须填入参数 primary_key=True.当 model ...
- Django 系列博客(十)
Django 系列博客(十) 前言 本篇博客介绍在 Django 中如何对数据库进行增删查改,主要为对单表进行操作. ORM简介 查询数据层次图解:如果操作 mysql,ORM 是在 pymysql ...
- Django 系列博客(七)
Django 系列博客(七) 前言 本篇博客介绍 Django 中的视图层中的相关参数,HttpRequest 对象.HttpResponse 对象.JsonResponse,以及视图层的两种响应方式 ...
随机推荐
- 优化 Android 线程和后台任务开发
在 Android 开发中,你不应该做任何阻碍主线程的事情.但这究竟意味着什么呢?在这次海湾 Android 开发者大会讲座中,Ari Lacenski 认为对于长时间运行或潜在的复杂任务要特别小心. ...
- 【Quick 3.3】资源脚本加密及热更新(一)脚本加密
[Quick 3.3]资源脚本加密及热更新(一)脚本加密 注:本文基于Quick-cocos2dx-3.3版本编写 一.脚本加密 quick框架已经封装好加密模块,与加密有关的文件在引擎目录/quic ...
- puTTY与SecureCRT的比较
从网上看到别人对这两个工具的比较:从windows访问linux,除了samba之外,日常操作用得最多的大概就是PuTTY和SecureCRT Putty是免费的,SecureCRT是收费的(当然,有 ...
- Linux Kernel ‘/bcm/Bcmchar.c’本地信息泄露漏洞
漏洞名称: Linux Kernel ‘/bcm/Bcmchar.c’本地信息泄露漏洞 CNNVD编号: CNNVD-201311-053 发布时间: 2013-11-06 更新时间: 2013-11 ...
- (转载)四种常见的 POST 提交数据方式
(转载)http://www.imququ.com/post/four-ways-to-post-data-in-http.html HTTP/1.1 协议规定的 HTTP 请求方法有 OPTIONS ...
- Dim Loop 出现结果不同
(1)结果是:循环1次 Dim counter,num counter = 0 'num = 9 Do Until num = 10 num = num - 1 counter = c ...
- sr4000自带API和opencv结合获取图像
/* * ===================================================================================== * * Filen ...
- 不同的jar里边相同的包名类名怎么区别导入
今天在做项目的时候遇到了一个很有意思的问题,折磨了我很长时间,不过最终还是解决了,特留此文纪念一下. 遇到的问题: 同样一段代码,在同事那就好使,在我这就找不到一个方法.引用的包也都是相同的,这种问题 ...
- Centos添加硬盘分区、挂载磁盘
默认一个硬盘,新增硬盘识别为sdb.sdbc一次类推 1.查看磁盘信息 >fdisk -l #新磁盘为/dev/sdb,截图是已经分区完成了. 2.进入分区界面 >fdisk /dev/s ...
- POJ3080 - Blue Jeans(KMP+二分)
题目大意 求N个字符串的最长公共字串 题解 和POJ1226做法一样...注意是字典序最小的...WA了一次 代码: #include <iostream> #include <cs ...