[compiler-rt] r192705 - tsan: use verbosity flag in sanitizer_common code directly

Dmitry Vyukov dvyukov at google.com
Tue Oct 15 07:57:31 PDT 2013


On Tue, Oct 15, 2013 at 6:55 PM, Sergey Matveev <earthdok at google.com> wrote:
>> If bots set verbosity=1, then they already get output from
>> asan/sanitizer_common.
>
> No, because setting LSAN_OPTIONS="verbosity=1" did not affect ASan or
> sanitizer_common before your recent changes.

I see.
We need a separate flag for printing summary. Verbosity>0 has
basically no guarantees about content and amount of output.


> On Tue, Oct 15, 2013 at 6:48 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
>>
>> On Tue, Oct 15, 2013 at 6:38 PM, Sergey Matveev <earthdok at google.com>
>> wrote:
>> > Moving verbosity to common flags is a change that should've been
>> > discussed
>> > first. The reason why I didn't move it to common flags is because
>> > verbosity
>> > levels have different interpretations in different tools. For instance,
>> > in
>> > LSan "verbosity=1" basically means "always print summary" (I agree that
>> > it
>> > should've been a separate flag), so all Chromium bots set it to 1 (so
>> > they're going to start dumping a lot of extra output from asan and
>> > sanitizer_common now).
>>
>> If bots set verbosity=1, then they already get output from
>> asan/sanitizer_common.
>>
>>
>> > Generally, I think that if we are to reuse the same flag across
>> > different
>> > modules, we need to clearly define what information belongs at each
>> > verbosity level (i.e. make them more like error levels).
>>
>> Agree.
>> We need to unify things. But it may be impossible to do it half-way
>> though.
>>
>>
>> > On Tue, Oct 15, 2013 at 6:12 PM, Dmitry Vyukov <dvyukov at google.com>
>> > wrote:
>> >>
>> >> Author: dvyukov
>> >> Date: Tue Oct 15 09:12:26 2013
>> >> New Revision: 192705
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=192705&view=rev
>> >> Log:
>> >> tsan: use verbosity flag in sanitizer_common code directly
>> >> now it's available from common_flags()
>> >>
>> >>
>> >> Modified:
>> >>     compiler-rt/trunk/lib/lsan/lsan_interceptors.cc
>> >>     compiler-rt/trunk/lib/msan/msan_interceptors.cc
>> >>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h
>> >>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
>> >>     compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
>> >>
>> >> Modified: compiler-rt/trunk/lib/lsan/lsan_interceptors.cc
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_interceptors.cc?rev=192705&r1=192704&r2=192705&view=diff
>> >>
>> >>
>> >> ==============================================================================
>> >> --- compiler-rt/trunk/lib/lsan/lsan_interceptors.cc (original)
>> >> +++ compiler-rt/trunk/lib/lsan/lsan_interceptors.cc Tue Oct 15 09:12:26
>> >> 2013
>> >> @@ -221,7 +221,7 @@ INTERCEPTOR(int, pthread_create, void *t
>> >>      pthread_attr_init(&myattr);
>> >>      attr = &myattr;
>> >>    }
>> >> -  AdjustStackSizeLinux(attr, 0);
>> >> +  AdjustStackSizeLinux(attr);
>> >>    int detached = 0;
>> >>    pthread_attr_getdetachstate(attr, &detached);
>> >>    ThreadParam p;
>> >>
>> >> Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=192705&r1=192704&r2=192705&view=diff
>> >>
>> >>
>> >> ==============================================================================
>> >> --- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
>> >> +++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Tue Oct 15 09:12:26
>> >> 2013
>> >> @@ -1082,7 +1082,7 @@ INTERCEPTOR(int, pthread_create, void *t
>> >>      attr = &myattr;
>> >>    }
>> >>
>> >> -  AdjustStackSizeLinux(attr, common_flags()->verbosity);
>> >> +  AdjustStackSizeLinux(attr);
>> >>
>> >>    int res = REAL(pthread_create)(th, attr, callback, param);
>> >>    if (attr == &myattr)
>> >>
>> >> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h?rev=192705&r1=192704&r2=192705&view=diff
>> >>
>> >>
>> >> ==============================================================================
>> >> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h (original)
>> >> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.h Tue Oct 15
>> >> 09:12:26 2013
>> >> @@ -66,7 +66,7 @@ class ThreadLister {
>> >>    int bytes_read_;
>> >>  };
>> >>
>> >> -void AdjustStackSizeLinux(void *attr, int verbosity);
>> >> +void AdjustStackSizeLinux(void *attr);
>> >>
>> >>  // Exposed for testing.
>> >>  uptr ThreadDescriptorSize();
>> >>
>> >> Modified:
>> >> compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc?rev=192705&r1=192704&r2=192705&view=diff
>> >>
>> >>
>> >> ==============================================================================
>> >> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
>> >> (original)
>> >> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
>> >> Tue
>> >> Oct 15 09:12:26 2013
>> >> @@ -16,6 +16,7 @@
>> >>  #if SANITIZER_LINUX
>> >>
>> >>  #include "sanitizer_common.h"
>> >> +#include "sanitizer_flags.h"
>> >>  #include "sanitizer_linux.h"
>> >>  #include "sanitizer_placement_new.h"
>> >>  #include "sanitizer_procmaps.h"
>> >> @@ -272,7 +273,7 @@ void GetThreadStackAndTls(bool main, upt
>> >>  #endif  // SANITIZER_GO
>> >>  }
>> >>
>> >> -void AdjustStackSizeLinux(void *attr_, int verbosity) {
>> >> +void AdjustStackSizeLinux(void *attr_) {
>> >>    pthread_attr_t *attr = (pthread_attr_t *)attr_;
>> >>    uptr stackaddr = 0;
>> >>    size_t stacksize = 0;
>> >> @@ -284,7 +285,7 @@ void AdjustStackSizeLinux(void *attr_, i
>> >>    const uptr minstacksize = GetTlsSize() + 128*1024;
>> >>    if (stacksize < minstacksize) {
>> >>      if (!stack_set) {
>> >> -      if (verbosity && stacksize != 0)
>> >> +      if (common_flags()->verbosity && stacksize != 0)
>> >>          Printf("Sanitizer: increasing stacksize %zu->%zu\n",
>> >> stacksize,
>> >>                 minstacksize);
>> >>        pthread_attr_setstacksize(attr, minstacksize);
>> >>
>> >> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=192705&r1=192704&r2=192705&view=diff
>> >>
>> >>
>> >> ==============================================================================
>> >> --- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
>> >> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Tue Oct 15
>> >> 09:12:26 2013
>> >> @@ -882,13 +882,7 @@ TSAN_INTERCEPTOR(int, pthread_create,
>> >>    }
>> >>    int detached = 0;
>> >>    pthread_attr_getdetachstate(attr, &detached);
>> >> -
>> >> -#if defined(TSAN_DEBUG_OUTPUT)
>> >> -  int verbosity = (TSAN_DEBUG_OUTPUT);
>> >> -#else
>> >> -  int verbosity = 0;
>> >> -#endif
>> >> -  AdjustStackSizeLinux(attr, verbosity);
>> >> +  AdjustStackSizeLinux(attr);
>> >>
>> >>    ThreadParam p;
>> >>    p.callback = callback;
>> >>
>> >>
>> >> _______________________________________________
>> >> llvm-commits mailing list
>> >> llvm-commits at cs.uiuc.edu
>> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>> >
>> >
>
>



More information about the llvm-commits mailing list