diff mbox

libgo patch committed: Recognize morestack.S if no function name

Message ID mcr622duetw.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 31, 2013, 11:12 p.m. UTC
When using an old assembler it's possible to get debug info that says
that a PC is in morestack.S but does not have the function name.  This
patch changes the Go backtrace code to recognize this case.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian
diff mbox

Patch

diff -r 388d41792584 libgo/runtime/go-callers.c
--- a/libgo/runtime/go-callers.c	Thu Jan 31 11:43:44 2013 -0800
+++ b/libgo/runtime/go-callers.c	Thu Jan 31 15:11:01 2013 -0800
@@ -34,13 +34,24 @@ 
   /* Skip split stack functions.  */
   if (function != NULL)
     {
-      const char *p = function;
+      const char *p;
 
+      p = function;
       if (__builtin_strncmp (p, "___", 3) == 0)
 	++p;
       if (__builtin_strncmp (p, "__morestack_", 12) == 0)
 	return 0;
     }
+  else if (filename != NULL)
+    {
+      const char *p;
+
+      p = strrchr (filename, '/');
+      if (p == NULL)
+	p = filename;
+      if (__builtin_strncmp (p, "morestack.S", 11) == 0)
+	return 0;
+    }
 
   if (arg->skip > 0)
     {