forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[asan] Add %d variable to external_symbolizer_path option, so that us…
…er can specify paths relative to the location of the binary. We want way to set a path to llvm-symbolizer that isn't relative to the current working directory; this change adds a variable that expands to the path relative to the current binary. This approach came from comments in https://reviews.llvm.org/D93070 Differential Revision: https://reviews.llvm.org/D94563
- Loading branch information
Showing
8 changed files
with
78 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
compiler-rt/test/sanitizer_common/TestCases/external_symbolizer_path.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// REQUIRES: shell | ||
// RUN: rm -rf %t.bin | ||
// RUN: mkdir %t.bin | ||
// RUN: cp $(which llvm-symbolizer) %t.bin | ||
// RUN: rm -rf %t.dir | ||
// RUN: mkdir %t.dir | ||
// RUN: %clangxx -O0 %s -o %t && cd %t.dir | ||
// RUN: %env_tool_opts=external_symbolizer_path=%d/external_symbolizer_path.cpp.tmp.bin/llvm-symbolizer \ | ||
// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=FOUND | ||
// RUN: rm -rf %t.bin/llvm-symbolizer | ||
// RUN: cd .. | ||
// RUN: %clangxx -O0 %s -o %t && cd %t.dir | ||
// RUN: %env_tool_opts=external_symbolizer_path=%d/external_symbolizer_path.cpp.tmp.bin/llvm-symbolizer \ | ||
// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=NOT-FOUND | ||
|
||
#include <sanitizer/common_interface_defs.h> | ||
#include <stdio.h> | ||
|
||
static void Symbolize() { | ||
char buffer[100]; | ||
__sanitizer_symbolize_pc(__builtin_return_address(0), "%p %F %L", buffer, | ||
sizeof(buffer)); | ||
printf("%s\n", buffer); | ||
} | ||
|
||
int main() { | ||
// FOUND: {{0x.* in main}} | ||
// NOT-FOUND: WARNING: invalid path to external symbolizer! | ||
Symbolize(); | ||
} |