From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23764 invoked by alias); 4 Feb 2011 16:34:48 -0000 Received: (qmail 23598 invoked by uid 22791); 4 Feb 2011 16:34:47 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,FSL_RU_URL,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Feb 2011 16:34:24 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p14GYNRb032660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Feb 2011 11:34:23 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p14GYMt8018448; Fri, 4 Feb 2011 11:34:22 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p14GYLKN007052; Fri, 4 Feb 2011 11:34:21 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 2FAB13784E1; Fri, 4 Feb 2011 09:34:21 -0700 (MST) From: Tom Tromey To: Vladimir Simonov Cc: gdb-patches@sourceware.org Subject: Re: gdb: Incorrect stack unwinding if compressed debug info is used References: <1296238472.3009.ezmlm@sourceware.org> <4D46D872.6080407@sw.ru> Date: Fri, 04 Feb 2011 16:34:00 -0000 In-Reply-To: <4D46D872.6080407@sw.ru> (Vladimir Simonov's message of "Mon, 31 Jan 2011 18:42:42 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2011-02/txt/msg00071.txt.bz2 >>>>> "Vladimir" == Vladimir Simonov writes: Vladimir> I've spend some time and, looks like, found the problem. It is in Vladimir> dwarf2_symbol_mark_computed function (dwarf2read.c). Check Vladimir> "DW_UNSND (attr) < dwarf2_per_objfile->loc.size" Vladimir> is incorrect if compressed section is used. Thanks for finding this. Since fill_in_loclist_baton is going to read the loc section right away anyhow, it seems to me that it is simpler to just have dwarf2_symbol_mark_computed do it. Could you try the appended? I didn't audit the other uses of .size (yet) to see if this problem occurs elsewhere. Tom diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 6a98d57..e1657b6 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -14361,6 +14361,13 @@ static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu) { + if (attr_form_is_section_offset (attr)) + /* We need to read the section before we can check its size, + because the size is only valid once the section is + uncompressed. */ + dwarf2_read_section (dwarf2_per_objfile->objfile, + &dwarf2_per_objfile->loc); + if (attr_form_is_section_offset (attr) /* ".debug_loc" may not exist at all, or the offset may be outside the section. If so, fall through to the complaint in the