ping
On 17/12/2025 15:14, Nathan Sidwell wrote:
This patch augments the crash dumper to print the invocation (that we had handily stashed away). We also already have a convenient static var we use to detect recursion, and can repurpose for holding the argv array.This has proven invaluable in investigating lto crashes I've encountered. nathan
-- Nathan Sidwell
From 456f5b0f7855ee12774528246bd4364ef2c0fb3e Mon Sep 17 00:00:00 2001 From: Nathan Sidwell <[email protected]> Date: Sat, 1 Nov 2025 20:02:47 -0400 Subject: [PATCH] diagnostics: Print invokation on ICE Print the compiler's invocation upon ICE. Particularly useful on LTO crashes. gcc/ * diagnostics/context.cc (context::action_after_output): Print invocation on ICE. --- gcc/diagnostics/context.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/diagnostics/context.cc b/gcc/diagnostics/context.cc index 2543a6031ec..2a767a68fe3 100644 --- a/gcc/diagnostics/context.cc +++ b/gcc/diagnostics/context.cc @@ -1003,10 +1003,11 @@ context::action_after_output (enum kind diag_kind) /* Attempt to ensure that any outputs are flushed e.g. that .sarif files are written out. Only do it once. */ - static bool finishing_due_to_ice = false; - if (!finishing_due_to_ice) + static char **saved_argv = nullptr; + if (!saved_argv) { - finishing_due_to_ice = true; + saved_argv = m_original_argv; + m_original_argv = nullptr; finish (); } @@ -1021,6 +1022,12 @@ context::action_after_output (enum kind diag_kind) if (m_abort_on_error) real_abort (); + bool space = false; + for (auto *argv = saved_argv; *argv; space = true) + fnotice (stderr, &" %s"[1 - space], *argv++); + fnotice (stderr, "\n"); + freeargv (saved_argv); + if (m_report_bug) fnotice (stderr, "Please submit a full bug report, " "with preprocessed source.\n"); -- 2.51.1
