Mercurial > hg > CbC > CbC_llvm
comparison compiler-rt/test/sanitizer_common/TestCases/external_symbolizer_path.cpp @ 221:79ff65ed7e25
LLVM12 Original
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jun 2021 19:15:29 +0900 |
parents | |
children | 1f2b6ac9f198 |
comparison
equal
deleted
inserted
replaced
220:42394fc6a535 | 221:79ff65ed7e25 |
---|---|
1 // If the binary looks up libraries using an rpath, we can't test this | |
2 // without copying the whole lib dir or polluting the build dir. | |
3 // REQUIRES: static-libs | |
4 | |
5 // The above also applies if the binary is built with libc++. | |
6 // UNSUPPORTED: libcxx-used | |
7 | |
8 // RUN: rm -rf %t.bin | |
9 // RUN: mkdir %t.bin | |
10 // RUN: cp $(which llvm-symbolizer) %t.bin | |
11 // RUN: rm -rf %t.dir | |
12 // RUN: mkdir %t.dir | |
13 // RUN: %clangxx -O0 %s -o %t && cd %t.dir | |
14 // RUN: %env_tool_opts=external_symbolizer_path=%d/external_symbolizer_path.cpp.tmp.bin/llvm-symbolizer \ | |
15 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=FOUND | |
16 // RUN: rm -rf %t.bin/llvm-symbolizer | |
17 // RUN: cd .. | |
18 // RUN: %clangxx -O0 %s -o %t && cd %t.dir | |
19 // RUN: %env_tool_opts=external_symbolizer_path=%d/external_symbolizer_path.cpp.tmp.bin/llvm-symbolizer \ | |
20 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=NOT-FOUND | |
21 | |
22 // REQUIRES: shell | |
23 | |
24 // Mobile device will not have symbolizer in provided path. | |
25 // UNSUPPORTED: ios, android | |
26 | |
27 // FIXME: Figure out why this fails on certain buildbots and re-enable. | |
28 // UNSUPPORTED: linux | |
29 | |
30 #include <sanitizer/common_interface_defs.h> | |
31 #include <stdio.h> | |
32 | |
33 static void Symbolize() { | |
34 char buffer[100]; | |
35 __sanitizer_symbolize_pc(__builtin_return_address(0), "%p %F %L", buffer, | |
36 sizeof(buffer)); | |
37 printf("%s\n", buffer); | |
38 } | |
39 | |
40 int main() { | |
41 // FOUND: {{0x.* in main}} | |
42 // NOT-FOUND: WARNING: invalid path to external symbolizer! | |
43 Symbolize(); | |
44 } |