summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.c
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-02-18 09:50:58 +0100
committerOndřej Surý <ondrej@sury.org>2011-02-18 09:50:58 +0100
commitc072558b90f1bbedc2022b0f30c8b1ac4712538e (patch)
tree67767591619e4bd8111fb05fac185cde94fb7378 /src/pkg/runtime/runtime.c
parent5859517b767c99749a45651c15d4bae5520ebae8 (diff)
downloadgolang-upstream/2011.02.15.tar.gz
Imported Upstream version 2011.02.15upstream/2011.02.15
Diffstat (limited to 'src/pkg/runtime/runtime.c')
-rw-r--r--src/pkg/runtime/runtime.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c
index 284b1e458..e3a20d48a 100644
--- a/src/pkg/runtime/runtime.c
+++ b/src/pkg/runtime/runtime.c
@@ -528,14 +528,22 @@ void
runtime·Caller(int32 skip, uintptr retpc, String retfile, int32 retline, bool retbool)
{
Func *f;
+ uintptr pc;
- if(runtime·callers(1+skip, &retpc, 1) == 0 || (f = runtime·findfunc(retpc-1)) == nil) {
+ if(runtime·callers(1+skip, &retpc, 1) == 0) {
retfile = runtime·emptystring;
retline = 0;
retbool = false;
+ } else if((f = runtime·findfunc(retpc)) == nil) {
+ retfile = runtime·emptystring;
+ retline = 0;
+ retbool = true; // have retpc at least
} else {
retfile = f->src;
- retline = runtime·funcline(f, retpc-1);
+ pc = retpc;
+ if(pc > f->entry)
+ pc--;
+ retline = runtime·funcline(f, pc);
retbool = true;
}
FLUSH(&retfile);