Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug/pe: decoding dwarf section failure #11608

Closed
alexbrainman opened this issue Jul 6, 2015 · 1 comment
Closed

debug/pe: decoding dwarf section failure #11608

alexbrainman opened this issue Jul 6, 2015 · 1 comment

Comments

@alexbrainman
Copy link
Member

C:\dev\go\src\debug\pe>go version
go version devel +d5994f4 Sun Jul 5 22:07:46 2015 +0000 windows/386

C:\dev\go\src\debug\pe>git diff
diff --git a/src/debug/pe/file_test.go b/src/debug/pe/file_test.go
index 0d73969..aa03459 100644
--- a/src/debug/pe/file_test.go
+++ b/src/debug/pe/file_test.go
@@ -5,7 +5,12 @@
 package pe

 import (
+   "io/ioutil"
+   "os"
+   "os/exec"
+   "path/filepath"
    "reflect"
+   "runtime"
    "testing"
 )

@@ -241,3 +246,37 @@ func TestOpenFailure(t *testing.T) {
        t.Errorf("open %s: succeeded unexpectedly", filename)
    }
 }
+
+func TestDWARF(t *testing.T) {
+   if runtime.GOOS != "windows" {
+       t.Skip("Skipping windows only test.")
+   }
+
+   tmpdir, err := ioutil.TempDir("", "TestDWARF")
+   if err != nil {
+       t.Fatal("TempDir failed: ", err)
+   }
+   defer os.RemoveAll(tmpdir)
+
+   prog := `
+package main
+func main() {
+}
+`
+   src := filepath.Join(tmpdir, "a.go")
+   exe := filepath.Join(tmpdir, "a.exe")
+   err = ioutil.WriteFile(src, []byte(prog), 0644)
+   output, err := exec.Command("go", "build", "-o", exe, src).CombinedOutput()
+   if err != nil {
+       t.Fatalf("building test executable failed: %s %s", err, string(output))
+   }
+
+   f, err := Open(exe)
+   if err != nil {
+       t.Fatal(err)
+   }
+   _, err = f.DWARF()
+   if err != nil {
+       t.Fatal(err)
+   }
+}

C:\dev\go\src\debug\pe>go test -v -run=DWARF
=== RUN   TestDWARF
--- FAIL: TestDWARF (3.80s)
        file_test.go:280: decoding dwarf section info at offset 0x1e7ff: underflow
FAIL
exit status 1
FAIL    debug/pe        3.905s

C:\dev\go\src\debug\pe>

Alex

@alexbrainman alexbrainman added this to the Go1.5Maybe milestone Jul 6, 2015
@gopherbot
Copy link

CL https://golang.org/cl/11950 mentions this issue.

@mikioh mikioh modified the milestones: Go1.5, Go1.5Maybe Jul 10, 2015
@golang golang locked and limited conversation to collaborators Jul 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants