On Wed, Jan 13, 2021 at 4:07 AM 吕飞飞 <
8654...@qq.com> wrote:
>
> Dear sir(or lady),
>
> I'm sorry to bother you again. I sent you an e-mail last year about some problems when using ThreadSanitizer and I really appreciated your reply. Currently, I have some other problems about the ThreadSanitizer. Hope you can help me to solve the following problems.
> 1. When starting the service, there is no error message when adding the parameter TSAN_OPTIONS="report_bugs=0", and no error message will be output when running the service. I want to output the error message when it is running. What should I do?
Hi Lvfeifei,
If you want tsan to print something on program start you can add
TSAN_OPTIONS="report_bugs=0 verbosity=1".
Or otherwise print something right in you program, both gcc and clang
allow to detect when compiling with tsan enabled.
> 2. I tried to use ThreadSanitizerSuppressions offline to shield unnecessary errors, but it is not very useful. It needs to add a lot of content, some of which are not effective yet. Could you give my some advice about how to solve this problem?
If a program has lots of bugs, generally there is no good solution
other than fixing these bugs.
Having said that, tsan suppressions match substrings in all frames in
all stacks, so if you add something like "race: libfoo", it should
suppress all races that mention libfoo anywhere. Though, it may
suppress some reports that are not directly related to libfoo as well.
> 3. Threadsanitizer was introduced when compiling C++ programs offline, but concurrent reading and writing problems were not found when running the program. Is this tool suitable for finding problems related to concurrent reading and writing?
Find data races (which concurrent reads and writes) is the main and
the only thing tsan does.
But reading you previous statements it seems that tsan detect lots of
races for you, so I am not sure why you are also saying that it's not
detecting races... Maybe you are asking something else?