From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 601723856088 for ; Mon, 30 May 2022 10:40:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 601723856088 Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id B7C8966A83; Mon, 30 May 2022 06:40:37 -0400 (EDT) Message-ID: <4394c42e70304c22922eb53927a800bc91e4f734.camel@xry111.site> Subject: Re: How to auto insert logs when use gcc compile a C/C++ source. From: Xi Ruoyao To: "Mr. Joey" , gcc-help@gcc.gnu.org Date: Mon, 30 May 2022 18:40:35 +0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 MIME-Version: 1.0 X-Spam-Status: No, score=3.4 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, LIKELY_SPAM_FROM, PDS_OTHER_BAD_TLD, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: *** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2022 10:40:41 -0000 On Mon, 2022-05-30 at 08:45 +0800, Mr. Joey via Gcc-help wrote: > hi,=C2=A0 guys > =C2=A0=C2=A0=C2=A0=C2=A0=20 > How to auto insert logs when use gcc compile a C/C++ source. I thinks > it=E2=80=99s useful when quickly debug a crash. I don't understand your intention. You mean debug a crash in GCC itself ("Internal Compiler Error") or a crash of the executable created by GCC? For the prior, the output of -fdump-tree-* and -fdump-rtl-* can serve as a log. But it's more efficient to just minimize the testcase with a tool like cvise and debug the compiler with GDB. For the latter, it's impossible. You can use a logging library like boost::log in your program anyway. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University