Some common debugging commands in GDB

Source: Internet
Author: User

    • Show Version: Displays GDB version information
    • Info functions: List all the function names of the executable file
    • Step (abbreviation s): Enter function (function must have debug information)
    • Next (abbreviation N): Do not enter the function, GDB will wait for the function to finish, and then display the next line to execute the program code
    • Finish: When stepping through a function, if you do not want to continue tracking, using finish, the function will continue to execute, and print the return value
    • Return or return expression: command to specify the return value of a function
    • Call or print: as called Func (), the command calls the function execution directly
    • I frame: displaying information for function stack frames
    • B *address: Break point on the program address
    • B linenum: Break point in a line in the current file
    • Save Breakpoints FileName: Saving breakpoints in bulk
    • SOURCE FileName: Set breakpoints that were previously saved
    • Tbreak (abbreviated TB): Breakpoint only takes effect once
    • I B: View breakpoints
    • Break ... if cond: If i==10, the breakpoint will be triggered only if the condition is met
    • Ifnore bnum Count: Next count number Bnum breakpoint trigger will not cause the program to break, only the first count+1 breakpoint trigger will cause the program to break
    • Watch: The command sets the observer point, which means that when a variable value changes, the program stops
    • Set: Change the value of a string
    • Set var variable=expr: command Sets the value of the variable, such as set Var i=8;
    • Jump: When debugging a program, you may accidentally go through the wrong place and jump back

Some common debugging commands in 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.