This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Don't demangle names not starting with "_Z"
ClosedPublic

Authored by kubamracek on Nov 13 2015, 1:49 AM.

Details

Summary

I noticed that when a symbol is named just "x", it gets demangled to "long long". On POSIX, AFAIK, mangled names always start with "_Z", so lets just require that.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 40117.Nov 13 2015, 1:49 AM
kubamracek retitled this revision from to [tsan] Don't demangle names not starting with "_Z".
kubamracek updated this object.
kubamracek added reviewers: dvyukov, glider, kcc, samsonov.
dvyukov accepted this revision.Nov 13 2015, 2:34 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Nov 13 2015, 2:34 AM
glider added inline comments.Nov 13 2015, 2:38 AM
lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
51 ↗(On Diff #40117)

Please make sure name[1] is addressable (BTW do we always know name is not NULL?)

dvyukov added inline comments.Nov 13 2015, 4:58 AM
lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
51 ↗(On Diff #40117)

Assuming that name is NULL, this check is OK. If the string of zero length we will bail out after checking name[0] (which is addressable and contains 0)

glider accepted this revision.Nov 13 2015, 5:02 AM
glider edited edge metadata.

LGTM

lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
51 ↗(On Diff #40117)

s/NULL/not NULL

agreed

This revision was automatically updated to reflect the committed changes.

Reverted in r253129. There were ARM bot failures: http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/9068

I guess the (de)mangling rules are different there?

glider added a subscriber: glider.Nov 16 2015, 2:56 AM

That's quite strange, I thought name mangling rules depend on the
language/compiler, not the architecture.

By the way, I think we must not demangle names starting with double underscores.