You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/docs/RealtimeSanitizer.rst
+64-4Lines changed: 64 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -183,6 +183,10 @@ A **partial** list of flags RealtimeSanitizer respects:
183
183
- ``true``
184
184
- boolean
185
185
- If set, use the symbolizer to turn virtual addresses to file/line locations. If false, can greatly speed up the error reporting.
186
+
* - ``suppressions``
187
+
- ""
188
+
- path
189
+
- If set to a valid suppressions file, will suppress issue reporting. See details in "Disabling", below.
186
190
187
191
188
192
Some issues with flags can be debugged using the ``verbosity=$NUM`` flag:
@@ -194,12 +198,43 @@ Some issues with flags can be debugged using the ``verbosity=$NUM`` flag:
194
198
misspelled_flag
195
199
...
196
200
197
-
Disabling
198
-
---------
201
+
Disabling and suppressing
202
+
-------------------------
199
203
200
-
In some circumstances, you may want to suppress error reporting in a specific scope.
204
+
There are multiple ways to disable error reporting when using RealtimeSanitizer.
201
205
202
-
In C++, this is achieved via ``__rtsan::ScopedDisabler``. Within the scope where the ``ScopedDisabler`` object is instantiated, all sanitizer error reports are suppressed. This suppression applies to the current scope as well as all invoked functions, including any functions called transitively.
206
+
In general, ``ScopedDisabler`` should be preferred, as it is the most performant.
207
+
208
+
.. list-table:: Suppression methods
209
+
:widths: 30 15 15 10 70
210
+
:header-rows: 1
211
+
212
+
* - Method
213
+
- Specified at?
214
+
- Scope
215
+
- Run-time cost
216
+
- Description
217
+
* - ``ScopedDisabler``
218
+
- Compile-time
219
+
- Stack
220
+
- Very low
221
+
- Violations are ignored for the lifetime of the ``ScopedDisabler`` object.
222
+
* - ``function-name-matches`` suppression
223
+
- Run-time
224
+
- Single function
225
+
- Medium
226
+
- Suppresses intercepted and ``[[clang::blocking]]`` function calls by name.
227
+
* - ``call-stack-contains`` suppression
228
+
- Run-time
229
+
- Stack
230
+
- High
231
+
- Suppresses any stack trace contaning the specified pattern.
232
+
233
+
234
+
``ScopedDisabler``
235
+
##################
236
+
237
+
At compile time, RealtimeSanitizer may be disabled using ``__rtsan::ScopedDisabler``. RTSan ignores any errors originating within the ``ScopedDisabler`` instance variable scope.
203
238
204
239
.. code-block:: c++
205
240
@@ -233,6 +268,31 @@ In C, you can use the ``__rtsan_disable()`` and ``rtsan_enable()`` functions to
233
268
234
269
Each call to ``__rtsan_disable()`` must be paired with a subsequent call to ``__rtsan_enable()`` to restore normal sanitizer functionality. If a corresponding ``rtsan_enable()`` call is not made, the behavior is undefined.
235
270
271
+
Suppression file
272
+
################
273
+
274
+
At run-time, suppressions may be specified using a suppressions file passed in ``RTSAN_OPTIONS``. Run-time suppression may be useful if the source cannot be changed.
Suppressions specified in this file are one of two flavors.
287
+
288
+
``function-name-matches`` suppresses reporting of any intercepted library call, or function marked ``[[clang::blocking]]`` by name. If, for instance, you know that ``malloc`` is real-time safe on your system, you can disable the check for it via ``function-name-matches:malloc``.
289
+
290
+
``call-stack-contains`` suppresses reporting of errors in any stack that contains a string matching the pattern specified. For example, suppressing error reporting of any non-real-time-safe behavior in ``std::vector`` may be specified ``call-stack-contains:std::*vector``. You must include symbols in your build for this method to be effective, unsymbolicated stack traces cannot be matched. ``call-stack-contains`` has the highest run-time cost of any method of suppression.
291
+
292
+
Patterns may be exact matches or are "regex-light" patterns, containing special characters such as ``^$*``.
293
+
294
+
The number of potential errors suppressed via this method may be seen on exit when using the ``print_stats_on_exit`` flag.
0 commit comments