aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-03-23 17:01:17 -0700
committerRuss Cox <rsc@golang.org>2010-03-23 17:01:17 -0700
commit2b7d147f1a916f26df6ee15ed0d54c30c7bede43 (patch)
tree975c81a35455346620a3ef101dacf2d6c7cb453a /src/pkg/runtime/runtime.c
parent32c39fa1b7dd8601addc0e7e80ce6004703834c6 (diff)
downloadgo-2b7d147f1a916f26df6ee15ed0d54c30c7bede43.tar.xz
runtime: add Callers
cut copies of traceback from 6 to 1. R=r CC=golang-dev https://golang.org/cl/703041
Diffstat (limited to 'src/pkg/runtime/runtime.c')
-rw-r--r--src/pkg/runtime/runtime.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c
index ed1bdcab8a..f4882d8bdf 100644
--- a/src/pkg/runtime/runtime.c
+++ b/src/pkg/runtime/runtime.c
@@ -481,3 +481,29 @@ nanotime(void)
gettime(&sec, &usec);
return sec*1000000000 + (int64)usec*1000;
}
+
+void
+·Caller(int32 skip, uintptr retpc, String retfile, int32 retline, bool retbool)
+{
+ Func *f;
+
+ if(callers(skip, &retpc, 1) == 0 || (f = findfunc(retpc-1)) == nil) {
+ retfile = emptystring;
+ retline = 0;
+ retbool = false;
+ } else {
+ retfile = f->src;
+ retline = funcline(f, retpc-1);
+ retbool = true;
+ }
+ FLUSH(&retfile);
+ FLUSH(&retline);
+ FLUSH(&retbool);
+}
+
+void
+·Callers(int32 skip, Slice pc, int32 retn)
+{
+ retn = callers(skip, (uintptr*)pc.array, pc.len);
+ FLUSH(&retn);
+}