aboutsummaryrefslogtreecommitdiff
path: root/src/internal/trace/parser.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/trace/parser.go')
-rw-r--r--src/internal/trace/parser.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/internal/trace/parser.go b/src/internal/trace/parser.go
index 2e145129eb..a774bf14c9 100644
--- a/src/internal/trace/parser.go
+++ b/src/internal/trace/parser.go
@@ -12,11 +12,25 @@ import (
"math/rand"
"os"
"os/exec"
+ "path/filepath"
+ "runtime"
"strconv"
"strings"
_ "unsafe"
)
+func goCmd() string {
+ var exeSuffix string
+ if runtime.GOOS == "windows" {
+ exeSuffix = ".exe"
+ }
+ path := filepath.Join(runtime.GOROOT(), "bin", "go"+exeSuffix)
+ if _, err := os.Stat(path); err == nil {
+ return path
+ }
+ return "go"
+}
+
// Event describes one event in the trace.
type Event struct {
Off int // offset in input file (for debugging and error reporting)
@@ -757,7 +771,7 @@ func symbolize(events []*Event, bin string) error {
}
// Start addr2line.
- cmd := exec.Command("go", "tool", "addr2line", bin)
+ cmd := exec.Command(goCmd(), "tool", "addr2line", bin)
in, err := cmd.StdinPipe()
if err != nil {
return fmt.Errorf("failed to pipe addr2line stdin: %v", err)