[asan_symbolize] Use proper logging infrastructure.
authorDan Liew <dan@su-root.co.uk>
Mon, 8 Apr 2019 22:28:27 +0000 (22:28 +0000)
committerDan Liew <dan@su-root.co.uk>
Mon, 8 Apr 2019 22:28:27 +0000 (22:28 +0000)
commit836da99af9cbede44b1e619aa182589d025a6113
tree6921506e7c6e74c679d974f5f31a6cc6cddf5cfc
parentd250238abd0c37e4a4cfb26a33e9defdc5cdeda8
[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
compiler-rt/lib/asan/scripts/asan_symbolize.py
compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/logging_options_in_help.cc [new file with mode: 0644]
compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/set_log_dest.cc [new file with mode: 0644]
compiler-rt/test/asan/TestCases/Posix/asan_symbolize_script/set_log_level.cc [new file with mode: 0644]