diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2022-08-09 22:41:06 +0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-08-09 17:17:44 +0000 |
| commit | 9c5cae08928a885616f54d8df50a43713b95db7a (patch) | |
| tree | 8c30a2dea9c96c41ee5afef98cb9d5e5da3244e4 /src/debug | |
| parent | 7d70779db5893a4ac1c4746f463b5aa0b4d7e527 (diff) | |
| download | go-9c5cae08928a885616f54d8df50a43713b95db7a.tar.xz | |
debug/gosym: fix missing symbol version for 1.2+ pclntab
Updates #37762
Change-Id: Ib587f472304a04ebd9794666228f81ae6cb5c2a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/422315
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/debug')
| -rw-r--r-- | src/debug/gosym/pclntab.go | 11 | ||||
| -rw-r--r-- | src/debug/gosym/pclntab_test.go | 14 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/debug/gosym/pclntab.go b/src/debug/gosym/pclntab.go index 1aed5ed7e7..5832ded6ea 100644 --- a/src/debug/gosym/pclntab.go +++ b/src/debug/gosym/pclntab.go @@ -312,11 +312,12 @@ func (t *LineTable) go12Funcs() []Func { f.LineTable = t f.FrameSize = int(info.deferreturn()) syms[i] = Sym{ - Value: f.Entry, - Type: 'T', - Name: t.funcName(info.nameoff()), - GoType: 0, - Func: f, + Value: f.Entry, + Type: 'T', + Name: t.funcName(info.nameoff()), + GoType: 0, + Func: f, + goVersion: t.version, } f.Sym = &syms[i] } diff --git a/src/debug/gosym/pclntab_test.go b/src/debug/gosym/pclntab_test.go index 04b5fcc283..e380bb5ad7 100644 --- a/src/debug/gosym/pclntab_test.go +++ b/src/debug/gosym/pclntab_test.go @@ -268,6 +268,20 @@ func TestPCLine(t *testing.T) { } } +func TestSymVersion(t *testing.T) { + skipIfNotELF(t) + + table := getTable(t) + if table.go12line == nil { + t.Skip("not relevant to Go 1.2+ symbol table") + } + for _, fn := range table.Funcs { + if fn.goVersion == verUnknown { + t.Fatalf("unexpected symbol version: %v", fn) + } + } +} + // read115Executable returns a hello world executable compiled by Go 1.15. // // The file was compiled in /tmp/hello.go: |
