1
0
mirror of https://github.com/golang/go synced 2024-10-03 06:21:21 -06:00

debug/gosym: skip tests when .gosymtab section not found

Skip the test when there is no .gosymtab section in the executable
rather than crashing.

Change-Id: Ieb3df07e307f50c33cdafab38f9b5d1ac0e55c04
Reviewed-on: https://go-review.googlesource.com/5110
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
Michael Hudson-Doyle 2015-02-18 14:58:13 +13:00 committed by Ian Lance Taylor
parent 0eadcc886e
commit 8bf0ed5147

View File

@ -84,7 +84,11 @@ func crack(file string, t *testing.T) (*elf.File, *Table) {
} }
func parse(file string, f *elf.File, t *testing.T) (*elf.File, *Table) { func parse(file string, f *elf.File, t *testing.T) (*elf.File, *Table) {
symdat, err := f.Section(".gosymtab").Data() s := f.Section(".gosymtab")
if s == nil {
t.Skip("no .gosymtab section")
}
symdat, err := s.Data()
if err != nil { if err != nil {
f.Close() f.Close()
t.Fatalf("reading %s gosymtab: %v", file, err) t.Fatalf("reading %s gosymtab: %v", file, err)