From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2920 invoked by alias); 19 Apr 2007 14:23:32 -0000 Received: (qmail 2910 invoked by uid 22791); 19 Apr 2007 14:23:31 -0000 X-Spam-Check-By: sourceware.org Received: from return.false.org (HELO return.false.org) (66.207.162.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 19 Apr 2007 15:23:25 +0100 Received: from return.false.org (localhost [127.0.0.1]) by return.false.org (Postfix) with ESMTP id BDA1C4B267; Thu, 19 Apr 2007 09:23:23 -0500 (CDT) Received: from caradoc.them.org (dsl093-172-095.pit1.dsl.speakeasy.net [66.93.172.95]) by return.false.org (Postfix) with ESMTP id F2FCA4B262; Thu, 19 Apr 2007 09:23:14 -0500 (CDT) Received: from drow by caradoc.them.org with local (Exim 4.63) (envelope-from ) id 1HeXXU-0008RI-Ds; Thu, 19 Apr 2007 10:23:12 -0400 Date: Thu, 19 Apr 2007 15:06:00 -0000 From: Daniel Jacobowitz To: Jerome Guitton Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] dwarf2read - empty file name table Message-ID: <20070419142312.GA32273@caradoc.them.org> Mail-Followup-To: Jerome Guitton , gdb-patches@sources.redhat.com References: <20070419141647.GA53265@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070419141647.GA53265@adacore.com> User-Agent: Mutt/1.5.15 (2007-04-09) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00295.txt.bz2 On Thu, Apr 19, 2007 at 04:16:47PM +0200, Jerome Guitton wrote: > > I am using a third-party library which makes GDB crash; it has the > following entry in its .debug_line: I've seen ARM's compiler produce this construct. In fact, I had a patch sitting in my behind schedule backlog for this very issue... Could you see if this works for you? There's a number of other places with the same problem. -- Daniel Jacobowitz CodeSourcery 2007-04-19 Paul Brook Daniel Jacobowitz * dwarf2read.c (dwarf2_debug_line_missing_file_complaint): New function. (dwarf_decode_lines): Check for line info without a file. --- gdb/dwarf2read.c 2007-04-12 10:52:32.000000000 -0400 +++ gdb/dwarf2read.c 2007-04-19 10:18:51.000000000 -0400 @@ -688,6 +688,13 @@ dwarf2_statement_list_fits_in_line_numbe } static void +dwarf2_debug_line_missing_file_complaint (void) +{ + complaint (&symfile_complaints, + _(".debug_line section has line data without a file")); +} + +static void dwarf2_complex_location_expr_complaint (void) { complaint (&symfile_complaints, _("location expression too complex")); @@ -6711,19 +6942,24 @@ dwarf_decode_lines (struct line_header * address += (adj_opcode / lh->line_range) * lh->minimum_instruction_length; line += lh->line_base + (adj_opcode % lh->line_range); - lh->file_names[file - 1].included_p = 1; - if (!decode_for_pst_p) - { - if (last_subfile != current_subfile) - { - if (last_subfile) - record_line (last_subfile, 0, address); - last_subfile = current_subfile; + if (lh->num_file_names < file) + dwarf2_debug_line_missing_file_complaint (); + else + { + lh->file_names[file - 1].included_p = 1; + if (!decode_for_pst_p) + { + if (last_subfile != current_subfile) + { + if (last_subfile) + record_line (last_subfile, 0, address); + last_subfile = current_subfile; + } + /* Append row to matrix using current values. */ + record_line (current_subfile, line, + check_cu_functions (address, cu)); } - /* Append row to matrix using current values. */ - record_line (current_subfile, line, - check_cu_functions (address, cu)); - } + } basic_block = 1; } else switch (op_code) @@ -6737,9 +6973,15 @@ dwarf_decode_lines (struct line_header * { case DW_LNE_end_sequence: end_sequence = 1; - lh->file_names[file - 1].included_p = 1; - if (!decode_for_pst_p) - record_line (current_subfile, 0, address); + + if (lh->num_file_names < file) + dwarf2_debug_line_missing_file_complaint (); + else + { + lh->file_names[file - 1].included_p = 1; + if (!decode_for_pst_p) + record_line (current_subfile, 0, address); + } break; case DW_LNE_set_address: address = read_address (abfd, line_ptr, cu, &bytes_read); @@ -6772,17 +7014,22 @@ dwarf_decode_lines (struct line_header * } break; case DW_LNS_copy: - lh->file_names[file - 1].included_p = 1; - if (!decode_for_pst_p) + if (lh->num_file_names < file) + dwarf2_debug_line_missing_file_complaint (); + else { - if (last_subfile != current_subfile) - { - if (last_subfile) - record_line (last_subfile, 0, address); - last_subfile = current_subfile; - } - record_line (current_subfile, line, - check_cu_functions (address, cu)); + lh->file_names[file - 1].included_p = 1; + if (!decode_for_pst_p) + { + if (last_subfile != current_subfile) + { + if (last_subfile) + record_line (last_subfile, 0, address); + last_subfile = current_subfile; + } + record_line (current_subfile, line, + check_cu_functions (address, cu)); + } } basic_block = 0; break; @@ -6805,15 +7052,19 @@ dwarf_decode_lines (struct line_header * file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); line_ptr += bytes_read; - fe = &lh->file_names[file - 1]; - if (fe->dir_index) - dir = lh->include_dirs[fe->dir_index - 1]; - - if (!decode_for_pst_p) - { - last_subfile = current_subfile; - dwarf2_start_subfile (fe->name, dir, comp_dir); - } + if (lh->num_file_names < file) + dwarf2_debug_line_missing_file_complaint (); + else + { + fe = &lh->file_names[file - 1]; + if (fe->dir_index) + dir = lh->include_dirs[fe->dir_index - 1]; + if (!decode_for_pst_p) + { + last_subfile = current_subfile; + dwarf2_start_subfile (fe->name, dir, comp_dir); + } + } } break; case DW_LNS_set_column: