1// Copyright 2009 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package dwarf_test 6 7import ( 8 . "debug/dwarf" 9 "testing" 10) 11 12func TestSplit(t *testing.T) { 13 // debug/dwarf doesn't (currently) support split DWARF, but 14 // the attributes that pointed to the split DWARF used to 15 // cause loading the DWARF data to fail entirely (issue 16 // #12592). Test that we can at least read the DWARF data. 17 d := elfData(t, "testdata/split.elf") 18 r := d.Reader() 19 e, err := r.Next() 20 if err != nil { 21 t.Fatal(err) 22 } 23 if e.Tag != TagCompileUnit { 24 t.Fatalf("bad tag: have %s, want %s", e.Tag, TagCompileUnit) 25 } 26 // Check that we were able to parse the unknown section offset 27 // field, even if we can't figure out its DWARF class. 28 const AttrGNUAddrBase Attr = 0x2133 29 f := e.AttrField(AttrGNUAddrBase) 30 if _, ok := f.Val.(int64); !ok { 31 t.Fatalf("bad attribute value type: have %T, want int64", f.Val) 32 } 33 if f.Class != ClassUnknown { 34 t.Fatalf("bad class: have %s, want %s", f.Class, ClassUnknown) 35 } 36} 37