Linux every day-compile and Debug Programs

Source: Internet
Author: User

Compile with GCCProgram, The simplest usage is as follows:

GCC helloworld. C-o helloworld

To load the symbol file into the compiled file, you must use

GCC helloworld. C-g-o helloworld

 

You can use GDB for debugging., Similar to debug in Windows or windbg, the simplest usage is

GDB helloworld

Break, B: Set the breakpoint, which is equivalent to the BP in windbg.

Continue, C: continue running, similar to g in windbg

Run, R: run the program

Nexti, ni: Step, equivalent to F10 of windbg

Start: run the main function.

Info all-register: view all registers, similar to R in windbg

P $ EIP/EBP/...: view a register

P variable name: view a variable value

L: can be listedSource codeIf your executable file contains debugging information (for example, compile with GCC-g)

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.