public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Cc: gcc@gcc.gnu.org
Subject: Re: How to debug while using LTO?
Date: Thu, 24 Nov 2022 17:53:53 +0100	[thread overview]
Message-ID: <689A7218-A12B-4612-B8C0-EACE12C4F8AC@gmail.com> (raw)
In-Reply-To: <Y3+bUIdcU6FRbHpT@li-42a4824c-28a0-11b2-a85c-f55c0d5956ce.ibm.com>



> Am 24.11.2022 um 17:28 schrieb Stefan Schulze Frielinghaus via Gcc <gcc@gcc.gnu.org>:
> 
> Hi everyone,
> 
> 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=-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
> 
> /tmp/ccPEIV35.ltrans0.ltrans.o
> /tmp/ccNmpKfS.debug.temp.o
> /tmp/cceiCIFg.debug.temp.o
> /tmp/ccZ4Qc7E.debug.temp.o
> ...
> 
> but no lto1 command.  Thus, how do you retrieve the lto1 command?
> 
> 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 what I usually do.

Richard 

> Cheers,
> Stefan

  reply	other threads:[~2022-11-24 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 16:26 Stefan Schulze Frielinghaus
2022-11-24 16:53 ` Richard Biener [this message]
2022-11-30 10:49   ` Stefan Schulze Frielinghaus
2022-11-30 13:22     ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=689A7218-A12B-4612-B8C0-EACE12C4F8AC@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=stefansf@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).