[Move post] GDB usage notes

Source: Internet
Author: User
GDB is a major debugging tool in Linux programming on a non-graphical interface. Therefore, it is very important to master the gdb debugging technology. Below are some of the main debugging options for GDB:

1. The compilation contains debugging information: gcc-g-o test. c
2. Run GDB: GDB
3. Load the executable file: file test
4. Display Source code : List, abbreviated as l
5. Add a breakpoint: Break <line number>, abbreviated as B
6. view the breakpoint information: info B
7. Run Code : Run, abbreviated as R, stops running to the breakpoint
8. view the variable value: Print X, abbreviated as P
9. Set the observation point: Watch X. When the X value changes, the values before and after the changes are displayed.
10. One-step execution without entering the function: Next, abbreviated as N
One-step execution to enter the function: Step, abbreviated as s
11. Program Continue execution: Continue, abbreviated as C
12. temporarily block breakpoints: Disable <breakpoint number>
Enable breakpoint: Enable <breakpoint number>
Delete breakpoint: Clear <row number>
Delete <breakpoint number>, abbreviated as d
13. Exit GDB: Quit or Ctrl + D, abbreviated as Q

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.