public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: Andi Kleen <andi@firstfloor.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
		Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] Dump function on internal errors
Date: Tue, 30 May 2017 07:44:00 -0000	[thread overview]
Message-ID: <CAFiYyc3h8zGwq5XG7hmkfCTLM-HRcH8ZUMeByq2m5Nm=b=5+UQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.20.13.1705292046410.20167@monopod.intra.ispras.ru>

On Mon, May 29, 2017 at 8:10 PM, Alexander Monakov <amonakov@ispras.ru> wrote:
> On Mon, 29 May 2017, Alexander Monakov wrote:
>> +/* This helper function is invoked from diagnostic routines prior to aborting
>> +   due to internal compiler error.  If a dump file is set up, dump the
>> +   current function.  */
>> +
>> +void
>> +emergency_dump_function ()
>> +{
>> +  if (!dump_file || !current_pass || !cfun)
>> +    return;
>> +  fnotice (stderr, "function dumped to file %s\n", dump_file_name);
>> +  execute_function_dump (cfun, current_pass);
>> +}
>
> I've noticed that the notice is not terribly useful.  Perhaps it's better to
> mention the failing pass when not producing the dump (untested):
>
> void
> emergency_dump_function ()
> {
>   if (!current_pass || !cfun)
>     return;
>   if (dump_file)
>     {
>       fnotice (stderr, "dump file: %s\n", dump_file_name);
>       execute_function_dump (cfun, current_pass);
>     }
>   else if (current_pass->name[0] != '*')
>     {
>       enum opt_pass_type pt = current_pass->type;
>       fnotice (stderr, "during %s pass: %s\n",
>                pt == GIMPLE_PASS ? "GIMPLE" : pt == RTL_PASS ? "RTL" : "IPA",
>                current_pass->name);
>     }
> }

If you want to improve here I'd do

   if (current_pass)
     fnotice (stderr, "during %s pass: %s\n", ...
   if (dump_file && cfun)
     {
        fnotice (..);
        execute_function_dump ...
     }

and I'd print the pass name even if it starts with '*' (that just
means it won't get a dumpfile).

Generally the patch looks good to me.

Thanks,
Richard.

> Alexander

  reply	other threads:[~2017-05-30  7:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-22 14:26 Andi Kleen
2017-05-24 13:45 ` Richard Biener
2017-05-29 16:22   ` Alexander Monakov
2017-05-29 16:24     ` Jakub Jelinek
2017-05-29 16:42       ` Alexander Monakov
2017-05-29 16:51         ` Alexander Monakov
2017-05-29 16:53           ` Jakub Jelinek
2017-05-29 16:46     ` Andi Kleen
2017-05-29 19:33     ` Alexander Monakov
2017-05-30  7:44       ` Richard Biener [this message]
2017-05-30 10:35         ` Alexander Monakov

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='CAFiYyc3h8zGwq5XG7hmkfCTLM-HRcH8ZUMeByq2m5Nm=b=5+UQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=amonakov@ispras.ru \
    --cc=andi@firstfloor.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).