[note] Debug core dump with GDB

Source: Internet
Author: User

Always write once a time C + +, some things are always used up forget ... Remember how to debug the core dump with GDB before you forget it.

You first need to set the size of the core file, which is 0 by default so no core file will be generated

$ ulimit-c Unlimited

and add it to the compiled flag.

-g-rdynamic

Get the dynamic static symbol table.

And then

 Make $ # do something to make it core dump

Assuming the executable file is called test, the resulting core file is called core (Ubuntu 12.04 Yes, other systems may call other names)

$ GDB Test core$. $ (GDB) BackTrace

Then you can see the stack to debug =. =

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.