From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32544 invoked by alias); 19 Apr 2007 14:16:54 -0000 Received: (qmail 32536 invoked by uid 22791); 19 Apr 2007 14:16:53 -0000 X-Spam-Check-By: sourceware.org Received: from province.act-europe.fr (HELO province.act-europe.fr) (212.157.227.214) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 19 Apr 2007 15:16:50 +0100 Received: by province.act-europe.fr (Postfix, from userid 560) id B81B2164F38; Thu, 19 Apr 2007 16:16:47 +0200 (CEST) Date: Thu, 19 Apr 2007 14:23:00 -0000 From: Jerome Guitton To: gdb-patches@sources.redhat.com Subject: [RFA] dwarf2read - empty file name table Message-ID: <20070419141647.GA53265@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i 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/msg00294.txt.bz2 I am using a third-party library which makes GDB crash; it has the following entry in its .debug_line: [...] Dump of debug contents of section .debug_line: Length: 35 DWARF Version: 2 Prologue Length: 19 Minimum Instruction Length: 4 Initial value of 'is_stmt': 1 Line Base: -1 Line Range: 4 Opcode Base: 13 (Pointer size: 4) Opcodes: Opcode 1 has 0 args Opcode 2 has 1 args Opcode 3 has 1 args Opcode 4 has 1 args Opcode 5 has 1 args Opcode 6 has 0 args Opcode 7 has 0 args Opcode 8 has 0 args Opcode 9 has 1 args Opcode 10 has 0 args Opcode 11 has 0 args Opcode 12 has 1 args The Directory Table is empty. The File Name Table is empty. Line Number Statements: Extended opcode 2: set Address to 0x10000 Extended opcode 1: End of Sequence [...] Note that the file name table is empty and that no file name is specified in the line number statements. Not sure what is the use of such an entry, but it does not seem invalid to me. Anyway, this makes GDB crash in dwarf2read.c (trying to read into a num file name table at End of Sequence). The followwing patch should fix this problem. Ok to apply? Thanks in advance, Jerome 2007-04-19 Jerome Guitton * dwarf2read.c (dwarf_decode_lines): Do not dereference file_names if NULL. Index: dwarf2read.c =================================================================== --- dwarf2read.c (revision 6081) +++ dwarf2read.c (revision 6082) @@ -6996,7 +6996,8 @@ { case DW_LNE_end_sequence: end_sequence = 1; - lh->file_names[file - 1].included_p = 1; + if (lh->file_names_size) + lh->file_names[file - 1].included_p = 1; if (!decode_for_pst_p) record_line (current_subfile, 0, address); break;