Home | History | Annotate | Download | only in msan
      1 // RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
      2 
      3 #include <assert.h>
      4 #include <execinfo.h>
      5 #include <stdio.h>
      6 #include <string.h>
      7 #include <stdlib.h>
      8 
      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]));
     21 }
     22 
     23 int main(void) {
     24   f();
     25   return 0;
     26 }
     27