diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp --- a/compiler-rt/lib/msan/msan.cpp +++ b/compiler-rt/lib/msan/msan.cpp @@ -101,9 +101,6 @@ // Array of stack origins. // FIXME: make it resizable. static const uptr kNumStackOriginDescrs = 1024 * 1024; -#ifdef kda_COMMENTED_OUT -static const char *StackOriginDescr[kNumStackOriginDescrs]; -#endif /* kda_COMMENTED_OUT */ static uptr StackOriginPC[kNumStackOriginDescrs]; static atomic_uint32_t NumStackOriginDescrs; @@ -291,9 +288,6 @@ const char *GetStackOriginDescr(u32 id, uptr *pc) { CHECK_LT(id, kNumStackOriginDescrs); if (pc) *pc = StackOriginPC[id]; -#ifdef kda_COMMENTED_OUT - return StackOriginDescr[id]; -#endif /* kda_COMMENTED_OUT */ return nullptr; } @@ -606,9 +600,6 @@ if (id == first_timer) { u32 idx = atomic_fetch_add(&NumStackOriginDescrs, 1, memory_order_relaxed); CHECK_LT(idx, kNumStackOriginDescrs); -#ifdef kda_COMMENTED_OUT - StackOriginDescr[idx] = descr + 4; -#endif /* kda_COMMENTED_OUT */ #if SANITIZER_PPC64V1 // On PowerPC64 ELFv1, the address of a function actually points to a // three-doubleword data structure with the first field containing diff --git a/compiler-rt/lib/msan/msan_report.cpp b/compiler-rt/lib/msan/msan_report.cpp --- a/compiler-rt/lib/msan/msan_report.cpp +++ b/compiler-rt/lib/msan/msan_report.cpp @@ -40,38 +40,19 @@ // For some reason function address in LLVM IR is 1 less then the address // of the first instruction. pc = StackTrace::GetNextInstructionPc(pc); - SymbolizedStack* frame = Symbolizer::GetOrInit()->SymbolizePC(pc); -#ifdef kda_COMMENTED_OUT - function_name = DemangleFunctionName(frame->info.function); -#endif /* kda_COMMENTED_OUT */ + SymbolizedStack *frame = Symbolizer::GetOrInit()->SymbolizePC(pc); // TODO: Does not work for SANITIZER_NETBSD function_name = frame->info.function; } Decorator d; - //char *s = internal_strdup(so); - //char *sep = internal_strchr(s, '@'); - //CHECK(sep); - //*sep = '\0'; Printf("%s", d.Origin()); Printf( " %sUninitialized value was created by an allocation of '%s%s%s'" " in the stack frame of function '%s%s%s'%s\n", -#ifdef kda_COMMENTED_OUT - d.Origin(), d.Name(), s, d.Origin(), d.Name(), sep + 1, d.Origin(), - d.Origin(), d.Name(), "kUNKNOWN_VARIABLEk", d.Origin(), d.Name(), "kUNKNOWN_FUNCTIONk", d.Origin(), -#endif /* kda_COMMENTED_OUT */ - d.Origin(), d.Name(), "kUNKNOWN_VARIABLEk", d.Origin(), d.Name(), function_name, d.Origin(), - d.Default()); -#ifdef kda_COMMENTED_OUT - InternalFree(s); -#endif /* kda_COMMENTED_OUT */ + d.Origin(), d.Name(), "kUNKNOWN_VARIABLEk", d.Origin(), d.Name(), + function_name, d.Origin(), d.Default()); if (pc) { -#ifdef kda_COMMENTED_OUT - // For some reason function address in LLVM IR is 1 less then the address - // of the first instruction. - pc = StackTrace::GetNextInstructionPc(pc); -#endif /* kda_COMMENTED_OUT */ StackTrace(&pc, 1).Print(); } } diff --git a/compiler-rt/test/msan/stack-origin.cpp b/compiler-rt/test/msan/stack-origin.cpp --- a/compiler-rt/test/msan/stack-origin.cpp +++ b/compiler-rt/test/msan/stack-origin.cpp @@ -1,25 +1,25 @@ -// RUNx: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1 -// RUNx: FileCheck %s < %t.out -// RUNx: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1 -// RUNx: FileCheck %s < %t.out -// RUNx: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1 -// RUNx: FileCheck %s < %t.out -// RUNx: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1 -// RUNx: FileCheck %s < %t.out +// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1 +// RUN: FileCheck %s < %t.out +// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1 +// RUN: FileCheck %s < %t.out +// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1 +// RUN: FileCheck %s < %t.out +// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1 +// RUN: FileCheck %s < %t.out // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out -// RUNx: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1 -// RUNx: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out -// RUNx: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1 -// RUNx: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out -// RUNx: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1 -// RUNx: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1 +// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1 +// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1 +// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out #include int main(int argc, char **argv) { - int xyz; - int *volatile p = &xyz; + int x; + int *volatile p = &x; return *p; // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value // CHECK: {{#0 0x.* in main .*stack-origin.cpp:}}[[@LINE-2]] diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -3875,9 +3875,6 @@ // It will be printed by the run-time if stack-originated UMR is found. // The first 4 bytes of the string are set to '----' and will be replaced // by __msan_va_arg_overflow_size_tls at the first call. -#ifdef kda_COMMENTED_OUT - StackDescription << "----" << I.getName() << "@" << F.getName(); -#endif /* kda_COMMENTED_OUT */ StackDescription << "----"; return createPrivateNonConstGlobalForString(*F.getParent(), StackDescription.str());