当前位置:网站首页>core dump
core dump
2022-07-24 18:37:00 【Li-Yongjun】
Preface
Segment error ( The core has been dumped )!!!
# ./test.out
Segmentation fault (core dumped)
$ ./core.out
Segment error ( The core has been dumped )
Run a program , It happened accidentally Segment error ( The core has been dumped ), How sad . Fortunately we have core dump, It can help debug program crash problems . Let's have a chat today core dump.
summary
core dump The word comes from magnetic-core memory, This is the mainstream memory medium in the 1960s and 1970s .core Refers to memory, which is now memory .
The operating system terminates when a process receives a signal , Write the contents of the process address space and the related status information of the process to a disk file , This process is called core dump, The generated file is called core file .
core dump The scene of the crash was recorded . We can use gdb Yes core Document analysis , It's called live restore , You can see why the program crashed .
Prerequisite
a) It needs to be opened in advance core dump function , Use the following command
ulimit -c 1024
b) gcc The compiler needs to add -g Option to add debugging information .
Test environment
BananaPi M1( stay ubuntu Cannot generate core file , Students who know the method can leave a message )
The test program
test.c
#include <stdio.h>
int main(int argc, char argv)
{
int *p = NULL;
*p = 0; // Assign a value to the address pointed to by the null pointer , trigger core dump
return 0;
}
compile
$ /home/liyongjun/project/board/buildroot/BPi-M1/host/bin/arm-buildroot-linux-uclibcgnueabihf-gcc -g test.c -o test.out
core dump
stay BananaPi M1 Up operation
# ./test.out
Segmentation fault
# ulimit -c 1024
# ./test.out
Segmentation fault (core dumped)
# ls
core test.out
First run , It was found that core dump, It's because it's not enabled core dump function , Use ulimit -c 1024 After enabling , And that's what happened core dump,ls Can see core file .
gdb analysis
Upload to ubuntu Use gdb analysis
$ arm-linux-gnueabihf-gdb test.out core
GNU gdb (Linaro_GDB-2017.08) 8.0.0.20170823-git
Copyright (C) 2017 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 "--host=x86_64-unknown-linux-gnu --target=arm-linux-gnueabihf".
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 test.out...done.
[New LWP 149]
warning: Could not load shared library symbols for 2 libraries, e.g. /lib/libc.so.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `./test.out'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x004e15a0 in main (argc=1, argv=116 't') at test.c:7
7 *p = 0; // Assign a value to the address pointed to by the null pointer , trigger core dump
(gdb)
gdb Directly locate the crash point : The first 7 That's ok :*p = 0;.
边栏推荐
- 【刷题记录】20. 有效的括号
- CF. Bits And Pieces(子集状压dp + 剪枝)
- Traversal and splicing of strings
- L4l7 load balancing
- Latex mathematical formula
- EasyUI framework dialog repeated loading problem
- 线段树合并板子
- Mid year inventory | in 2022, PAAS will be upgraded again
- MySQL optimization series (2) -- InnoDB important parameter optimization
- Vsftpd2.3.4-端口渗透 6200 irc_3281_backdoor
猜你喜欢

L4L7负载均衡

C Programming classic tutorial

Attack and defense world novice zone PWN

Ionic4 learning notes 3

Ionic4 learning notes 10 rotation map of an East Project

Missing value processing

Network security port 80 - PHP CGI parameter injection Execution Vulnerability

Wechat applet reverse

Eternal Blue ms17-010exp reappears

32-bit stack overflow advanced
随机推荐
Traversal and splicing of strings
3. Variable declaration promotion?
1. Typeof view variable type?
Understand corners_ Align, two perspectives for viewing pixels
Typora is still the most beautiful and beautiful document editing artifact of yyds in my heart. I believe you will never abandon it
Show or hide password plaintext + password box verification information
16. What is the difference between target and currenttarget?
2. JS variable type conversion, automatic conversion, manual conversion, what is the difference between parseint(), parsefloat(), number()?
Go小白实现一个简易的go mock server
Techempower web framework performance test 21st round results release --asp Net core continue to move forward
Escape character in JS?
JS array method sort() collation parsing
Maximum sum and promotion of continuous subarrays (2)
【TkInter】常用组件(一)
Pytorch的旅程二:梯度下降
KiB、MiB与KB、MB的区别
Missing value processing
MySQL -- implicit conversion of data type
永恒之蓝MS17-010exp复现
Revocable search board