OSDN Git Service

runtime: Tweak runtime.Callers for Go 1 compatibility.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 May 2012 21:53:14 +0000 (21:53 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 May 2012 21:53:14 +0000 (21:53 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@187782 138bc75d-0d04-0410-961f-82ee72b054a4

libgo/runtime/go-callers.c

index 2d8fce7..3eea5f2 100644 (file)
@@ -72,5 +72,8 @@ int Callers (int, struct __go_open_array)
 int
 Callers (int skip, struct __go_open_array pc)
 {
 int
 Callers (int skip, struct __go_open_array pc)
 {
-  return runtime_callers (skip, (uintptr *) pc.__values, pc.__count);
+  /* 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.  */
+  return runtime_callers (skip - 1, (uintptr *) pc.__values, pc.__count);
 }
 }