GDB Debug Print prints out variable values or is inaccurate

Source: Internet
Author: User

The compile option is added to-O, even if it is-o0, it does not display properly, need to add-gstabs+ this compile option,
-gdwarf-2 This compilation option will conflict with-gstabs+, remove-gstabs+, only the-gdwarf-2 option can solve GDB debugging when the print variable is not allowed and some variables are not displayed.

Reference http://bbs.csdn.net/topics/390708777?page=1#post-398696875

In addition, compile the time add-wall, debug the program before, into GDB, input list will show the main () function before and after 10 lines of code, if just
-W, in the same scenario, the list does not list code. (Accidental discovery)

GDB Debug Print prints out variable values or is inaccurate

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.