ogle: remove gosym from server
Use the newly parsed DWARF information instead.
Tested on Linux; server's Frames method still works.

LGTM=nigeltao
R=nigeltao
https://golang.org/cl/110970046
diff --git a/program/server/server.go b/program/server/server.go
index bf7150b..868a4d2 100644
--- a/program/server/server.go
+++ b/program/server/server.go
@@ -16,8 +16,6 @@
 	"sync"
 	"syscall"
 
-	"code.google.com/p/ogle/gosym"
-
 	"code.google.com/p/ogle/debug/dwarf"
 	"code.google.com/p/ogle/debug/elf"
 	"code.google.com/p/ogle/debug/macho"
@@ -36,7 +34,6 @@
 	arch       arch.Architecture
 	executable string // Name of executable.
 	dwarfData  *dwarf.Data
-	table      *gosym.Table
 
 	mu sync.Mutex
 
@@ -75,7 +72,7 @@
 		return nil, err
 	}
 	defer fd.Close()
-	architecture, dwarfData, table, err := loadExecutable(fd)
+	architecture, dwarfData, err := loadExecutable(fd)
 	if err != nil {
 		return nil, err
 	}
@@ -83,7 +80,6 @@
 		arch:        *architecture,
 		executable:  executable,
 		dwarfData:   dwarfData,
-		table:       table,
 		fc:          make(chan func() error),
 		ec:          make(chan error),
 		breakpoints: make(map[uint64]breakpoint),
@@ -92,70 +88,50 @@
 	return srv, nil
 }
 
-func loadExecutable(f *os.File) (*arch.Architecture, *dwarf.Data, *gosym.Table, error) {
+func loadExecutable(f *os.File) (*arch.Architecture, *dwarf.Data, error) {
 	// TODO: How do we detect NaCl?
 	if obj, err := elf.NewFile(f); err == nil {
 		dwarfData, err := obj.DWARF()
 		if err != nil {
-			return nil, nil, nil, err
-		}
-
-		table, err := parseElf(obj)
-		if err != nil {
-			return nil, nil, nil, fmt.Errorf("parsing go symbol table: %v", err)
+			return nil, nil, err
 		}
 
 		switch obj.Machine {
 		case elf.EM_ARM:
-			return &arch.ARM, dwarfData, table, nil
+			return &arch.ARM, dwarfData, nil
 		case elf.EM_386:
 			switch obj.Class {
 			case elf.ELFCLASS32:
-				return &arch.X86, dwarfData, table, nil
+				return &arch.X86, dwarfData, nil
 			case elf.ELFCLASS64:
-				return &arch.AMD64, dwarfData, table, nil
+				return &arch.AMD64, dwarfData, nil
 			}
 		case elf.EM_X86_64:
-			return &arch.AMD64, dwarfData, table, nil
+			return &arch.AMD64, dwarfData, nil
 		}
-		return nil, nil, nil, fmt.Errorf("unrecognized ELF architecture")
+		return nil, nil, fmt.Errorf("unrecognized ELF architecture")
 	}
 	if obj, err := macho.NewFile(f); err == nil {
 		dwarfData, err := obj.DWARF()
 		if err != nil {
-			return nil, nil, nil, err
+			return nil, nil, err
 		}
 
 		/* TODO
 		table, err := parseMachO(obj)
 		if err != nil {
-			return nil, nil, nil, err
+			return nil, nil, err
 		}
 		*/
 		switch obj.Cpu {
 		case macho.Cpu386:
-			return &arch.X86, dwarfData, nil, nil
+			return &arch.X86, dwarfData, nil
 		case macho.CpuAmd64:
-			return &arch.AMD64, dwarfData, nil, nil
+			return &arch.AMD64, dwarfData, nil
 		}
-		return nil, nil, nil, fmt.Errorf("unrecognized Mach-O architecture")
+		return nil, nil, fmt.Errorf("unrecognized Mach-O architecture")
 	}
-	return nil, nil, nil, fmt.Errorf("unrecognized binary format")
-}
-
-// parseElf returns the gosym.Table representation of the old symbol tables.
-// TODO: Delete this once we know how to get PC/SPoff data out of DWARF.
-func parseElf(f *elf.File) (*gosym.Table, error) {
-	symdat, err := f.Section(".gosymtab").Data() // TODO unused.
-	if err != nil {
-		return nil, err
-	}
-	pclndat, err := f.Section(".gopclntab").Data()
-	if err != nil {
-		return nil, err
-	}
-	pcln := gosym.NewLineTable(pclndat, f.Section(".text").Addr)
-	return gosym.NewTable(symdat, pcln)
+	return nil, nil, fmt.Errorf("unrecognized binary format")
 }
 
 type file struct {
@@ -500,7 +476,11 @@
 
 	// TODO: handle walking over a split stack.
 	for i := 0; i < req.Count; i++ {
-		fp := sp + uint64(int64(s.table.PCToSPAdj(pc))) + uint64(s.arch.PointerSize)
+		fpOffset, err := s.dwarfData.PCToSPOffset(pc)
+		if err != nil {
+			return err
+		}
+		fp := sp + uint64(fpOffset)
 
 		// TODO: the returned frame should be structured instead of a hacked up string.
 		b.Reset()