From adfa87c5d754252f2bf428b38560de3d630dbe9d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 12 Jul 2011 10:19:11 -0400 Subject: [release-branch.r58] cgo: handle new Apple LLVM-based gcc from Xcode 4.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ««« CL 4607045 / 142f0bc0d6e7 cgo: handle new Apple LLVM-based gcc from Xcode 4.2 That gcc does not include enumerator names and values in its DWARF debug output. Create a data block from which we can read the values instead. Fixes #1881. R=iant CC=golang-dev https://golang.org/cl/4607045 »»» R=adg CC=golang-dev https://golang.org/cl/4708042 --- src/pkg/debug/dwarf/type.go | 4 ++-- src/pkg/debug/elf/file.go | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/pkg/debug') diff --git a/src/pkg/debug/dwarf/type.go b/src/pkg/debug/dwarf/type.go index f9acf119f3..a33785b049 100644 --- a/src/pkg/debug/dwarf/type.go +++ b/src/pkg/debug/dwarf/type.go @@ -352,8 +352,8 @@ func (d *Data) Type(off Offset) (Type, os.Error) { } } if ndim == 0 { - err = DecodeError{"info", e.Offset, "missing dimension for array"} - goto Error + // LLVM generates this for x[]. + t.Count = -1 } case TagBaseType: diff --git a/src/pkg/debug/elf/file.go b/src/pkg/debug/elf/file.go index 9ae8b413d9..220ab94083 100644 --- a/src/pkg/debug/elf/file.go +++ b/src/pkg/debug/elf/file.go @@ -546,6 +546,12 @@ func (f *File) DWARF() (*dwarf.Data, os.Error) { return dwarf.New(abbrev, nil, nil, info, nil, nil, nil, str) } +// Symbols returns the symbol table for f. +func (f *File) Symbols() ([]Symbol, os.Error) { + sym, _, err := f.getSymbols(SHT_SYMTAB) + return sym, err +} + type ImportedSymbol struct { Name string Version string -- cgit v1.3