aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/invoke.texi
diff options
context:
space:
mode:
authorSandra Loosemore <sloosemore@baylibre.com>2025-03-07 22:50:19 +0000
committerSandra Loosemore <sloosemore@baylibre.com>2025-03-07 22:55:05 +0000
commit313edeeeb607fe32da5633cfb6f91977add446f6 (patch)
treed78332aabc8c1611a8b6d8be8b1401ddbe76b9d1 /gcc/doc/invoke.texi
parentd71139982a364c5c9646737a7b9a407967ecd88c (diff)
downloadgcc-313edeeeb607fe32da5633cfb6f91977add446f6.zip
gcc-313edeeeb607fe32da5633cfb6f91977add446f6.tar.gz
gcc-313edeeeb607fe32da5633cfb6f91977add446f6.tar.bz2
Sanitizer: Mention -g option in documentation [PR56682]
gcc/ChangeLog PR sanitizer/56682 * doc/invoke.texi (Instrumentation Options): Document that -g is useful with -fsanitize=thread and -fsanitize=address. Also mention -fno-omit-frame-pointer per the asan wiki.
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r--gcc/doc/invoke.texi9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index c61f351..e01d64c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -17861,12 +17861,16 @@ The option cannot be combined with @option{-fsanitize=thread} or
(only with @code{-mlam=u48} or @code{-mlam=u57} options) and AArch64,
in both cases only in ABIs with 64-bit pointers.
+When compiling with @option{-fsanitize=address}, you should also also
+use @option{-g} to produce more meaningful output.
To get more accurate stack traces, it is possible to use options such as
@option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
optimizing sibling and tail recursive calls; this option is implicit for
@option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
-disables Identical Code Folding for functions). Since multiple runs of the
+disables Identical Code Folding for functions).
+Using @option{-fno-omit-frame-pointer} also improves stack traces.
+Since multiple runs of the
program may yield backtraces with different addresses due to ASLR (Address
Space Layout Randomization), it may be desirable to turn ASLR off. On Linux,
this can be achieved with @samp{setarch `uname -m` -R ./prog}.
@@ -17972,6 +17976,9 @@ supported options.
The option cannot be combined with @option{-fsanitize=address},
@option{-fsanitize=leak}.
+When compiling with @option{-fsanitize=thread}, you should also use
+@option{-g} to produce more meaningful output.
+
Note that sanitized atomic builtins cannot throw exceptions when
operating on invalid memory addresses with non-call exceptions
(@option{-fnon-call-exceptions}).