diff options
Diffstat (limited to 'src/pkg/runtime/symtab.c')
| -rw-r--r-- | src/pkg/runtime/symtab.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/pkg/runtime/symtab.c b/src/pkg/runtime/symtab.c index 0346a420b..f29276bd7 100644 --- a/src/pkg/runtime/symtab.c +++ b/src/pkg/runtime/symtab.c @@ -437,13 +437,17 @@ runtime·findfunc(uintptr addr) // (Before enabling the signal handler, // SetCPUProfileRate calls findfunc to trigger // the initialization outside the handler.) - if(runtime·atomicload(&funcinit) == 0) { - runtime·lock(&funclock); - if(funcinit == 0) { - buildfuncs(); - runtime·atomicstore(&funcinit, 1); + // Avoid deadlock on fault during malloc + // by not calling buildfuncs if we're already in malloc. + if(!m->mallocing && !m->gcing) { + if(runtime·atomicload(&funcinit) == 0) { + runtime·lock(&funclock); + if(funcinit == 0) { + buildfuncs(); + runtime·atomicstore(&funcinit, 1); + } + runtime·unlock(&funclock); } - runtime·unlock(&funclock); } if(nfunc == 0) @@ -507,6 +511,9 @@ contains(String s, int8 *p) bool runtime·showframe(Func *f) { - // return 1; // for debugging - show all frames - return contains(f->name, ".") && !hasprefix(f->name, "runtime."); + static int32 traceback = -1; + + if(traceback < 0) + traceback = runtime·gotraceback(); + return traceback > 1 || contains(f->name, ".") && !hasprefix(f->name, "runtime."); } |
