GDB uses collation records under Linux

Source: Internet
Author: User

1. Create CPP file: Vim sourcefile.cpp

2. Generate executable file: g++-G sourcefile.cpp-o exename

------is said to be required to add the-g parameter, otherwise it cannot be debugged

3. Start Debugging: Enter GDB (Fuck it) into the GDB environment

4. Enter file EXEName (tell gdb to debug)

5. Enter the L (list) to view the code, enter repeat the previous command

6. Breakpoint Settings: B Main Adds a breakpoint to the main function entry

-------Break 5: Set a breakpoint on line 5th; I B (info break) View breakpoint information

7. Enter R (run) to start running code at the breakpoint

8. Enter the S (step) Single Step entry function

9. You can enter N: one-step debugging; Enter print var (abbreviation: P var) to see the value of the variable bar

------View Stack BT, down and up can be one print stack information. BT prints all stack information directly.

10. Debug end, Input C (continue) run to end

-----or Q (quit) exit

Question: What if the code is wrong and cannot generate the executable file??

GDB uses collation records under Linux

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.