Helloworld of gdb

Source: Internet
Author: User
When I think of a linux teacher from Neusoft, I told me that Tianji has finished the book and just bought it, you must have read "debughacks" in a week. Fortunately, I have practiced it. what should you do ~ First ulimit-c kernel dump file size limit ulimit-c107374...

When I think of a linux teacher from Neusoft, I have finished speaking this book for two Tianji days,
I just bought a book and must finish reading it in a week.
Debug hacks
Fortunately, my grandmother, I 've practiced it, or what else would you do ~
Size limit of ulimit-c kernel dump files
Ulimit-c 1073741842
Or start
Vim/etc/profile
Java code
Ulimit-S-c unlimited>/dev/null 2> & 1

Then deliberately write an error code.
It seems that 0 is a system and cannot be accessed.
Test. c
Java code
# Include
Int main (){
Int * a = NULL;
* A = 0*1;
Return 0;
}

Gcc-p-g test. c
./A. out
Generate core *
Gdb-c core.1234./a. out
L 6
Quit

------------------
Generate a kernel dump at a fixed position/var/core/
Cat/etc/sysctl. conf
Java code
Kernel. core_pattern =/var/core/% t-% e-% p-% c. core
Kernel. core_uses_pid = 0

Sysctl-p
Cat/proc/sys/kernel/core_pattern

Author "walking on the left"
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.