C:release & Debug Differences (might apply to all programming languages)

Source: Internet
Author: User

Sometimes we build a program as release and when debugging, some variables cannot is printed out, and Displayed as optimized out . That's is  because the debugger (GDB) always prints a variable which locates on the stack, or resides in Memory. But in release programs, variables might is optimized to only reside on register (or sometimes not exist and is pre-calculated into other variables when compiling). So print a variable which does not exist (in memory) always get to nothing. So this time we need to learn some ASM and print the related register. Also , specify a variable as ' volatile ' should prevent  the Compiler from  Optimizing  the specified variable out From the memory.

When talking on release & Debug version of programs, both symbols and debug-info can reside in every Object-file/ex Ecutable, there is no difference between Debug & release when talking about symbols or debuginfos. Play around with Stacks, ABI & ASM is very important debugging release programs. But keep in mind symbols and Debug-infos is different. Symbols in Object Files/executables tells us which memory have the name of "a"; Debuginfos give sources. So in CentOS, installing a debuginfo of a certain package means we can then debug into the package functions (obtained the sourced version of the package libraries).

C:release & Debug Differences (might apply to all programming languages)

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.