brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 45e8ead Raw
43 lines · cpp
1// If the binary looks up libraries using an rpath, we can't test this2// without copying the whole lib dir or polluting the build dir.3// REQUIRES: static-libs4 5// The above also applies if the binary is built with libc++.6// UNSUPPORTED: libcxx-used7 8// RUN: rm -rf %t.bin9// RUN: mkdir %t.bin10// RUN: cp $(which llvm-symbolizer) %t.bin11// RUN: rm -rf %t.dir12// RUN: mkdir %t.dir13// RUN: %clangxx -O0 %s -o %t && cd %t.dir14// 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=FOUND16// RUN: rm -rf %t.bin/llvm-symbolizer17// RUN: cd ..18// RUN: %clangxx -O0 %s -o %t && cd %t.dir19// 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-FOUND21 22// Mobile device will not have symbolizer in provided path.23// UNSUPPORTED: ios, android24 25// FIXME: Figure out why this fails on certain buildbots and re-enable.26// UNSUPPORTED: target={{.*linux.*}}27 28#include <sanitizer/common_interface_defs.h>29#include <stdio.h>30 31static void Symbolize() {32  char buffer[100];33  __sanitizer_symbolize_pc(__builtin_return_address(0), "%p %F %L", buffer,34                           sizeof(buffer));35  printf("%s\n", buffer);36}37 38int main() {39  // FOUND: {{0x.* in main}}40  // NOT-FOUND: WARNING: invalid path to external symbolizer!41  Symbolize();42}43