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,以及视图层的两种响应方式 ...
随机推荐
- apache的 .htaccess文件的常用配置
使用.htaccess文件需要注意的地方: 1.找到配置文件httpd.conf,将override的值改成all.如下图:(如果不设置成all,apache将忽略.htaccess文件)
- M-JPEG和MPEG-4的区别 M-JPEG VS MPEG
http://blog.sina.com.cn/s/blog_4b357b300100gre9.html M-JPEG VS MPEG http://blog.csdn.net/bluesky_sun ...
- module_init宏解析
在init.h中我们看到 #define module_init(x) __initcall(x); 还看到 #define __initcall(fn) device_initcall(fn) 还有 ...
- USACO3.24Feed Ratios
直接枚举到100水过 /* ID: shangca2 LANG: C++ TASK: ratios */ #include <iostream> #include<cstdio> ...
- bzoj1069
四边形的问题可以转化为三角形处理穷举对角线,然后处理上下两个三角形,旋转卡壳 ..] of double; q:..] of longint; l,r,i,j,k,t,n:longint; ans:d ...
- 处理MVC中默认的Json方法返回时间的问题
利用 Json方法返回 数据时,如果有时间格式,会变成 "\/Date(1369419656217)\/" 这个样子,问了同事找到个解决方法 using Newtonsoft.Js ...
- HDU 1518
思路:从第一个数开始搜索,将其和与边长比对,相等则计数+1,计数达到3的时候说明可以组成,因为剩下那条必与边长相等,搜索过程注意剪枝,若某个数已被加入边长则不能重复计算,应将其标记,另外应在每一层递归 ...
- python __enter__ 与 __exit__的作用,以及与 with 语句的关系
转载自:http://linbo.github.io/2013/01/08/python-with/ (一直不知道博客园哪里发转载文章) With语句是什么? 有一些任务,可能事先需要设置,事后做清理 ...
- Mac osx 下配置ANT
一般安装过程如下: 1:sudo sh (会提示你输入当前用户的密码) 2:cp apache-ant.1.8.2-bin.zip /usr/local 3:cd /usr/local 4:unzip ...
- NOIP2003 侦探推理
题二 侦探推理 [问题描述] 明明同学最近迷上了侦探漫画<柯南>并沉醉于推理游戏之中,于是他召集了一群同学玩推理游戏.游戏的内容是这样的,明明的同学们先商量好由其中的一个人充当罪犯( ...