I’m currently working on a program that is designed to run on both 32-bit and 64-bit systems. During the process of compiling it with the 386 mode, I came across some bugs that need to be resolved. Therefore, I decided to use Goland on my 64-bit system to debug the program.
I have already set up the run/debug configurations, as shown in the attached image.
Unfortunately, you cannot debug 32-bit Go programs with Delve, the de facto standard Go debugger. You can try to use gdb instead, but based on the Go documentation, it is my understanding that it can be challenging or even wrong:
GDB does not understand Go programs well. The stack management, threading, and runtime contain aspects that differ enough from the execution model GDB expects that they can confuse the debugger and cause incorrect results even when the program is compiled with gccgo. As a consequence, although GDB can be useful in some situations (e.g., debugging Cgo code, or debugging the runtime itself), it is not a reliable debugger for Go programs, particularly heavily concurrent ones. Moreover, it is not a priority for the Go project to address these issues, which are difficult.
I still use 32-bit systems and the way I “debug” them is with logging all over the place, which is far from ideal. Maybe someone else will have better information.