From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21470 invoked by alias); 23 Jun 2006 13:08:27 -0000 Received: (qmail 21460 invoked by uid 22791); 23 Jun 2006 13:08:26 -0000 X-Spam-Check-By: sourceware.org Received: from ip-85-160-32-69.eurotel.cz (HELO host0.dyn.jankratochvil.net) (85.160.32.69) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 23 Jun 2006 13:08:23 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.13.6/8.13.4) with ESMTP id k5ND7XAY000554; Fri, 23 Jun 2006 15:07:34 +0200 Received: (from lace@localhost) by host0.dyn.jankratochvil.net (8.13.6/8.13.6/Submit) id k5ND7W5E000553; Fri, 23 Jun 2006 15:07:32 +0200 Date: Fri, 23 Jun 2006 13:08:00 -0000 From: Jan Kratochvil To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: [patch] Fix gdb crash on some missing ELF debug info Message-ID: <20060623130732.GA28950@host0.dyn.jankratochvil.net> References: <20060623103735.GA28356@host0.dyn.jankratochvil.net> <20060623123913.GB16879@nevyn.them.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tsOsTdHNUZQcU9Ye" Content-Disposition: inline In-Reply-To: <20060623123913.GB16879@nevyn.them.org> User-Agent: Mutt/1.4.2.1i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00359.txt.bz2 --tsOsTdHNUZQcU9Ye Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1799 Hi Daniel, On Fri, 23 Jun 2006 14:39:13 +0200, Daniel Jacobowitz wrote: ... > The idea is definitely right - thanks! The patch could be a bit > better: > > - We really ought to check that it fits within .debug_loc while we're > here. OK, fixed (I feel that the DWARF2 processing code is not so foolproof). > - And I really can't figure out what what you mean by the comment. Do > you mean "if we get here, and DW_UNSND (attr) != 0, and we hadn't added > the next condition, then we'd end up with bogus ->size"? sorry, it references the code below in dwarf2_symbol_mark_computed(). dwarf2_symbol_mark_computed(): if (".debug_loc" is missing) { assume (dwarf2_per_objfile->loc_size == 0); assume (dwarf2_per_objfile->loc_buffer == NULL); } assume(DW_UNSND (attr) != 0); baton->size = dwarf2_per_objfile->loc_size - DW_UNSND (attr); baton->data = dwarf2_per_objfile->loc_buffer + DW_UNSND (attr); dwarf_expr_frame_base(): *start = symbaton->data; MISSED, *(*start) crashes: if (*start == NULL) error ("Could not find the frame base ..."); > You've been submitting a lot of fixes recently; while most of them are > small, some are big enough to probably require a copyright assignment. > Have you got one, or shall I send you the forms? I already signed the copyright assignment to FSF intended for GNU Libtool but the assignment form looks completely project unspecific to me. I should be listed there as "Jan Kratochvil", it may be for the e-mail address . Bradley M. Kuhn signed it on 7 Feb 2003. > - Oh, and no ChangeLog 2006-06-23 Jan Kratochvil * dwarf2read.c (dwarf2_symbol_mark_computed): Fixed later crash on location list reference if the ".debug_loc" section is missing. Regards, Jan Kratochvil --tsOsTdHNUZQcU9Ye Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-cvs20060623-debug_loc-v2.patch" Content-length: 1183 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=196439 Fedora Core 5: gdb /usr/lib/valgrind/x86-linux/memcheck break _start_in_C run segfault eu-readelf -w /usr/lib/valgrind/x86-linux/memcheck DWARF section '.debug_info' at offset 0x14759c: ... [ 176d4] subprogram ... name "_start_in_C" ... frame_base location list [ 116d7] corrupted as no location lists (.debug_loc) exist there at all. Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.199 diff -u -p -r1.199 dwarf2read.c --- dwarf2read.c 14 Jun 2006 15:06:35 -0000 1.199 +++ dwarf2read.c 23 Jun 2006 12:46:34 -0000 @@ -9324,7 +9324,9 @@ static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu) { - if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8) + if ((attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8) + /* ".debug_loc" may not exist at all. */ + && DW_UNSND (attr) < dwarf2_per_objfile->loc_size) { struct dwarf2_loclist_baton *baton; --tsOsTdHNUZQcU9Ye--