runtime: Do not report thunks and recover functions in backtrace.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Oct 2013 00:02:14 +0000 (00:02 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 9 Oct 2013 00:02:14 +0000 (00:02 +0000)
From-SVN: r203294

libgo/runtime/go-callers.c

index dd1cf7909b6cd71f2c8e921f4fc7a6d57bfa4d40..291dfd0d666764296c13e8b9af6baa50486788d6 100644 (file)
@@ -53,6 +53,21 @@ callback (void *data, uintptr_t pc, const char *filename, int lineno,
        return 0;
     }
 
+  /* Skip thunks and recover functions.  There is no equivalent to
+     these functions in the gc toolchain, so returning them here means
+     significantly different results for runtime.Caller(N).  */
+  if (function != NULL)
+    {
+      const char *p;
+
+      p = __builtin_strchr (function, '.');
+      if (p != NULL && __builtin_strncmp (p + 1, "$thunk", 6) == 0)
+       return 0;
+      p = __builtin_strrchr (function, '$');
+      if (p != NULL && __builtin_strcmp(p, "$recover") == 0)
+       return 0;
+    }
+
   if (arg->skip > 0)
     {
       --arg->skip;