[sanitizer_common] Add facility to get the full report path
authorTeresa Johnson <tejohnson@google.com>
Thu, 19 Nov 2020 05:11:55 +0000 (21:11 -0800)
committerTeresa Johnson <tejohnson@google.com>
Thu, 19 Nov 2020 17:19:12 +0000 (09:19 -0800)
commit8f778b283de5757fa8bf4da255a3a34b3a5cdbd3
treee2feb9025798c8dfb4d975f252640be811778a2e
parent8ecb015ed5ad635f5faccd5303e53dd759a56447
[sanitizer_common] Add facility to get the full report path

Add a new interface __sanitizer_get_report_path which will return the
full path to the report file if __sanitizer_set_report_path was
previously called (otherwise it returns null). This is useful in
particular for memory profiling handlers to access the path which
was specified at compile time (and passed down via
__memprof_profile_filename), including the pid added to the path when
the file is opened.

There wasn't a test for __sanitizer_set_report_path, so I added one
which additionally tests the new interface.

Differential Revision: https://reviews.llvm.org/D91765
compiler-rt/include/sanitizer/common_interface_defs.h
compiler-rt/lib/sanitizer_common/sanitizer_common_interface.inc
compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
compiler-rt/lib/sanitizer_common/sanitizer_file.h
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
compiler-rt/lib/sanitizer_common/sanitizer_interface_internal.h
compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp [new file with mode: 0644]