Hi!

On Fri, 7 Mar 2025 at 23:57, Sandra Loosemore <sloosem...@baylibre.com> wrote:
>
> 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 | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index c61f3514070..e01d64c5229 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

I think you made a typo: "also also" ?

Thanks,

Christophe

> +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}).
> --
> 2.34.1
>

Reply via email to