diff options
| author | Keith Randall <khr@golang.org> | 2016-03-01 12:50:17 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2016-03-01 12:50:17 -0800 |
| commit | 9d854fd44ae669f60c15133a4d2ce407ea2bccc4 (patch) | |
| tree | c78f58c7e0d703df7b0cba0f0a7cbe9c0501e8bc /src/cmd/internal/obj/obj.go | |
| parent | dd0a128a02c4894f2c17ab886852d6bd10c6c721 (diff) | |
| parent | 6b3462c784df961f22eea0c39490b38093086b83 (diff) | |
| download | go-9d854fd44ae669f60c15133a4d2ce407ea2bccc4.tar.xz | |
Merge branch 'dev.ssa' into mergebranch
Merge dev.ssa branch back into master.
Change-Id: Ie6fac3f8d355ab164f934415fe4fc7fcb8c3db16
Diffstat (limited to 'src/cmd/internal/obj/obj.go')
| -rw-r--r-- | src/cmd/internal/obj/obj.go | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/cmd/internal/obj/obj.go b/src/cmd/internal/obj/obj.go index 343c93a6ee..f38078fca8 100644 --- a/src/cmd/internal/obj/obj.go +++ b/src/cmd/internal/obj/obj.go @@ -25,12 +25,13 @@ import ( // together, so that given (only) calls Push(10, "x.go", 1) and Pop(15), // virtual line 12 corresponds to x.go line 3. type LineHist struct { - Top *LineStack // current top of stack - Ranges []LineRange // ranges for lookup - Dir string // directory to qualify relative paths - TrimPathPrefix string // remove leading TrimPath from recorded file names - GOROOT string // current GOROOT - GOROOT_FINAL string // target GOROOT + Top *LineStack // current top of stack + Ranges []LineRange // ranges for lookup + Dir string // directory to qualify relative paths + TrimPathPrefix string // remove leading TrimPath from recorded file names + PrintFilenameOnly bool // ignore path when pretty-printing a line; internal use only + GOROOT string // current GOROOT + GOROOT_FINAL string // target GOROOT } // A LineStack is an entry in the recorded line history. @@ -221,20 +222,28 @@ func (h *LineHist) LineString(lineno int) string { return "<unknown line number>" } - text := fmt.Sprintf("%s:%d", stk.File, stk.fileLineAt(lineno)) + filename := stk.File + if h.PrintFilenameOnly { + filename = filepath.Base(filename) + } + text := fmt.Sprintf("%s:%d", filename, stk.fileLineAt(lineno)) if stk.Directive && stk.Parent != nil { stk = stk.Parent - text += fmt.Sprintf("[%s:%d]", stk.File, stk.fileLineAt(lineno)) + filename = stk.File + if h.PrintFilenameOnly { + filename = filepath.Base(filename) + } + text += fmt.Sprintf("[%s:%d]", filename, stk.fileLineAt(lineno)) } const showFullStack = false // was used by old C compilers if showFullStack { for stk.Parent != nil { lineno = stk.Lineno - 1 stk = stk.Parent - text += fmt.Sprintf(" %s:%d", stk.File, stk.fileLineAt(lineno)) + text += fmt.Sprintf(" %s:%d", filename, stk.fileLineAt(lineno)) if stk.Directive && stk.Parent != nil { stk = stk.Parent - text += fmt.Sprintf("[%s:%d]", stk.File, stk.fileLineAt(lineno)) + text += fmt.Sprintf("[%s:%d]", filename, stk.fileLineAt(lineno)) } } } |
