GDB Common Debug Commands

Source: Internet
Author: User

For GDB to display debugging information, the compile-time GCC should be added to the-G option, no-G will not see the function name, variable name, instead of the memory address of the runtime. Gcc-g (GDB) l corresponds to list, displaying 10 lines of source (GDB) L 10 Displays the 10 line source (GDB) carriage return at the 10th Behavior Center to repeat the last command (GDB) b                 16 set breakpoint at line 16th (GDB) b func at function func entrance set breakpoint (GDB) Info B View breakpoint information to display breakpoint number (GDB) r Run Program (GDB) n Stepping (GDB) C continue Execution (GDB) p i print variable i value (gdb) bt view function stack (GDB) s enter function inside Execution (GDB) Finish jump out function continue execution (GDB) Q exit gdb (GDB) Help View Aid (GDB) set AR GS specifies runtime parameters such as set args 1 2 (gdb) Clear 10 clears 10th line Breakpoint (GDB) Delete clears all breakpoints (GDB) Delete 1 Clear number A breakpoint of 1, you can first view the breakpoint number by Info B (gdb) Disable deactivate, but do not delete breakpoint (GDB) enable a breakpoint (GDB) show args View run parameters (GDB) b 30 if num = = 1 Conditional breakpoint, conditional statement can be expanded with {}, or not (GDB) watch I set the Observer, when the variable i is changed to stop to that line (GDB) Awatch I set the Observer, when the variable i is accessed, is changed to stop The line (GDB) Rwatch sets the observer, and when the variable i is accessed stops to the row (GDB) display I prints the value of the variable I each time it executes to a breakpoint


GDB Common Debug Commands

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.