]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: dump symbol info on crash under -v
authorCherry Zhang <cherryyz@google.com>
Fri, 10 Jul 2020 22:53:12 +0000 (18:53 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 13 Jul 2020 21:39:20 +0000 (21:39 +0000)
If the linker panics, it usually helps dumping all symbols'
information for debugging. Do it under -v.

Change-Id: I66f9e32a0133e763a631f17a218dcdc805c5df2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/242078
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/link/internal/ld/main.go

index d9ff359b35a7d58894eb6e89b72774de13a457c0..c40e932d8bbdd9b4d5fe46179f0e54216b20f3d9 100644 (file)
@@ -136,6 +136,11 @@ func Main(arch *sys.Arch, theArch Arch) {
 
        objabi.Flagparse(usage)
 
+       if ctxt.Debugvlog > 0 {
+               // dump symbol info on crash
+               defer func() { ctxt.loader.Dump() }()
+       }
+
        switch *flagHeadType {
        case "":
        case "windowsgui":