Patchwork libgo patch committed: Don't crash if can't get line numbers

login
register
mail settings
Submitter Ian Taylor
Date March 9, 2012, 5:32 a.m.
Message ID <mcrzkbqnxur.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/145660/
State New
Headers show

Comments

Ian Taylor - March 9, 2012, 5:32 a.m.
This patch to libgo avoids crashing the program if for some reason we
can't get line number information.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r 27261b2b1db7 libgo/go/debug/elf/runtime.go
--- a/libgo/go/debug/elf/runtime.go	Thu Mar 08 15:28:14 2012 -0800
+++ b/libgo/go/debug/elf/runtime.go	Thu Mar 08 21:28:13 2012 -0800
@@ -129,7 +129,7 @@ 
 // and line number for a PC value.
 func funcFileLine(pc uintptr, function *string, file *string, line *int) bool {
 	openExecutable()
-	if executable.dwarf == nil {
+	if executable == nil || executable.dwarf == nil {
 		return false
 	}
 	f, ln, err := executable.dwarf.FileLine(uint64(pc))