About Golang's debug

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Debuggers

Application programming needs good debugging support, and in this area still a lot of work needs to is done. A Debugger (Oogle): Support for GDB (at least version 7 was needed), the GNU debugger is being built in Go ' GC linker (6l, 8l) by the Go-team from Google (not for Windows and arm-platforms) (see also Http://blog.golang.org/2010/11/debugging)

Support for GDB version 7.1 is the build in Liteide and Goclipse.

If you don ' t want to use a debugger, the following is useful in a simple debugging strategy:

1) Use Print-statements (with Print/println and the FMT. Print functions) at the chosen Places 2) in FMT. Printf functions use the following specifiers to obtain complete info about variables:%+v gives us a complete output of t He instance with it fields% #v gives us a total output of the instance with it fields and qualified type name%T give S us the complete type specification

The To Go

35

3) Use a panic-statement (see§13.2) to obtain a stack trace (a list of all the called functions up until that moment) 4) Use the Defer keyword in tracing code execution (see§6.4).


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.