From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id DA04F382FC87 for ; Thu, 24 Nov 2022 16:54:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA04F382FC87 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x536.google.com with SMTP id s12so3258387edd.5 for ; Thu, 24 Nov 2022 08:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=BSaB4BXYC6uL5id40E9CadAqsD3Jxfy6OCfIyT9LZLY=; b=h1gdJXqhIx2kYO3VRyGNRBjS8M2BhA/ta9mv68Ax3aDdxBHuWPwKYMAH+hu75T98w4 ijunxdxIfsZvYRJJhLHGt8FJ8eDpRn6RAhgGb3Ch983BhimGroHSbBZExY2nBBGjMgFh SjU1Entyoyykw3AnXG9SesUSl0ITQutALFT/Nn2RHyCY3+km7oO9tFCchMUaSyyKthxh 3Tg648TIp4igkPd/l38h0rKcPZmWj96Jo0X0PouzBTcttMDWc7Zppg1QXXmKbbwhUOBg CCgzEZObQyDz4Im1t224NT/U+V6F1/2fFVyoZ5QY8Y146Vl2aKnraMJqDZbV5SxHu6Am 3PAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BSaB4BXYC6uL5id40E9CadAqsD3Jxfy6OCfIyT9LZLY=; b=x+cEWutSTcmp8vXrFXanE0C4HvLEWdZ/n7fmCE/U2oecpIU7M2qOF2+s0CgudMCZDq 6qCK0Etinfu4pSwu6KfEZvBIceS0JC1wDdmVFXRiiX/7cjj5mkBFefh8qTC7ybQDXRDL fpMp1DUjvy8K00ms/rveLkK1Fm/TclfDuStXC5RmwW+ZLOlMpqR2q9W0gpR0p85RMOOh 0RaITfggxdfkc/8ZOiwPDdc6zP4c4oOkSHEZ9nYNaItIwOKxD0BHELTVl9arOx0Uf0/Q zZS5Dmwn9d6kOY3EGIdNEFsDVDQ8CxxTUlLGGScpOYPPmRkepeYIY4+cLkC3GL1nQL7/ tntg== X-Gm-Message-State: ANoB5plllGzs0xqlQ9gOgbKQcFe3ohEevQQtsFfuLg2MMN725IKNamDO nAIQcuSeacXYcx/hqikKa5k= X-Google-Smtp-Source: AA0mqf50rAKKH74KGcGiJNCeY1sW2dffSHhkr1axer7QMvD2M+L+XU7gqi+2m+3CNNrQXPAvDeKoaQ== X-Received: by 2002:a05:6402:1c0e:b0:46a:7485:9b67 with SMTP id ck14-20020a0564021c0e00b0046a74859b67mr4837610edb.103.1669308845434; Thu, 24 Nov 2022 08:54:05 -0800 (PST) Received: from smtpclient.apple (dynamic-077-007-078-113.77.7.pool.telefonica.de. [77.7.78.113]) by smtp.gmail.com with ESMTPSA id j18-20020a1709066dd200b0077016f4c6d4sm620618ejt.55.2022.11.24.08.54.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Nov 2022 08:54:04 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: How to debug while using LTO? Date: Thu, 24 Nov 2022 17:53:53 +0100 Message-Id: <689A7218-A12B-4612-B8C0-EACE12C4F8AC@gmail.com> References: Cc: gcc@gcc.gnu.org In-Reply-To: To: Stefan Schulze Frielinghaus X-Mailer: iPhone Mail (20B101) X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: > Am 24.11.2022 um 17:28 schrieb Stefan Schulze Frielinghaus via Gcc : >=20 > =EF=BB=BFHi everyone, >=20 > Currently I'm looking into a wrong-code bug and would like to understand > a certain optimization done by combine during local transformation. > Without LTO I would simply debug cc1 and step through combine. However, > with LTO enabled AFAIK I have to debug lto1 instead. In order to get > the lto1 command line of interest according to > https://gcc.gnu.org/legacy-ml/gcc/2009-11/msg00047.html > I have to pass -Wl,-debug to gcc in order to get the command for > collect2 to which itself I have to pass -plugin-opt=3D-debug in order to > get the command for lto-wrapper. According to the aforementioned mail I > should add option -debug to lto-wrapper, however, it appears to me that > option -debug was removed. I gave options -v and -### a chance without > luck, i.e., those only print the usual environment variables and > afterwards a list of object files like >=20 > /tmp/ccPEIV35.ltrans0.ltrans.o > /tmp/ccNmpKfS.debug.temp.o > /tmp/cceiCIFg.debug.temp.o > /tmp/ccZ4Qc7E.debug.temp.o > ... >=20 > but no lto1 command. Thus, how do you retrieve the lto1 command? >=20 > While desperate I retrieved it manually via strace. However, the lto1 > command refers to temporary files which have been erased meanwhile. I > actually didn't expect that because I added -save-temps to all the > intermediate commands which is also reflected in the environment > variable COLLECT_GCC_OPTIONS. Thus, how do you keep temporary files? Adding -v -save-temps and then running gdb on the lto1 command works and is w= hat I usually do. Richard=20 > Cheers, > Stefan