diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:22 +0000 |
commit | 3a1720af1d7f43edc5b214cde0be11bfb94d077e (patch) | |
tree | 029e0ff2d5e3c0eaf2405fd8e669555fdf5e1297 /lib/tsan/go | |
parent | 8f3cadc28cb2bb9e8f9d69eeaaea1f57f2f7b2ab (diff) |
Notes
Diffstat (limited to 'lib/tsan/go')
-rw-r--r-- | lib/tsan/go/tsan_go.cpp (renamed from lib/tsan/go/tsan_go.cc) | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/tsan/go/tsan_go.cc b/lib/tsan/go/tsan_go.cpp index dfd1e1da158f..f5998c0c7816 100644 --- a/lib/tsan/go/tsan_go.cc +++ b/lib/tsan/go/tsan_go.cpp @@ -1,4 +1,4 @@ -//===-- tsan_go.cc --------------------------------------------------------===// +//===-- tsan_go.cpp -------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -54,20 +54,31 @@ struct SymbolizeCodeContext { }; SymbolizedStack *SymbolizeCode(uptr addr) { - SymbolizedStack *s = SymbolizedStack::New(addr); - SymbolizeCodeContext cbctx; - internal_memset(&cbctx, 0, sizeof(cbctx)); - cbctx.pc = addr; - go_runtime_cb(CallbackSymbolizeCode, &cbctx); - if (cbctx.res) { + SymbolizedStack *first = SymbolizedStack::New(addr); + SymbolizedStack *s = first; + for (;;) { + SymbolizeCodeContext cbctx; + internal_memset(&cbctx, 0, sizeof(cbctx)); + cbctx.pc = addr; + go_runtime_cb(CallbackSymbolizeCode, &cbctx); + if (cbctx.res == 0) + break; AddressInfo &info = s->info; info.module_offset = cbctx.off; info.function = internal_strdup(cbctx.func ? cbctx.func : "??"); info.file = internal_strdup(cbctx.file ? cbctx.file : "-"); info.line = cbctx.line; info.column = 0; + + if (cbctx.pc == addr) // outermost (non-inlined) function + break; + addr = cbctx.pc; + // Allocate a stack entry for the parent of the inlined function. + SymbolizedStack *s2 = SymbolizedStack::New(addr); + s->next = s2; + s = s2; } - return s; + return first; } struct SymbolizeDataContext { |