From patchwork Tue Dec 13 13:29:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tristan Gingold X-Patchwork-Id: 131083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id EAECB1007D3 for ; Wed, 14 Dec 2011 00:30:19 +1100 (EST) Received: (qmail 9414 invoked by alias); 13 Dec 2011 13:30:14 -0000 Received: (qmail 9396 invoked by uid 22791); 13 Dec 2011 13:30:13 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Dec 2011 13:29:58 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B32DBCB1774 for ; Tue, 13 Dec 2011 14:29:58 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2nEo+myxHC7L for ; Tue, 13 Dec 2011 14:29:58 +0100 (CET) Received: from ulanbator.act-europe.fr (ulanbator.act-europe.fr [10.10.1.67]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id A1005CB16E8 for ; Tue, 13 Dec 2011 14:29:58 +0100 (CET) From: Tristan Gingold Subject: [vms/committed]: fix crash in vmsdbgout.c Date: Tue, 13 Dec 2011 14:29:57 +0100 Message-Id: To: GCC Patches Mime-Version: 1.0 (Apple Message framework v1251.1) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, there were calls in vmsdbgout.c to dwarf2out_source_line outside the normal flow: in end_prologue, begin_epilogue, end_epilogue. This is useless and not not expected by dwarf2out. This patch removes these extra calls, and fixes a crash. Tested by building c+ada for alpha64-dec-openvms. Committed to trunk. Tristan. 2011-12-13 Tristan Gingold * vmsdbgout.c (vmsdbgout_write_source_line): New function. (vmsdbgout_end_prologue): Call vmsdbgout_write_source_line. (vmsdbgout_begin_epilogue): Likewise. (vmsdbgout_end_epilogue): Likewise. (vmsdbgout_source_line): Move code to vmsdbgout_write_source_line. - vmsdbgout_source_line (line, file, 0, true); + vmsdbgout_write_source_line (line, file, 0, true); } } } @@ -1228,7 +1229,7 @@ ASM_OUTPUT_LABEL (asm_out_file, label); /* VMS PCA expects every PC range to correlate to some line and file. */ - vmsdbgout_source_line (line, file, 0, true); + vmsdbgout_write_source_line (line, file, 0, true); } } @@ -1388,6 +1389,31 @@ 'line_info_table' for later output of the .debug_line section. */ static void +vmsdbgout_write_source_line (unsigned line, const char *filename, + int discriminator, bool is_stmt) +{ + dst_line_info_ref line_info; + + targetm.asm_out.internal_label (asm_out_file, LINE_CODE_LABEL, + line_info_table_in_use); + + /* Expand the line info table if necessary. */ + if (line_info_table_in_use == line_info_table_allocated) + { + line_info_table_allocated += LINE_INFO_TABLE_INCREMENT; + line_info_table = XRESIZEVEC (dst_line_info_entry, line_info_table, + line_info_table_allocated); + } + + /* Add the new entry at the end of the line_info_table. */ + line_info = &line_info_table[line_info_table_in_use++]; + line_info->dst_file_num = lookup_filename (filename); + line_info->dst_line_num = line; + if (line > file_info_table[line_info->dst_file_num].max_line) + file_info_table[line_info->dst_file_num].max_line = line; +} + +static void - - targetm.asm_out.internal_label (asm_out_file, LINE_CODE_LABEL, - line_info_table_in_use); - - /* Expand the line info table if necessary. */ - if (line_info_table_in_use == line_info_table_allocated) - { - line_info_table_allocated += LINE_INFO_TABLE_INCREMENT; - line_info_table = XRESIZEVEC (dst_line_info_entry, line_info_table, - line_info_table_allocated); - } - - /* Add the new entry at the end of the line_info_table. */ - line_info = &line_info_table[line_info_table_in_use++]; - line_info->dst_file_num = lookup_filename (filename); - line_info->dst_line_num = line; - if (line > file_info_table[line_info->dst_file_num].max_line) - file_info_table[line_info->dst_file_num].max_line = line; - } + vmsdbgout_write_source_line (line, filename, discriminator, is_stmt); } /* Record the beginning of a new source file, for later output. Index: vmsdbgout.c =================================================================== --- vmsdbgout.c (revision 182280) +++ vmsdbgout.c (working copy) @@ -158,6 +158,7 @@ static void vmsdbgout_end_block (unsigned int, unsigned int); static bool vmsdbgout_ignore_block (const_tree); static void vmsdbgout_source_line (unsigned int, const char *, int, bool); +static void vmsdbgout_write_source_line (unsigned, const char *, int , bool); static void vmsdbgout_begin_prologue (unsigned int, const char *); static void vmsdbgout_end_prologue (unsigned int, const char *); static void vmsdbgout_end_function (unsigned int); @@ -1162,7 +1163,7 @@ ASM_OUTPUT_LABEL (asm_out_file, label); /* VMS PCA expects every PC range to correlate to some line and file. */ - vmsdbgout_source_line (line, file, 0, true); + vmsdbgout_write_source_line (line, file, 0, true); } } @@ -1202,7 +1203,7 @@ } @@ -1202,7 +1203,7 @@ /* VMS PCA expects every PC range to correlate to some line and file. */