cmd/link: paths in debug_line contain a mix of forward and backward slashes with Go 1.14beta1/Windows #36495
What the title says. It used to be that debug_line uniformly used forward slashes
This happens reliably when building with
Existing versions of Delve will have a problem with this but the fix is simple and I have already implemented it. However the behavior seems unintentional enough that I thought I'd report it.
I'm blaming cmd/link entirely without proof, it could be something else.
Since Windows doesn't have a handy utility to examine debug_line I wrote this script:
@gopherbot please add label Debugging
The text was updated successfully, but these errors were encountered:
This patch changes the way the linker emits the DWARF line table prologue, specifically the file table. Previously files were left unmodified, and the directory table was empty. For each compilation unit we now scan the unit file table and build up a common set of directories, emit them into the directory table, and then emit file entries that refer to the dirs. This provides a modest binary size savings. For kubernetes kubelet: $ objdump -h /tmp/kubelet.old | fgrep debug_line 36 .zdebug_line 019a55f5 0000000000000000 0000000000000000 084a5123 2**0 $ objdump -h /tmp/kubelet.new | fgrep debug_line 36 .zdebug_line 01146fd2 0000000000000000 0000000000000000 084a510a 2**0 [where the value following the section name above is the section size in hex, so roughly a 30% decrease in this case.] The actual savings will depend on the length of the pathnames involved, so it's hard to really pin down how much savings we'll see here. In addition, emitting the files this way reduces the "compressibility" of the line table, so there could even be cases where we don't win at all. Updates #6853, #19784, #36495. Change-Id: I298d8561da5ed3ebc9d38aa772874851baa2f4f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/263017 Run-TryBot: Than McIntosh <firstname.lastname@example.org> TryBot-Result: Go Bot <email@example.com> Reviewed-by: Austin Clements <firstname.lastname@example.org> Trust: Than McIntosh <email@example.com>