runtime: Tweak runtime.Callers for Go 1 compatibility.

From-SVN: r187782
This commit is contained in:
Ian Lance Taylor 2012-05-22 21:53:14 +00:00
parent c0b23f18aa
commit dfd5362d8c
1 changed files with 4 additions and 1 deletions

View File

@ -72,5 +72,8 @@ int Callers (int, struct __go_open_array)
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);
}