GDB Debug Go Program Advanced

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Purpose: Use GDB to attach to a running process, then do some debugging and safely exit.

1. Modify the Ubuntu configuration to allow gdb to attach to the process, and how to modify the following:
Http://askubuntu.com/questions/41629/after-upgrade-gdb-wont-attach-to-process

2. View the process ID #ps ax or #ps au

3. Start GDB

4. Use the file command to specify the program source code and symbol table that the process is contacting, for example:

File/home/yourihua/workplace/rhino/bin/console

5. Attach < process id>

6. Break point, as follows:

B/home/yourihua/workplace/rhino/src/github.com/yourihua/console/app/controllers/app.go:10

7. Enter C and the process continues to run.

8. Ctrl + C interrupts again, back to the GDB command line, and enter: Detach.
After you have finished debugging, you can use this command to disconnect the process from GDB (to end GDB's control of the process), after which the process you are debugging will continue to run.

Reference article:
Http://www.cnblogs.com/whiteyun/archive/2011/10/17/2215532.html

In the end, GDB is inseparable from Daniel, Yuhen's patient help.

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.