You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set CGO_CFLAGS=-O2 -g
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\***\AppData\Local\Temp\go-build1712504696=/tmp/go-build -gno-record-gcc-switches
The Go linker sets the IMAGE_FILE_DEBUG_STRIPPED PE characteristic for all internal-linked binaries. The PE format docs defines this characteristic as:
Debugging information is removed from the image file.
This definition is misleading, it does not really mean that the debugging information has been completely deleted, but that it has been removed from the PE file and moved into a DBG file.
DBG files have been superseded by PDB files, which are now more commonly used for debugging.
You can use the REBASE.EXE utility to strip debug information from a PE-format executable and store it in a DBG file. The file characteristic field IMAGE_FILE_DEBUG_STRIPPED in the PE file header tells the debugger that Codeview information has been stripped to a separate DBG file.
The Go linker is not creating a DBG file with debugging information, so it should not set the IMAGE_FILE_DEBUG_STRIPPED characteristic, else some tools, such as SymChk, will report a validation error if the corresponding DBG file is not found (see following sections for an example of a symchk execution).
This small PE incompliance has been there since the very beginning without anyone complaining. That's because Go binaries don't contain Windows-native debugging information (CodeView, DBG, PDB, ...), so there is no need to run debugging-related tools on them. My team at Microsoft is trying to improve this situation by generating PDB files from Go binaries so they can be debugged by WinDbg and friends (the tool is not public yet, but we plan to open-source it at some point). In this new context, having the IMAGE_FILE_DEBUG_STRIPPED characteristic is annoying, as debugging tools first try to search for a DBG file instead of going directly to the PDB, possibly reporting an error while doing so.