diff options
author | Vedant Kumar <vsk@apple.com> | 2017-04-14 18:24:35 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-04-14 18:24:35 +0000 |
commit | 2b1eae0aa55c15353bcfb9b2736c5695636179b5 (patch) | |
tree | 859fcfcccbcfc344fdfbd7e0cf77438269e7ded1 /compiler-rt/lib/ubsan | |
parent | 9d39a9d8604c599312931638bcac59e116aebe8a (diff) | |
download | bcm5719-llvm-2b1eae0aa55c15353bcfb9b2736c5695636179b5.tar.gz bcm5719-llvm-2b1eae0aa55c15353bcfb9b2736c5695636179b5.zip |
[ubsan] Use the correct tool name in diagnostics
When using ASan and UBSan together, the common sanitizer tool name is
set to "AddressSanitizer". That means that when a UBSan diagnostic is
printed out, it looks like this:
SUMMARY: AddressSanitizer: ...
This can confuse users. Fix it so that we always use the correct tool
name when printing out UBSan diagnostics.
Differential Revision: https://reviews.llvm.org/D32066
llvm-svn: 300358
Diffstat (limited to 'compiler-rt/lib/ubsan')
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_diag.cc | 6 | ||||
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_init.cc | 6 | ||||
-rw-r--r-- | compiler-rt/lib/ubsan/ubsan_init.h | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cc b/compiler-rt/lib/ubsan/ubsan_diag.cc index c531c5f7757..bbe1e07390a 100644 --- a/compiler-rt/lib/ubsan/ubsan_diag.cc +++ b/compiler-rt/lib/ubsan/ubsan_diag.cc @@ -79,16 +79,16 @@ static void MaybeReportErrorSummary(Location Loc, ErrorType Type) { AI.line = SLoc.getLine(); AI.column = SLoc.getColumn(); AI.function = internal_strdup(""); // Avoid printing ?? as function name. - ReportErrorSummary(ErrorKind, AI); + ReportErrorSummary(ErrorKind, AI, GetSanititizerToolName()); AI.Clear(); return; } } else if (Loc.isSymbolizedStack()) { const AddressInfo &AI = Loc.getSymbolizedStack()->info; - ReportErrorSummary(ErrorKind, AI); + ReportErrorSummary(ErrorKind, AI, GetSanititizerToolName()); return; } - ReportErrorSummary(ErrorKind); + ReportErrorSummary(ErrorKind, GetSanititizerToolName()); } namespace { diff --git a/compiler-rt/lib/ubsan/ubsan_init.cc b/compiler-rt/lib/ubsan/ubsan_init.cc index b4f42c4b850..307bca37680 100644 --- a/compiler-rt/lib/ubsan/ubsan_init.cc +++ b/compiler-rt/lib/ubsan/ubsan_init.cc @@ -23,6 +23,10 @@ using namespace __ubsan; +const char *__ubsan::GetSanititizerToolName() { + return "UndefinedBehaviorSanitizer"; +} + static enum { UBSAN_MODE_UNKNOWN = 0, UBSAN_MODE_STANDALONE, @@ -35,7 +39,7 @@ static void CommonInit() { } static void CommonStandaloneInit() { - SanitizerToolName = "UndefinedBehaviorSanitizer"; + SanitizerToolName = GetSanititizerToolName(); InitializeFlags(); CacheBinaryName(); __sanitizer_set_report_path(common_flags()->log_path); diff --git a/compiler-rt/lib/ubsan/ubsan_init.h b/compiler-rt/lib/ubsan/ubsan_init.h index 103ae24d15b..f12fc2ced32 100644 --- a/compiler-rt/lib/ubsan/ubsan_init.h +++ b/compiler-rt/lib/ubsan/ubsan_init.h @@ -15,6 +15,9 @@ namespace __ubsan { +// Get the full tool name for UBSan. +const char *GetSanititizerToolName(); + // Initialize UBSan as a standalone tool. Typically should be called early // during initialization. void InitAsStandalone(); |