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,以及视图层的两种响应方式 ...
随机推荐
- LCD 和 LED 的区别?
http://sxlecd.blog.163.com/blog/static/131722380200911810564930/
- LINUX下安装PHP(CGI模式)和NGINX[转]
安装所需依赖 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freety ...
- ssh 密钥详解
ssh 无密码登录要使用公钥与私钥.linux下可以用用ssh-keygen生成公钥/私钥对,下面我以CentOS为例. 有机器A(192.168.1.155),B(192.168.1.181).现想 ...
- Android 编译大全
http://quanminchaoren.iteye.com/blog/840917
- istringstream、ostringstream、stringstream 类介绍 .
istringstream.ostringstream.stringstream 类介绍 . 转自:http://www.cnblogs.com/gamesky/archive/2013/01/09/ ...
- Webform——注册验证
服务器控件和客户端控件的交替使用,主要还是获取到各个控件的值,直接用C#或Js判断是否符合条件就可以. 这里是以服务器控件为例子,至于客户端控件则需要写JS代码 .UserBF public clas ...
- PHP 'ext/gd/gd.c' gdImageCrop空指针返回拒绝服务漏洞
漏洞版本: PHP 5.5.x 漏洞描述: CVE ID:CVE-2013-7327 PHP是一种HTML内嵌式的语言. PHP 'ext/gd/gd.c' gdImageCrop函数没有检查返回值, ...
- Linux kernel ‘qeth_snmp_command’函数缓冲区溢出漏洞
漏洞名称: Linux kernel ‘qeth_snmp_command’函数缓冲区溢出漏洞 CNNVD编号: CNNVD-201311-423 发布时间: 2013-11-29 更新时间: 201 ...
- [HDU 1963] Investment
Investment Time Limit:10000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Descrip ...
- 1.进入debug模式(基础知识列表)
1.进入debug模式(基础知识列表)1.设置断点 2.启动servers端的debug模式 3.运行程序,在后台遇到断点时,进入debug调试状态 ========================= ...