Some basic operations for gdb debugging

Source: Internet
Author: User

Some basic operations for gdb debugging

1.g ++-g filename (generate a. out debuggable Program)

2. gdb a. out (enter the debugging Interface)

3. B + line number (the file containing the main function by default); B + filename: line number (specify the breakpoint in the file ).

4. info + B (view all breakpoints)

5. d + NUM (info B obtains the breakpoint number NUM). Delete the breakpoint number that is the breakpoint of NUM.

6. p + variable name (print variable value)

7. display + variable name (tracking variable, but the effective range of the variable will be invalid)

8. n next step

9. s enter the function body

10. u + line number (debugging jumps to the selected line)

11. bt (view program call Information)

12. refresh (most commonly used, a standard GUI can be generated, and all your operations can be clearly displayed)

13. The gdb debugging GUI is introduced in my blog. Similar to the debugger in vc, it has powerful functions.

14. q (exit gdb)

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.