llvm-project/compiler-rt/lib
Dan Liew 4c39f34199 [SanitizerCommon] Print the current value of options when printing out help.
Summary:
Previously it wasn't obvious what the default value of various sanitizer
options were. A very close approximation of the "default values" for the
options are the current value of the options at the time of printing the
help output.

In the case that no other options are provided then the current values
are the default values (apart from `help`).

```
ASAN_OPTIONS=help=1 ./program
```

This patch causes the current option values to be printed when the
`help` output is enabled. The original intention for this patch was to append
`(Default: <value>)` to an option's help text. However because this
is technically wrong (and misleading) I've opted to append
`(Current Value: <value>)` instead.

When trying to implement a way of displaying the default value of the
options I tried another solution where the default value used in `*.inc` files
were used to create compile time strings that where used when printing
the help output. This solution was not satisfactory for several reasons:

* Stringifying the default values with the preprocessor did not work very
well in several cases.  Some options contain boolean operators which no
amount of macro expansion can get rid of.
* It was much more invasive than this patch. Every sanitizer had to be changed.
* The settings of `__<sanitizer>_default_options()` are ignored.

For those reasons I opted for the solution in this patch.

rdar://problem/42567204

Reviewers: kubamracek, yln, kcc, dvyukov, vitalybuka, cryptoad, eugenis, samsonov

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D69546
2019-11-14 14:04:34 -08:00
..
BlocksRuntime [compiler-rt] Test commit: remove some trailing white spaces. 2017-08-25 19:36:30 +00:00
asan Remove unused variables, as suggested by @mcgov. 2019-11-04 14:55:51 -05:00
builtins [PowerPC][compiler-rt][builtins]Fix __fixunstfti builtin on PowerPC 2019-11-08 11:57:09 -06:00
cfi Improve error message when '=' is missing in {ASAN,...}_OPTIONS. 2019-06-15 01:37:14 +00:00
crt Fix include guard and properly order __deregister_frame_info. 2019-11-12 14:54:41 -08:00
dfsan [compiler-rt] Remove some cpplint filters 2019-09-12 02:20:36 +00:00
fuzzer Disable exceptions in libfuzzer's copy of libcxxabi. 2019-11-01 10:05:59 -07:00
gwp_asan [GWP-ASan] Respect compiler-rt's -fno-lto 2019-11-07 07:43:02 -08:00
hwasan [hwasan] Remove lazy thread-initialisation 2019-11-04 10:58:46 +00:00
interception Fix check-interception link error in compiler-rt debug mode 2019-10-10 23:30:54 +00:00
lsan [sanitizer_common] Create max_allocation_size_mb flag. 2019-10-30 11:26:05 -07:00
msan [SanitizerCommon] Print the current value of options when printing out help. 2019-11-14 14:04:34 -08:00
profile [profile] Factor out logic for mmap'ing merged profile, NFC 2019-11-13 07:52:15 -08:00
safestack compiler-rt: Rename .cc file in lib/{interception/tests,safestack} to .cpp 2019-08-01 13:56:52 +00:00
sanitizer_common [SanitizerCommon] Print the current value of options when printing out help. 2019-11-14 14:04:34 -08:00
scudo [scudo][standalone] Match function name change to bionic name change. 2019-11-11 09:41:57 -08:00
stats compiler-rt: Rename .cc file in lib/{dfsan,stats,ubsan_minimal} to .cpp 2019-08-01 12:41:23 +00:00
tsan [sanitizer_common] Create max_allocation_size_mb flag. 2019-10-30 11:26:05 -07:00
ubsan [UBSan] Appease linter 2019-10-10 11:32:06 +00:00
ubsan_minimal compiler-rt: Rename .cc file in lib/{dfsan,stats,ubsan_minimal} to .cpp 2019-08-01 12:41:23 +00:00
xray Re-land "[compiler-rt] Migrate llvm::make_unique to std::make_unique" 2019-08-15 14:57:44 +00:00
CMakeLists.txt Reland "[compiler-rt] Simple crtbegin.o and crtend.o implementation" 2019-04-30 18:13:22 +00:00