From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8203 invoked by alias); 11 Jul 2007 19:27:33 -0000 Received: (qmail 8195 invoked by uid 22791); 11 Jul 2007 19:27:33 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 11 Jul 2007 19:27:31 +0000 Received: (qmail 10371 invoked from network); 11 Jul 2007 19:27:29 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Jul 2007 19:27:29 -0000 To: gdb-patches@sourceware.org Subject: Re: [rfc] Detect dwarf address size mismatch References: <20070711141912.GA12298@caradoc.them.org> From: Jim Blandy Date: Wed, 11 Jul 2007 19:27:00 -0000 In-Reply-To: <20070711141912.GA12298@caradoc.them.org> (Daniel Jacobowitz's message of "Wed, 11 Jul 2007 10:19:12 -0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-07/txt/msg00177.txt.bz2 Daniel Jacobowitz writes: > I just fixed a gas bug which caused MIPS64 Linux kernels to have > corrupt DWARF information. The .debug_info compilation unit header > listed the address size as 4, but the .debug_line section used 64-bit > addresses. This caused GDB to parse the last four bits of each > address as if they were instructions in the line number program. > > That version of GDB crashed when it got a bogus DW_LNS_set_file with > an out-of-bounds file number (which has already been fixed in HEAD). > But I think this patch is still useful, to detect the mismatch > promptly instead of going off into the woods parsing bad data. > I think I did get HEAD to crash once while testing. > > A more intrusive patch could let GDB handle the bad files as their > producer intended, by reading an address of size extended_len - 1, > but I don't think it's worth it when we can fix gas. > > Any comments on this patch, or shall I commit it? Would it make sense to move the check after the extended_op switch altogether, and always use extended_len to advance line_ptr? This would make GDB more robust against new extended opcodes. The complaint is definitely appropriate, though.