[ubsan] Honor color option (was: Let lsan honor color option)

Sergey Matveev earthdok at google.com
Fri Jun 6 05:44:50 PDT 2014


Makes sense, but maybe we should refactor to use SanitizerCommonDecorator
instead. I'll let UBSan folks have their say.


On Fri, Jun 6, 2014 at 1:20 PM, Stephan Bergmann <sbergman at redhat.com>
wrote:

> On 06/04/2014 07:05 PM, Sergey Matveev wrote:
>
>> Thanks, fixed in r210199.
>>
>
> ...and, in a similar vein, for ubsan (it cannot simply use
> SanitizerCommonDecorator as that inherits AnsiColorDecorator protected).
>  Works at least when -fsanitize=undefined is used in combination with
> another sanitizer like -fsanitize=address and ASAN_OPTIONS=color=always:
>
>  Index: lib/ubsan/ubsan_diag.cc
>> ===================================================================
>> --- lib/ubsan/ubsan_diag.cc     (revision 210250)
>> +++ lib/ubsan/ubsan_diag.cc     (working copy)
>> @@ -265,7 +265,7 @@
>>  }
>>
>>  Diag::~Diag() {
>> -  __sanitizer::AnsiColorDecorator Decor(PrintsToTty());
>> +  __sanitizer::AnsiColorDecorator Decor(ColorizeReports());
>>    SpinMutexLock l(&CommonSanitizerReportMutex);
>>    Printf(Decor.Bold());
>>
>>
> Stephan
>
>
>  Generally, compiler-rt patches should be posted to llvm-commits, not
>> cfe-commits.
>>
>>
>> On Wed, Jun 4, 2014 at 8:12 PM, Stephan Bergmann <sbergman at redhat.com
>> <mailto:sbergman at redhat.com>> wrote:
>>
>>     The below change to trunk projects/compiler-rt makes
>>     ASAN_OPTIONS=detect_leaks=1:__color=always colorize the
>>     LeakSanitizer output as intended:
>>
>>         Index: lib/lsan/lsan_common.cc
>>         ==============================__============================
>> ==__=======
>>         --- lib/lsan/lsan_common.cc     (revision 210183)
>>         +++ lib/lsan/lsan_common.cc     (working copy)
>>         @@ -133,7 +133,7 @@
>>
>>           class Decorator: private __sanitizer::__AnsiColorDecorator {
>>            public:
>>         -  Decorator() :
>>         __sanitizer::__AnsiColorDecorator(__PrintsToTtyCached()) { }
>>         +  Decorator() :
>>         __sanitizer::__AnsiColorDecorator(__ColorizeReports()) { }
>>             const char *Error() { return Red(); }
>>             const char *Leak() { return Blue(); }
>>             const char *End() { return Default(); }
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140606/2094ff4a/attachment.html>


More information about the llvm-commits mailing list