From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1984) id 067C0385842B; Thu, 9 Mar 2023 19:44:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 067C0385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678391066; bh=3G1TIJu+ql0lXrvJedH7X+Rf1dqg8JIR7gNnC5TqeSY=; h=From:To:Subject:Date:From; b=sEFm5hGoJPRQnIJDaX4cGnsr5cuSe0DQuOoydbrk0U9FnO5LlEb7UC9V8nSDdCRaB hljiHApSbG4z1AVspXPjchO4iLTPa+JdEPT5pW4l13vYFTj89zEGWFoLftAld3ojeZ ycksi9vUSnT0TRNuVkWGYcoNr71FkOI3bpG3/VbI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Tamar Christina To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-6564] middle-end: On emergency dumps finish the graph generation. X-Act-Checkin: gcc X-Git-Author: Tamar Christina X-Git-Refname: refs/heads/master X-Git-Oldrev: 8e26ac4749c5ddf827e18a846b1010b091f76fa2 X-Git-Newrev: ec4bc86b4399e50a0c848472126dad776772ee1c Message-Id: <20230309194426.067C0385842B@sourceware.org> Date: Thu, 9 Mar 2023 19:44:26 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ec4bc86b4399e50a0c848472126dad776772ee1c commit r13-6564-gec4bc86b4399e50a0c848472126dad776772ee1c Author: Tamar Christina Date: Thu Mar 9 19:43:08 2023 +0000 middle-end: On emergency dumps finish the graph generation. When doing an emergency dump the cfg output dumps are corrupted because the ending "}" is missing. Normally when the pass manager finishes it would call finish_graph_dump_file to produce this. This is called here because each pass can dump multiple digraphs. However during an emergency dump we only dump the current function and so after that is done we never go back to the pass manager. As such, we need to manually call finish_graph_dump_file in order to properly finish off graph generation. With this -ftree-dump-*-graph works properly during a crash dump. gcc/ChangeLog: * passes.cc (emergency_dump_function): Finish graph generation. Diff: --- gcc/passes.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/passes.cc b/gcc/passes.cc index 91d560720c3..2f0e378b8b2 100644 --- a/gcc/passes.cc +++ b/gcc/passes.cc @@ -1845,6 +1845,13 @@ emergency_dump_function () fprintf (dump_file, "\n\n\nEMERGENCY DUMP:\n\n"); execute_function_dump (cfun, current_pass); + /* Normally the passmanager will close the graphs as a pass could be wanting + to print multiple digraphs. But during an emergency dump there can only be + one and we must finish the graph manually. */ + if ((cfun->curr_properties & PROP_cfg) + && (dump_flags & TDF_GRAPH)) + finish_graph_dump_file (dump_file_name); + if (symtab && current_pass->type == IPA_PASS) symtab->dump (dump_file); }