C program debugging in Linux

Source: Internet
Author: User
C program debugging in Linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. A problem that has been plagued for several days: the code written is not always correct. In many cases, you need to debug so:

Gcc includes a good gnu Debugger: gdb, which also has a gui version called xxgdb. But that is not as simple as debugging tools in the ide provided by micro $ soft. When I started to debug the program, I couldn't load the source code, but I couldn't use assembler. After reading the manual for one night, I couldn't find any results. As a result, when I got some code today, I found that the program went wrong, it is absolutely impossible to debug without debugging. No way, just stick it to your head. Finally, after nearly 10 minutes of research, I finally got it done. It turned out that the-g switch should be added when compiling code with g ++, make the compiled binary file contain debugging information, and then load it with gdb. Everything is OK.

(The usage of gdb is quite clear in manual. The debugging method is just to add breakpoints, single-step tracking, and so on. There is nothing to say. Study it by yourself)

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.