Skip to content

Commit

Permalink
debug/gosym: fix missing symbol version for 1.2+ pclntab
Browse files Browse the repository at this point in the history
Updates golang#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>
  • Loading branch information
cuonglm authored and jproberts committed Aug 10, 2022
1 parent 8d530d4 commit 14bc690
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/debug/gosym/pclntab.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down
14 changes: 14 additions & 0 deletions src/debug/gosym/pclntab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 14bc690

Please sign in to comment.