From 9968090dddb74e7b5cd1352d791b7cf8cb7a6045 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 13 Jun 2011 14:43:54 -0400 Subject: 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 --- 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