Move MSan lit-tests under test/msan
[blocksruntime.git] / test / msan / backtrace.cc
blob48684c29c60d679f018ea4656350d915fdb4fab0
1 // RUN: %clangxx_msan -m64 -O0 %s -o %t && %t
3 #include <assert.h>
4 #include <execinfo.h>
5 #include <stdio.h>
6 #include <string.h>
7 #include <stdlib.h>
9 __attribute__((noinline))
10 void f() {
11 void *buf[10];
12 int sz = backtrace(buf, sizeof(buf) / sizeof(*buf));
13 assert(sz > 0);
14 for (int i = 0; i < sz; ++i)
15 if (!buf[i])
16 exit(1);
17 char **s = backtrace_symbols(buf, sz);
18 assert(s > 0);
19 for (int i = 0; i < sz; ++i)
20 printf("%d\n", strlen(s[i]));
23 int main(void) {
24 f();
25 return 0;