2015-03-03 03:34:27 +08:00
|
|
|
// RUN: %clangxx_msan -O0 %s -o %t && %run %t
|
2013-09-27 20:40:23 +08:00
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <execinfo.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
__attribute__((noinline))
|
|
|
|
void f() {
|
|
|
|
void *buf[10];
|
|
|
|
int sz = backtrace(buf, sizeof(buf) / sizeof(*buf));
|
|
|
|
assert(sz > 0);
|
|
|
|
for (int i = 0; i < sz; ++i)
|
[MSan] Enable for SystemZ
Summary:
This patch adds runtime support, adjusts tests and enables MSan.
Like for ASan and UBSan, compile the tests with -mbackchain.
Reviewers: eugenis, uweigand, jonpa, vitalybuka
Reviewed By: eugenis, vitalybuka
Subscribers: vitalybuka, mgorny, hiraditya, #sanitizers, stefansf, Andreas-Krebbel
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D76358
2020-04-16 07:01:11 +08:00
|
|
|
if (!buf[i]) {
|
|
|
|
#if defined(__s390x__)
|
|
|
|
// backtrace() may return a bogus trailing NULL on s390x.
|
|
|
|
if (i == sz - 1)
|
|
|
|
continue;
|
|
|
|
#endif
|
2013-09-27 20:40:23 +08:00
|
|
|
exit(1);
|
[MSan] Enable for SystemZ
Summary:
This patch adds runtime support, adjusts tests and enables MSan.
Like for ASan and UBSan, compile the tests with -mbackchain.
Reviewers: eugenis, uweigand, jonpa, vitalybuka
Reviewed By: eugenis, vitalybuka
Subscribers: vitalybuka, mgorny, hiraditya, #sanitizers, stefansf, Andreas-Krebbel
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D76358
2020-04-16 07:01:11 +08:00
|
|
|
}
|
2013-09-27 20:40:23 +08:00
|
|
|
char **s = backtrace_symbols(buf, sz);
|
2016-10-22 05:37:18 +08:00
|
|
|
assert(s != 0);
|
2013-09-27 20:40:23 +08:00
|
|
|
for (int i = 0; i < sz; ++i)
|
2015-04-24 15:52:47 +08:00
|
|
|
printf("%d\n", (int)strlen(s[i]));
|
2013-09-27 20:40:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
f();
|
|
|
|
return 0;
|
|
|
|
}
|