debugging - How do I debug a program written in the Go language? -
How do I debug a go program? I am using it, but there is no debugging in it. Is there any way to move my code and monitor memory? Or did I get stuck with the print statement? Can i use it
Update : Now is an official page docs on this reply written It was because a lot has changed, and the following limitations have been removed. I'm progressively leaving this whole answer, but if you want to debug the go code, then follow the link above.
DBL debugging decoding dialogs which can be translated by GDB version 7.x.
Highlight the above written blog post:
You can ...
- Load a go program in GDB version 7.x
- List all Go, C and Assembly source files by line (some parts of Go Runtime are written in C and Assembly),
- Set the breakpoint from the line and the code Step by step,
- Inspect the print stack mark and stack frame, and
- Find the address and select the most variables. Print AOL Content.
There are still some disadvantages:
- The emitted DWARF code is unreadable by GDB version 6.x of ships with Mac OS X. We would gladly accept the patches to make the DWARF output compatible with standard OS X GDB, but unless it is unsuccessful for you to download, create and install GDB 7.x to use it under OS X Will be required. Can be found at the source. Due to OS X details, you will need to install binary with chgrp procmod and chmod g + s on the local file system.
- Names are eligible with a package name, and as GDB does not understand the packages, you must reference each item by its full name. For example, in the main name of the package, variable v should be referenced as 'main.v', one result of it in single quote is that tabs of variables and function names are not working properly.
- Lexical scrolling information is somewhat unclear if there are several variables of the same name, then the nth example will have the suffix of the form '#', we are planning to fix it, but it is compiler and Some changes will be required in the data transmitted between the linker.
- Slice and string variables are displayed in the runtime library as their underlying structure. They will see something {data = 0x2aaaaab3e320, len = 1, cap = 1}. For slices, you must notify the data pointer to inspect the elements.
Some things do not work:
- Channels, functions, interfaces, and map variables can not be inspected.
- Only the variable types are annotated with information; There are no C variables of runtime.
- Windows and ARM binaries do not contain DWARF debugging information and, therefore, can not be inspected with GDB.
Comments
Post a Comment