1// Test that lsan reports a proper error when running under strace.
2// REQUIRES: strace
3// RUN: %clangxx_lsan %s -o %t
4// RUN: not strace -o /dev/null %run %t 2>&1 | FileCheck %s
5// FIXME: This technically works in practice but cannot be tested because the
6// fatal-error caused adb to failed. Could not be captured to stderr to lit-check.
7// XFAIL: android
8
9#include <stdio.h>
10#include <stdlib.h>
11
12static volatile void *sink;
13
14int main() {
15 sink = malloc(size: 42);
16}
17// CHECK: LeakSanitizer has encountered a fatal error
18// CHECK: HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
19

source code of compiler-rt/test/lsan/TestCases/strace_test.cpp