diff mbox

libgo patch committed: Don't crash if missing debug info in runtime.Callers

Message ID CAOyqgcWe8H0q7ZJGMzd9GAQchrLT7igdRXkrpdanwdntWYr3zQ@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 23, 2015, 7:50 p.m. UTC
This patch to libgo avoids crashing if there is no debug info when
calling runtime.Callers.  This is particularly useful because memory
profiling, which is on at a low rate by default, will call
runtime.Callers even though the program itself does not call it.  This
addresses part of GCC PR 64595.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 99f1142e61a7 libgo/runtime/go-callers.c
--- a/libgo/runtime/go-callers.c	Thu Jan 22 09:09:32 2015 -0800
+++ b/libgo/runtime/go-callers.c	Fri Jan 23 11:46:26 2015 -0800
@@ -129,6 +129,11 @@ 
 error_callback (void *data __attribute__ ((unused)),
 		const char *msg, int errnum)
 {
+  if (errnum == -1)
+    {
+      /* No debug info available.  Carry on as best we can.  */
+      return;
+    }
   if (errnum != 0)
     runtime_printf ("%s errno %d\n", msg, errnum);
   runtime_throw (msg);