]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix Caller
authorRuss Cox <rsc@golang.org>
Tue, 6 Apr 2010 06:36:37 +0000 (23:36 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 6 Apr 2010 06:36:37 +0000 (23:36 -0700)
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

src/pkg/log/log_test.go
src/pkg/runtime/runtime.c

index fd0b36c6eb2930d677c856138ef6e84743bc7b1c..eb4b69a2e7f03d79dbdd0b7b5fcc607a0421e96c 100644 (file)
@@ -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
 )
index 9a027d430e03fac20ec7fd3edd2c19e598dcef65..c2eee60ca43387b6da1f3557296990c4af85a215 100644 (file)
@@ -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;