We have some significant amount of duplication around CheckFailed functionality. Each sanitizer copy-pasted a chunk of code. Some got random improvements like dealing with recursive failures better. These improvements could benefit all sanitizers, but they don't. Deduplicate CheckFailed logic across sanitizers and let each sanitizer only print the current stack trace. I've tried to dedup stack printing as well, but this got me into cmake hell. So let's keep this part duplicated in each sanitizer for now. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D102221
17 lines
457 B
C++
17 lines
457 B
C++
// RUN: %clangxx_msan -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
|
|
|
|
// Verify that CHECK handler prints a stack on CHECK fail.
|
|
|
|
#include <stdlib.h>
|
|
|
|
int main(void) {
|
|
// Allocate chunk from the secondary allocator to trigger CHECK(IsALigned())
|
|
// in its free() path.
|
|
void *p = malloc(8 << 20);
|
|
free(reinterpret_cast<char*>(p) + 1);
|
|
// CHECK: MemorySanitizer: bad pointer
|
|
// CHECK: MemorySanitizer: CHECK failed
|
|
// CHECK: #0
|
|
return 0;
|
|
}
|