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

Alexey Samsonov vonosmas at gmail.com
Fri Jun 13 15:56:46 PDT 2014


On Fri, Jun 6, 2014 at 5:44 AM, Sergey Matveev <earthdok at google.com> wrote:

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

Submitted as r210950.


>
>
>
> 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(); }
>>>
>>
>>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>


-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140613/d2faaf29/attachment.html>


More information about the llvm-commits mailing list