]> Cypherpunks repositories - gostls13.git/commitdiff
debug/gosym: fix missing symbol version for 1.2+ pclntab
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 9 Aug 2022 15:41:06 +0000 (22:41 +0700)
committerGopher Robot <gobot@golang.org>
Tue, 9 Aug 2022 17:17:44 +0000 (17:17 +0000)
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>
src/debug/gosym/pclntab.go
src/debug/gosym/pclntab_test.go

index 1aed5ed7e7ed6e5d089b3ee4cd24504a778b4e55..5832ded6ea6046765469f26dbab055e2cd3624b4 100644 (file)
@@ -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]
        }
index 04b5fcc2837e46f5fdcf2340acc77f2783a93432..e380bb5ad7321f7340f697548d1e2918efaf2432 100644 (file)
@@ -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: