Re: [PATCH] Dump function on internal errors

2017-05-30 Thread Alexander Monakov
On Tue, 30 May 2017, Richard Biener wrote: > 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

Re: [PATCH] Dump function on internal errors

2017-05-30 Thread Richard Biener
On Mon, May 29, 2017 at 8:10 PM, Alexander Monakov 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 >> +

Re: [PATCH] Dump function on internal errors

2017-05-29 Thread Alexander Monakov
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 ||

Re: [PATCH] Dump function on internal errors

2017-05-29 Thread Jakub Jelinek
On Mon, May 29, 2017 at 07:46:22PM +0300, Alexander Monakov wrote: > On Mon, 29 May 2017, Alexander Monakov wrote: > > On Mon, 29 May 2017, Jakub Jelinek wrote: > > > Also, as none of the arguments are used and we are in C++, > > > perhaps it should be > > > static void > > >

Re: [PATCH] Dump function on internal errors

2017-05-29 Thread Alexander Monakov
On Mon, 29 May 2017, Alexander Monakov wrote: > On Mon, 29 May 2017, Jakub Jelinek wrote: > > Also, as none of the arguments are used and we are in C++, > > perhaps it should be > > static void > > internal_error_function (diagnostic_context *, const char *, va_list *) > > { > > ? > > Ah, it

Re: [PATCH] Dump function on internal errors

2017-05-29 Thread Andi Kleen
On Mon, May 29, 2017 at 07:15:33PM +0300, Alexander Monakov wrote: > Hi, > > On Wed, 24 May 2017, Richard Biener wrote: > > current_pass might be NULL so you better do set_internal_error_hook when > > we start executing passes (I detest global singletons to do such stuff > > anyway). > > I

Re: [PATCH] Dump function on internal errors

2017-05-29 Thread Alexander Monakov
On Mon, 29 May 2017, Jakub Jelinek wrote: > What if there is another ICE during the dumping? Won't we then > end in endless recursion? Perhaps global_dc->internal_error should > be cleared here first? Hm, no, as far as I can see existing diagnostic machinery is supposed to fully handle that.

Re: [PATCH] Dump function on internal errors

2017-05-29 Thread Jakub Jelinek
On Mon, May 29, 2017 at 07:15:33PM +0300, Alexander Monakov wrote: > @@ -1063,6 +1064,17 @@ open_auxiliary_file (const char *ext) >return file; > } > > +/* Auxiliary callback for the diagnostics code. */ > + > +static void > +internal_error_function (diagnostic_context *context

Re: [PATCH] Dump function on internal errors

2017-05-29 Thread Alexander Monakov
Hi, On Wed, 24 May 2017, Richard Biener wrote: > current_pass might be NULL so you better do set_internal_error_hook when > we start executing passes (I detest global singletons to do such stuff > anyway). I think there are other problems in this patch, dump_function_to_file won't work after

Re: [PATCH] Dump function on internal errors

2017-05-24 Thread Richard Biener
On Mon, May 22, 2017 at 4:19 PM, Andi Kleen wrote: > From: Andi Kleen > > When a verification check fails it is useful to dump the current > function to the dump file, so it's easier to figure out what > actually went wrong. > > v2: Updated version now

[PATCH] Dump function on internal errors

2017-05-22 Thread Andi Kleen
From: Andi Kleen When a verification check fails it is useful to dump the current function to the dump file, so it's easier to figure out what actually went wrong. v2: Updated version now using a hook in internal_error, and also prints the pass name and the dump file name.