Go Language-gdb Debug

Source: Internet
Author: User
When compiling the Go Language program, pass the-gcflags "-n-l" parameter, which can ignore some optimizations made inside the go language, such as aggregation variables and functions.

Go build-gcflags "-n-l"

Common commands

  • List
    Displays the source code, the default display 10 lines, for example list 15, displays 10 lines of code, where the 15th line in the display of 10 lines inside the middle
  • Break
    Set breakpoints, followed by code line numbers or function names
  • Delete
    Delete breakpoint, followed by the sequence number of the breakpoint, this sequence number can be obtained through the info breakpoints the corresponding set breakpoint number
  • BackTrace
    Shorthand command BT, used to print the executed code procedure
  • Info
    Used to display information
    Info locals used to display the values of variables in the currently executing program
    Info breakpoints Displays a list of currently set breakpoints
    Info Goroutines Displays the list of currently executed Goroutine

  • Print
    Print variables or other information, followed by the name of the variable you want to print,

  • Whatis
    Used to display the type of the current variable followed by the variable name

  • Next
    Skip to Next step

  • Continue
    Used to jump out of the current breakpoint, continue execution, followed by parameter n, skipping the last breakpoint

  • Set Variable
    Used to change the value of variables during operation

Go Language-gdb Debug

Related Article

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.