Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[asan_symbolize] Use proper logging infrastructure.
Summary: The previous logging infrastructure had several problems: * Debugging output was emitted to standard output which is also where the symbolized output would go. Interleaving these two separate bits of information makes inspecting the output difficult and could potentially break tests. * Enabling debugging output requires modifying the script which is not very conveninent. * When debugging it isn't immediately obvious where the output is coming from. This patch uses the Python standard library logging infrastructure which fixes all of the above problems. Logging is controlled using two new options. * `--log-level` - Sets the logging level, default is `info`. * `--log-dest` - Set the logging destination, default is standard error. Some simple test cases for the feature are included. rdar://problem/49476995 Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka Subscribers: #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60343 llvm-svn: 357951
- Loading branch information
Showing
4 changed files
with
65 additions
and
14 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
5 changes: 5 additions & 0 deletions
5
compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/logging_options_in_help.cc
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,5 @@ | ||
// RUN: %asan_symbolize --help > %t_help_output.txt | ||
// RUN: FileCheck %s -input-file=%t_help_output.txt | ||
// CHECK: optional arguments: | ||
// CHECK: --log-dest | ||
// CHECK: --log-level |
3 changes: 3 additions & 0 deletions
3
compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/set_log_dest.cc
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,3 @@ | ||
// RUN: %asan_symbolize --log-level debug --log-dest %t_debug_log_output.txt --help | ||
// RUN: FileCheck %s -input-file=%t_debug_log_output.txt -check-prefix=DEBUG-CHECK | ||
// DEBUG-CHECK: DEBUG: [setup_logging() asan_symbolize.py:{{[0-9]+}}] Logging level set to "debug" |
8 changes: 8 additions & 0 deletions
8
compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/set_log_level.cc
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,8 @@ | ||
// RUN: %asan_symbolize --log-level debug --help 2> %t_debug_log_output.txt | ||
// RUN: FileCheck %s -input-file=%t_debug_log_output.txt -check-prefix=DEBUG-CHECK | ||
// DEBUG-CHECK: DEBUG: [setup_logging() asan_symbolize.py:{{[0-9]+}}] Logging level set to "debug" | ||
// | ||
// FileCheck doesn't like empty files so add stdout too. | ||
// RUN: %asan_symbolize --log-level info --help > %t_info_log_output.txt 2>&1 | ||
// RUN: FileCheck %s -input-file=%t_info_log_output.txt -check-prefix=INFO-CHECK | ||
// INFO-CHECK-NOT: DEBUG: [setup_logging() asan_symbolize.py:{{[0-9]+}}] |