Debugging Go Programs in GoClipse with Assembly Code
While attempting to debug a Go program in GoClipse, users may encounter an issue where the debugger steps through assembly code instead of Go code. This occurs despite correctly installing gdb for debugging.
When a breakpoint is set and the program is run through the Eclipse debugger, it enters assembly code files like "rt0_darwin_amd64.s" and focuses on lines like "MOVQ $_rt0_go(SB), AX." This behavior can make debugging challenging.
To address this issue, verify the contents of the Debug view when the Go program stops. If it displays a stack trace beginning with "main() at rt0_darwin_amd64.s," this indicates that the debugger has paused at an internal runtime "main" function written in C.
This behavior is controlled by the first option in the launch configuration options. To resolve it, set the option to "main.main" to stop at the actual Go main function or simply uncheck the option.
Alternatively, if the debugger stops at the internal runtime "main" function, you can click "Run / Resume" (F8) to continue execution. This will allow you to step through Go code and debug as expected.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3