diff options
author | crazycomputer <zhouguangyuan.xian@gmail.com> | 2021-08-22 17:26:20 +0800 |
---|---|---|
committer | Than McIntosh <thanm@google.com> | 2021-08-24 16:55:17 +0000 |
commit | daa55b21d1e7707ed251336c851841bb0eca3021 (patch) | |
tree | 33ea8b077cc744cf5adf7e437882a78de10d10f9 /src | |
parent | e6798795ff523b9b5df2514bffd8d5ce743c312e (diff) | |
download | go-daa55b21d1e7707ed251336c851841bb0eca3021.tar.gz go-daa55b21d1e7707ed251336c851841bb0eca3021.zip |
cmd/link: guarantee "section .debug_gdb_scripts" is always "$GOROOT/src/runtime/runtime-gdb.py".
to guarantee the "section .debug_gdb_scripts" is always "$GOROOT/src/runtime/runtime-gdb.py" , a check for package name is needed when search "runtime/proc.go".
Fixes #47881
Change-Id: Ib471314ca1a6777f625b488e5ae3790457540ef9
Reviewed-on: https://go-review.googlesource.com/c/go/+/344229
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/link/internal/ld/dwarf.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/dwarf.go b/src/cmd/link/internal/ld/dwarf.go index c53d2408cb..98ab248e13 100644 --- a/src/cmd/link/internal/ld/dwarf.go +++ b/src/cmd/link/internal/ld/dwarf.go @@ -1190,7 +1190,7 @@ func (d *dwctxt) writeDirFileTables(unit *sym.CompilationUnit, lsu *loader.Symbo // We can't use something that may be dead-code // eliminated from a binary here. proc.go contains // main and the scheduler, so it's not going anywhere. - if i := strings.Index(name, "runtime/proc.go"); i >= 0 { + if i := strings.Index(name, "runtime/proc.go"); i >= 0 && unit.Lib.Pkg == "runtime" { d.dwmu.Lock() if gdbscript == "" { k := strings.Index(name, "runtime/proc.go") |