Skip to content

Commit e90a827

Browse files
cjapplpuja2196
authored andcommitted
[rtsan] Update docs to include run-time flags (#110296)
1 parent 2867c70 commit e90a827

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

clang/docs/RealtimeSanitizer.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,76 @@ non-zero exit code.
8484
#14 0x0001958960dc (<unknown module>)
8585
#15 0x2f557ffffffffffc (<unknown module>)
8686
87+
Run-time flags
88+
--------------
89+
90+
RealtimeSanitizer supports a number of run-time flags, which can be specified in the ``RTSAN_OPTIONS`` environment variable:
91+
92+
.. code-block:: console
93+
94+
% RTSAN_OPTIONS=option_1=true:path_option_2="/some/file.txt" ./a.out
95+
...
96+
97+
Or at compile-time by providing the symbol ``__rtsan_default_options``:
98+
99+
.. code-block:: c
100+
101+
__attribute__((__visibility__("default")))
102+
extern "C" const char *__rtsan_default_options() {
103+
return "symbolize=false:abort_on_error=0:log_to_syslog=0";
104+
}
105+
106+
You can see all sanitizer options (some of which are unsupported) by using the ``help`` flag:
107+
108+
.. code-block:: console
109+
110+
% RTSAN_OPTIONS=help=true ./a.out
111+
112+
A **partial** list of flags RealtimeSanitizer respects:
113+
114+
.. list-table:: Run-time Flags
115+
:widths: 20 10 10 70
116+
:header-rows: 1
117+
118+
* - Flag name
119+
- Default value
120+
- Type
121+
- Short description
122+
* - ``halt_on_error``
123+
- ``true``
124+
- boolean
125+
- Exit after first reported error. If false (continue after a detected error), deduplicates error stacks so errors appear only once.
126+
* - ``print_stats_on_exit``
127+
- ``false``
128+
- boolean
129+
- Print stats on exit. Includes total and unique errors.
130+
* - ``color``
131+
- ``"auto"``
132+
- string
133+
- Colorize reports: (always|never|auto).
134+
* - ``fast_unwind_on_fatal``
135+
- ``false``
136+
- boolean
137+
- If available, use the fast frame-pointer-based unwinder on detected errors. If true, ensure the code under test has been compiled with frame pointers with ``-fno-omit-frame-pointers`` or similar.
138+
* - ``abort_on_error``
139+
- OS dependent
140+
- boolean
141+
- If true, the tool calls abort() instead of _exit() after printing the error report. On some OSes (OSX, for exmple) this is beneficial because a better stack trace is emitted on crash.
142+
* - ``symbolize``
143+
- ``true``
144+
- boolean
145+
- If set, use the symbolizer to turn virtual addresses to file/line locations. If false, can greatly speed up the error reporting.
146+
147+
148+
Some issues with flags can be debugged using the ``verbosity=$NUM`` flag:
149+
150+
.. code-block:: console
151+
152+
% RTSAN_OPTIONS=verbosity=1:misspelled_flag=true ./a.out
153+
WARNING: found 1 unrecognized flag(s):
154+
misspelled_flag
155+
...
156+
87157
Disabling
88158
---------
89159

0 commit comments

Comments
 (0)