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 6693F3832375 for ; Thu, 8 Dec 2022 23:11:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6693F3832375 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=1670541119; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=zVvZ+2Pf8/8xn2biQuR2OVjc1tx43XryKEczugmlP5s=; b=OSTGsmLegFxg6cyRu/GAxjRkx5JReVxPc/hVavZSqSXnGp//vNBBxLIWT7QM0t6V/1zhkJ qPJwrHQ1ysC6skk/aLLuvWw0mjEDlWnpIAMFS/nRT0ykeV9ju2znY5RIumAl6WJuF/nq7R 8wmB23IGScWboPXCuSYFNTltI9+f8/U= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-266-VdcKw00jNy6LGxsvq5ryUg-1; Thu, 08 Dec 2022 18:11:57 -0500 X-MC-Unique: VdcKw00jNy6LGxsvq5ryUg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A88DC85A588 for ; Thu, 8 Dec 2022 23:11:57 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 630C3492B04; Thu, 8 Dec 2022 23:11:57 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2B8NBq9V1998633 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 9 Dec 2022 00:11:53 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2B8NBqCO1998632; Fri, 9 Dec 2022 00:11:52 +0100 Date: Fri, 9 Dec 2022 00:11:52 +0100 From: Jakub Jelinek To: Marek Polacek Cc: Florian Weimer , Marek Polacek via Gcc-patches Subject: Re: [PATCH v3] docs: Suggest options to improve ASAN stack traces Message-ID: Reply-To: Jakub Jelinek References: <20221207203409.104322-1-polacek@redhat.com> <87fsdqjr15.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-9.5 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: On Thu, Dec 08, 2022 at 05:56:41PM -0500, Marek Polacek wrote: > Can't hurt. Here's an updated patch. > > -- >8 -- > 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. Ok, thanks. > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index 726392409b6..3f2512ce16a 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -16510,6 +16510,16 @@ 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{-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 > +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}. > + > @item -fsanitize=kernel-address > @opindex fsanitize=kernel-address > Enable AddressSanitizer for Linux kernel. Jakub