From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 95BD03834C07 for ; Wed, 7 Dec 2022 20:34:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 95BD03834C07 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670445258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VjR1tL7OB7kEkChxeMylTsnHUjVLmb8qH4R+N6iYsYw=; b=AQGiiv9ycxGjbQnhw36PT4EOlLEoAcLtDbotB0QHJxn1FTWh8+I87exAmCm/qMHSXccd1s 2Cnt83rzy157MurAIMSqNXNZiH8inGEbuC1zt70FSKpKLUfUzpz+7SLgk7XYjKV3M3rAqO 5AcU3K3jvqRCuciZ8Pr5h4Gdj+5iOmk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-9pxygmSuPva6NGbUjMtKjQ-1; Wed, 07 Dec 2022 15:34:17 -0500 X-MC-Unique: 9pxygmSuPva6NGbUjMtKjQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D77BA380664C for ; Wed, 7 Dec 2022 20:34:16 +0000 (UTC) Received: from pdp-11.redhat.com (unknown [10.22.18.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2A00492CA2 for ; Wed, 7 Dec 2022 20:34:16 +0000 (UTC) From: Marek Polacek To: GCC Patches Subject: [PATCH] docs: Suggest options to improve ASAN stack traces Date: Wed, 7 Dec 2022 15:34:09 -0500 Message-Id: <20221207203409.104322-1-polacek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I got a complaint that while Clang docs suggest options that improve the quality of the backtraces ASAN prints (cf. ), our docs don't say anything to that effect. This patch amends that with a new paragraph. (It deliberately doesn't mention -fno-omit-frame-pointer.) gcc/ChangeLog: * doc/invoke.texi (-fsanitize=address): Suggest options to improve stack traces. --- gcc/doc/invoke.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 726392409b6..2de14466dd3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -16510,6 +16510,14 @@ The option cannot be combined with @option{-fsanitize=thread} or @option{-fsanitize=hwaddress}. Note that the only target @option{-fsanitize=hwaddress} is currently supported on is AArch64. +To get more accurate stack traces, it is possible to use options such as +@option{-O} (which, for instance, prevents most function inlining), +@option{-fno-optimize-sibling-calls} (which prevents optimizing sibling +and tail recursive calls), or @option{-fno-ipa-icf} (which disables Identical +Code Folding for functions and read-only variables). Since multiple runs +of the program may yield backtraces with different addresses due to ASLR, +it may be desirable to turn off ASLR: @samp{setarch `uname -m` -R ./prog}. + @item -fsanitize=kernel-address @opindex fsanitize=kernel-address Enable AddressSanitizer for Linux kernel. base-commit: 3ad0f470c16d5528a5283060b007f8b419c33c92 -- 2.38.1