mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: use current GOROOT for source file paths for standard library
This CL changes the source file information in the standard library's .a files to say "$GOROOT/src/runtime/chan.go" (with a literal "$GOROOT") instead of spelling out the actual directory. The linker then substitutes the actual $GOROOT (or $GOROOT_FINAL) as appropriate. If people download a binary distribution to an alternate location, following the instructions at https://golang.org/doc/install#install, the code before this CL would end up with source paths pointing to /usr/local/go no matter where the actual sources were. Now the source paths for built binaries will point to the actual sources (hopefully). The source line information in distributed binaries is not affected: those will still say /usr/local/go. But binaries people build themselves (their own programs, not the go distribution programs) will be correct. Fixing this path also fixes the lookup of the runtime-gdb.py file. Fixes #5533. Change-Id: I03729baae3fbd8cd636e016275ee5ad2606e4663 Reviewed-on: https://go-review.googlesource.com/18200 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
dc5315c341
commit
83746fd55a
3 changed files with 23 additions and 4 deletions
|
|
@ -87,6 +87,7 @@ func TestGdbPython(t *testing.T) {
|
|||
|
||||
args := []string{"-nx", "-q", "--batch", "-iex",
|
||||
fmt.Sprintf("add-auto-load-safe-path %s/src/runtime", runtime.GOROOT()),
|
||||
"-ex", "info auto-load python-scripts",
|
||||
"-ex", "br main.go:10",
|
||||
"-ex", "run",
|
||||
"-ex", "echo BEGIN info goroutines\n",
|
||||
|
|
@ -129,7 +130,10 @@ func TestGdbPython(t *testing.T) {
|
|||
t.Skipf("skipping because GOROOT=%s does not exist", runtime.GOROOT())
|
||||
}
|
||||
|
||||
t.Fatalf("failed to load Go runtime support: %s", firstLine)
|
||||
_, file, _, _ := runtime.Caller(1)
|
||||
|
||||
t.Logf("package testing source file: %s", file)
|
||||
t.Fatalf("failed to load Go runtime support: %s\n%s", firstLine, got)
|
||||
}
|
||||
|
||||
// Extract named BEGIN...END blocks from output
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue