cmd/go: windows binaries shouldn't be marked with IMAGE_FILE_DEBUG_STRIPPED #59391
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
OS-Windows
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputContext
The Go linker sets the
IMAGE_FILE_DEBUG_STRIPPED
PE characteristic for all internal-linked binaries. The PE format docs defines this characteristic as: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.
This other Microsoft doc explains it better:
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.What did you do?
go build -o main.exe .
symchk /v ./main.exe /s .
What did you expect to see?
What did you see instead?
@alexbrainman @golang/windows
The text was updated successfully, but these errors were encountered: