runtime: Correct handling of runtime.Callers skip parameter.
authorIan Lance Taylor <ian@gcc.gnu.org>
Sat, 2 Feb 2013 15:11:48 +0000 (15:11 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Sat, 2 Feb 2013 15:11:48 +0000 (15:11 +0000)
From-SVN: r195685

libgo/runtime/go-callers.c

index 9afba62cc992a2359436cdec2fe1f30661f0cc16..dd1cf7909b6cd71f2c8e921f4fc7a6d57bfa4d40 100644 (file)
@@ -115,8 +115,9 @@ Callers (int skip, struct __go_open_array pc)
 
   /* In the Go 1 release runtime.Callers has an off-by-one error,
      which we can not correct because it would break backward
-     compatibility.  Adjust SKIP here to be compatible.  */
-  ret = runtime_callers (skip - 1, locbuf, pc.__count);
+     compatibility.  Normally we would add 1 to SKIP here, but we
+     don't so that we are compatible.  */
+  ret = runtime_callers (skip, locbuf, pc.__count);
 
   for (i = 0; i < ret; i++)
     ((uintptr *) pc.__values)[i] = locbuf[i].pc;