This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add support for "external" reports in ThreadSanitizer LLDB plugin
ClosedPublic

Authored by kubamracek on Feb 15 2017, 8:46 PM.

Details

Summary

TSan now has the ability to report races on "external" object, i.e. any library class/object that has read-shared write-exclusive threading semantics. The detection and reporting work almost out of the box, but TSan can now provide the type of the object (as a string). This patch implements this into LLDB.

This is a new API in the TSan dylib, and we should still support cases the old dylib (that don't have the API), so the expression contains a call to dlsym to see if the new API is available or not. Let me know if there's a better solution.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek created this revision.Feb 15 2017, 8:46 PM
clayborg accepted this revision.Feb 16 2017, 8:52 AM

Looks good.

source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
89 ↗(On Diff #88654)

Doesn't "dlsym" work on all platforms? Windows?

This revision is now accepted and ready to land.Feb 16 2017, 8:52 AM
kubamracek added inline comments.Feb 16 2017, 8:54 AM
source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
89 ↗(On Diff #88654)

Right, it probably doesn't work on Windows. I'll put in a FIXME/TODO (TSan currenly only works on POSIX anyway), okay?

clayborg added inline comments.Feb 16 2017, 9:22 AM
source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
89 ↗(On Diff #88654)

Now worries, you can also #ifdef around it if needed and put the code needed for windows right in the expression text here. Does TSAN current work on Windows? If so it seems like bug to not support this feature on windows?

kubamracek added inline comments.Feb 16 2017, 9:26 AM
source/Plugins/InstrumentationRuntime/ThreadSanitizer/ThreadSanitizerRuntime.cpp
89 ↗(On Diff #88654)

TSan doesn't work on Windows.

This revision was automatically updated to reflect the committed changes.