From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28436 invoked by alias); 11 Jul 2003 07:06:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28426 invoked from network); 11 Jul 2003 07:06:16 -0000 Received: from unknown (HELO maxipes.logix.cz) (81.0.234.97) by sources.redhat.com with SMTP; 11 Jul 2003 07:06:16 -0000 Received: from suse.cz (styx.suse.cz [213.210.157.162]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "Thawte Freemail Member", Issuer "Personal Freemail RSA 2000.8.30" (not verified)) by maxipes.logix.cz (Postfix) with ESMTP id 185E52AA53 for ; Fri, 11 Jul 2003 09:05:39 +0200 (CEST) Message-ID: <3F0E61E7.5020900@suse.cz> Date: Fri, 11 Jul 2003 07:06:00 -0000 From: Michal Ludvig Organization: SuSE CR, s.r.o. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5a) Gecko/20030610 X-Accept-Language: cs, cz, en MIME-Version: 1.0 To: GDB Patches Subject: [RFA] Avoid segfault in decode_line_2 Content-Type: multipart/mixed; boundary="------------030803090706050104050706" X-SW-Source: 2003-07/txt/msg00233.txt.bz2 This is a multi-part message in MIME format. --------------030803090706050104050706 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 717 Hi all, this patch fixes a problem that I met while debugging a testsuite failure on amd64: > Running gdb-head/gdb/testsuite/gdb.c++/templates.exp ... > FAIL: gdb.c++/templates.exp: constructor breakpoint (timeout) (gdb) break T5::T5 -> Segfault in linespec.c:486 [decode_line_2()] because values.sals[i].symtab is NULL and dereferencing of values.sals[i].symtab->filename crashes. After some investigation I found out that .debug_line section of the input file was broken (reported to binutils@ list). However broken debug info is not an excuse for GDB to crash. OK to apply to head and branch? Michal Ludvig -- * SuSE CR, s.r.o * mludvig@suse.cz * (+420) 296.545.373 * http://www.suse.cz --------------030803090706050104050706 Content-Type: text/plain; name="linespec-safety-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="linespec-safety-1.diff" Content-length: 1123 2003-07-11 Michal Ludvig * linespec.c (decode_line_2): Avoid crash if find_function_start_sal() returns empty record. Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.49 diff -u -p -r1.49 linespec.c --- linespec.c 8 Jun 2003 18:27:13 -0000 1.49 +++ linespec.c 11 Jul 2003 06:59:01 -0000 @@ -483,11 +483,16 @@ decode_line_2 (struct symbol *sym_arr[], if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK) { values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline); - printf_unfiltered ("[%d] %s at %s:%d\n", + printf_unfiltered ("[%d] %s at %s:%d ", (i + 2), SYMBOL_PRINT_NAME (sym_arr[i]), - values.sals[i].symtab->filename, + values.sals[i].symtab ? + values.sals[i].symtab->filename : + "?FILE", values.sals[i].line); + if (! values.sals[i].symtab) + printf_unfiltered ("[No symtab? Probably a broken debug info...]" ); + printf_unfiltered ("\n"); } else printf_unfiltered ("?HERE\n"); --------------030803090706050104050706--