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,以及视图层的两种响应方式 ...
随机推荐
- webbench的详细使用
webbench是什么?是一款相当给力的网站压力测试工具.(优点自行搜索) 使用webbench需要两大步骤: 1.安装webbench 2.熟悉webbench命令 一.安装webbench 1.下 ...
- RTMP
实时消息传输协议 RTMP(Real Time Messaging Protocol) http://blog.csdn.net/defonds/article/details/17403225 译序 ...
- ANDROID_MARS学习笔记_S01原始版_020_Mp3player001_歌曲列表
一.项目设计 二.歌曲列表简介 1.利用java.net.HttpURLConnection以流的形式下载xml文件为String 2.自定义ContentHandler-->Mp3ListCo ...
- UAC新解(有非正常手段可以绕过)
360第一次注册是需要弹,可是以后就不弹了开机自启动不弹框,开机自启动不弹框 服务是system权限再说一句,一般程序也不需要过UAC系统启动项白名单.UAC有一个白名单机制.还有UAC也可以通过wu ...
- 【HDOJ】1045 Fire Net
经典深搜.注意满足条件. #include <stdio.h> #include <string.h> #define MAXNUM 5 char map[MAXNUM][MA ...
- MVC——数据库增删改查(Razor)——Html语法
一.显示界面 .Models(模板) private MyDBDataContext _context = new MyDBDataContext(); public List<Info> ...
- Linq中SingleOrDefault、FirstOrDefault的用法
1.SingleOrDefault和FirstOrDefault的区别 SingleOrDefault 只取一个 如果没有数据等于 null, 如果>1 异常 FirstOrDefault ...
- 六月计划#2A(6.10-6.16)
17/35 STL BZOJ_1588_&_Codevs_1296_[HNOI2002]_营业额统计(平衡树/set)(set重做) BZOJ_1208_&_Codevs_1258_[ ...
- C# 根据Word模版生成Word文件
指定的word模版 2,生成word类 添加com Microsoft word 11.0 Object Library 引用 using System; using System.Collectio ...
- 快速定位隐蔽的sql性能问题及调优【转载】
在前几天,有个开发同事问我一个问题,其实也算是技术救援,他说在有个job数据处理的频率比较高,在测试环境中很难定位出在哪有问题,而且速度也还能接 受,但是在生产环境中总是会慢一些,希望我能在测试环境中 ...