summaryrefslogtreecommitdiff
path: root/libgo/go/debug
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-29 20:52:43 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-29 20:52:43 +0000
commit12ebd6294172cc1108bbadab78fea03e890a6da4 (patch)
tree4f2fad1f4b778519bdd5941185c7e1d032af055b /libgo/go/debug
parent6effa4dc115122a3a4838de0a302dfcadcefeeca (diff)
downloadgcc-12ebd6294172cc1108bbadab78fea03e890a6da4.tar.gz
libgo: Update Go library to master revision 15489/921e53d4863c.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195560 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/debug')
-rw-r--r--libgo/go/debug/gosym/pclntab_test.go14
-rw-r--r--libgo/go/debug/gosym/symtab.go12
2 files changed, 22 insertions, 4 deletions
diff --git a/libgo/go/debug/gosym/pclntab_test.go b/libgo/go/debug/gosym/pclntab_test.go
index ade704335d1..20acba612f2 100644
--- a/libgo/go/debug/gosym/pclntab_test.go
+++ b/libgo/go/debug/gosym/pclntab_test.go
@@ -52,6 +52,14 @@ func dotest() bool {
return true
}
+func endtest() {
+ if pclineTempDir != "" {
+ os.RemoveAll(pclineTempDir)
+ pclineTempDir = ""
+ pclinetestBinary = ""
+ }
+}
+
func getTable(t *testing.T) *Table {
f, tab := crack(os.Args[0], t)
f.Close()
@@ -95,6 +103,7 @@ func TestLineFromAline(t *testing.T) {
if !dotest() {
return
}
+ defer endtest()
tab := getTable(t)
@@ -129,7 +138,7 @@ func TestLineFromAline(t *testing.T) {
if !ok {
t.Errorf("file %s starts on line %d", path, line)
} else if line != ll+1 {
- t.Errorf("expected next line of file %s to be %d, got %d", path, ll+1, line)
+ t.Fatalf("expected next line of file %s to be %d, got %d", path, ll+1, line)
}
lastline[path] = line
}
@@ -142,6 +151,7 @@ func TestLineAline(t *testing.T) {
if !dotest() {
return
}
+ defer endtest()
tab := getTable(t)
@@ -183,7 +193,7 @@ func TestPCLine(t *testing.T) {
if !dotest() {
return
}
- defer os.RemoveAll(pclineTempDir)
+ defer endtest()
f, tab := crack(pclinetestBinary, t)
text := f.Section(".text")
diff --git a/libgo/go/debug/gosym/symtab.go b/libgo/go/debug/gosym/symtab.go
index 52d7d55a339..cc01e0b9d69 100644
--- a/libgo/go/debug/gosym/symtab.go
+++ b/libgo/go/debug/gosym/symtab.go
@@ -13,6 +13,7 @@ package gosym
// and the Go format is the runtime source, specifically ../../runtime/symtab.c.
import (
+ "bytes"
"encoding/binary"
"fmt"
"strconv"
@@ -104,11 +105,18 @@ type sym struct {
name []byte
}
+var littleEndianSymtab = []byte{0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00}
+
func walksymtab(data []byte, fn func(sym) error) error {
+ var order binary.ByteOrder = binary.BigEndian
+ if bytes.HasPrefix(data, littleEndianSymtab) {
+ data = data[6:]
+ order = binary.LittleEndian
+ }
var s sym
p := data
for len(p) >= 6 {
- s.value = binary.BigEndian.Uint32(p[0:4])
+ s.value = order.Uint32(p[0:4])
typ := p[4]
if typ&0x80 == 0 {
return &DecodingError{len(data) - len(p) + 4, "bad symbol type", typ}
@@ -139,7 +147,7 @@ func walksymtab(data []byte, fn func(sym) error) error {
}
s.name = p[0:i]
i += nnul
- s.gotype = binary.BigEndian.Uint32(p[i : i+4])
+ s.gotype = order.Uint32(p[i : i+4])
p = p[i+4:]
fn(s)
}