(now in plain-text mode). ASan calls this function only for global variables (not functions). It is needed because we use a different machinery to pass global names to ASan runtime - we register globals by a call from instrumented code, which also tells runtime the (mangled) global name.
OTOH, in TSan we rely on symbolization to demangle names of global variables. > > From what I can see, even when > you are using llvm-symbolizer, sanitizer_common doesn't pass -demangle > option to it. -demangle defaults to "on" in llvm-symbolizer. On Fri, Dec 6, 2013 at 12:51 PM, Dmitry Vyukov <dvyu...@google.com> wrote: > On Fri, Dec 6, 2013 at 12:25 PM, Jakub Jelinek <ja...@redhat.com> wrote: >> On Fri, Dec 06, 2013 at 12:19:45PM +0400, Dmitry Vyukov wrote: >>> > And the reason why check-g++ tsan.exp fails even with this patch is >>> > that apparently tsan doesn't try to demangle the symbol names, so we get >>> > e.g.: >>> >>> Demangling must be done by the symbolizer. >>> +samsonov for this >> >> So why does asan_report.cc have then: >> static const char *MaybeDemangleGlobalName(const char *name) { >> // We can spoil names of globals with C linkage, so use an heuristic >> // approach to check if the name should be demangled. >> return (name[0] == '_' && name[1] == 'Z') >> ? Symbolizer::Get()->Demangle(name) >> : name; >> } >> and uses it where it wants to demangle? > > I would say this is a defect. It's symbolizer responsibility. > >> From what I can see, even when >> you are using llvm-symbolizer, sanitizer_common doesn't pass -demangle >> option to it. > > > It defaults to true: > static cl::opt<bool> > ClDemangle("demangle", cl::init(true), cl::desc("Demangle function names")); -- Alexey Samsonov, MSK