From: Russ Cox Date: Tue, 6 Apr 2010 06:36:37 +0000 (-0700) Subject: runtime: fix Caller X-Git-Tag: weekly.2010-04-13~63 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6d69fd1fe378077aa99505af9cd0a64553d5df57;p=gostls13.git runtime: fix Caller log: add test of Caller New regexp in log test is picky and will require some maintenance, but it catches off-by-one mistakes too. Fixes #710. R=gri CC=esko.luontola, golang-dev https://golang.org/cl/887043 --- diff --git a/src/pkg/log/log_test.go b/src/pkg/log/log_test.go index fd0b36c6eb..eb4b69a2e7 100644 --- a/src/pkg/log/log_test.go +++ b/src/pkg/log/log_test.go @@ -17,7 +17,7 @@ const ( Rdate = `[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]` Rtime = `[0-9][0-9]:[0-9][0-9]:[0-9][0-9]` Rmicroseconds = `\.[0-9][0-9][0-9][0-9][0-9][0-9]` - Rline = `[0-9]+:` + Rline = `(58|60):` // must update if the calls to l.Logf / l.Log below move Rlongfile = `.*/[A-Za-z0-9_\-]+\.go:` + Rline Rshortfile = `[A-Za-z0-9_\-]+\.go:` + Rline ) diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c index 9a027d430e..c2eee60ca4 100644 --- a/src/pkg/runtime/runtime.c +++ b/src/pkg/runtime/runtime.c @@ -479,7 +479,7 @@ void { Func *f; - if(callers(skip, &retpc, 1) == 0 || (f = findfunc(retpc-1)) == nil) { + if(callers(1+skip, &retpc, 1) == 0 || (f = findfunc(retpc-1)) == nil) { retfile = emptystring; retline = 0; retbool = false;