]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Sanitizer: Mention -g option in documentation [PR56682]
authorSandra Loosemore <sloosemore@baylibre.com>
Fri, 7 Mar 2025 22:50:19 +0000 (22:50 +0000)
committerSandra Loosemore <sloosemore@baylibre.com>
Fri, 7 Mar 2025 22:55:05 +0000 (22:55 +0000)
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.

gcc/doc/invoke.texi

index c61f35140702e8001ace2a78f9e48c3790fe894c..e01d64c5229f8d9b7df7304df3f952ad3e531c2f 100644 (file)
@@ -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}).