未加星标

The core dump file in Arch Linux

字体大小 | |
[系统(linux) 所属分类 系统(linux) | 发布者 店小二03 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Arch linux uses systemd , and the core dump files will be stored in /var/lib/systemd/coredump directory by default.

Let’s look at the following simple program:

int main(void) {
int *p = 0;
*p = 1;
}

Compile and run it:

$ gcc -g -o test test.c
$ ./test
Segmentation fault (core dumped)

Definitely, the program crashes! Check the core dump files:

$ coredumpctl list
TIME PID UID GID SIG COREFILE EXE
......
Mon 2017-01-09 16:13:44 SGT 7307 1014 1014 11 present /home/xiaonan/test
$ ls -alt /var/lib/systemd/coredump/core.test*
-rw-r-----+ 1 root root 22821 Jan 9 16:13 /var/lib/systemd/coredump/core.test.1014.183b4c57ccad464abd2eba2c104a47a8.7307.1483949624000000000000.lz4

According to the file name and time, we can find the program’s corresponding core dump binary. To debug it, we can use “ coredumpctl gdb PID ” command:

$ coredumpctl gdb 7307
PID: 7307 (test)
UID: 1014 (xiaonan)
GID: 1014 (xiaonan)
Signal: 11 (SEGV)
Timestamp: Mon 2017-01-09 16:13:44 SGT (6min ago)
Command Line: ./test
Executable: /home/xiaonan/test
Control Group: /user.slice/user-1014.slice/session-c4.scope
Unit: session-c4.scope
Slice: user-1014.slice
Session: c4
Owner UID: 1014 (xiaonan)
Boot ID: 183b4c57ccad464abd2eba2c104a47a8
Machine ID: 25671e5feadb4ae4bbe2c9ee6de97d66
Hostname: supermicro-sys-1028gq-trt
Storage: /var/lib/systemd/coredump/core.test.1014.183b4c57ccad464abd2eba2c104a47a8.7307.1483949624000000000000.lz4
Message: Process 7307 (test) of user 1014 dumped core.Stack trace of thread 7307:#0 0x00000000004004b6 main (test)#1 0x00007f67ba722291 __libc_start_main (libc.so.6)#2 0x00000000004003da _start (test)
GNU gdb (GDB) 7.12
Copyright (C) 2016 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 "x86_64-pc-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 /home/xiaonan/test...done.
[New LWP 7307]
Core was generated by `./test'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000004004b6 in main () at test.c:3
3 *p = 1;
(gdb) bt
#0 0x00000000004004b6 in main () at test.c:3

Attention should be paid. The core dump size is limited to 2GiB , so if it is too large, it will be truncated, and generate the warning like this (Please refer this bug ):

......
BFD: Warning: /var/tmp/coredump-ZrhAM4 is truncated: expected core file size >= 2591764480, found: 2147483648.
......

References:

GDB and trouble with core dumps ;

Core dump .

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: LinuxSGTIInc.2G
分页:12
转载请注明
本文标题:The core dump file in Arch Linux
本站链接:http://www.codesec.net/view/522213.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(18)