abs = filepath.Join(h.Dir, file)
}
- // Remove leading TrimPathPrefix, or else rewrite $GOROOT to $GOROOT_FINAL.
+ // Remove leading TrimPathPrefix, or else rewrite $GOROOT to literal $GOROOT.
if h.TrimPathPrefix != "" && hasPathPrefix(abs, h.TrimPathPrefix) {
if abs == h.TrimPathPrefix {
abs = ""
} else {
abs = abs[len(h.TrimPathPrefix)+1:]
}
- } else if h.GOROOT_FINAL != "" && h.GOROOT_FINAL != h.GOROOT && hasPathPrefix(abs, h.GOROOT) {
- abs = h.GOROOT_FINAL + abs[len(h.GOROOT):]
+ } else if hasPathPrefix(abs, h.GOROOT) {
+ abs = "$GOROOT" + abs[len(h.GOROOT):]
}
if abs == "" {
abs = "??"
"cmd/internal/obj"
"fmt"
"log"
+ "os"
+ "path/filepath"
)
// funcpctab writes to dst a pc-value table mapping the code in func to the values
f.Value = int64(ctxt.Nhistfile)
f.Type = obj.SFILEPATH
f.Next = ctxt.Filesyms
+ f.Name = expandGoroot(f.Name)
ctxt.Filesyms = f
}
}
}
}
+func expandGoroot(s string) string {
+ const n = len("$GOROOT")
+ if len(s) >= n+1 && s[:n] == "$GOROOT" && (s[n] == '/' || s[n] == '\\') {
+ root := goroot
+ if final := os.Getenv("GOROOT_FINAL"); final != "" {
+ root = final
+ }
+ return filepath.ToSlash(filepath.Join(root, s[n:]))
+ }
+ return s
+}
+
const (
BUCKETSIZE = 256 * MINFUNC
SUBBUCKETS = 16
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",
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