From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8953 invoked by alias); 2 Feb 2011 19:55:42 -0000 Received: (qmail 8944 invoked by uid 22791); 2 Feb 2011 19:55:41 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_RU_URL,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,TW_BJ,TW_JC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Feb 2011 19:55:36 +0000 Received: from hpaq3.eem.corp.google.com (hpaq3.eem.corp.google.com [172.25.149.3]) by smtp-out.google.com with ESMTP id p12JtYlD032046 for ; Wed, 2 Feb 2011 11:55:34 -0800 Received: from qwa26 (qwa26.prod.google.com [10.241.193.26]) by hpaq3.eem.corp.google.com with ESMTP id p12JtVKE002623 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Wed, 2 Feb 2011 11:55:32 -0800 Received: by qwa26 with SMTP id 26so387172qwa.5 for ; Wed, 02 Feb 2011 11:55:31 -0800 (PST) Received: by 10.224.63.228 with SMTP id c36mr1697894qai.17.1296676531490; Wed, 02 Feb 2011 11:55:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.87.162 with HTTP; Wed, 2 Feb 2011 11:55:00 -0800 (PST) In-Reply-To: <4D46D872.6080407@sw.ru> References: <1296238472.3009.ezmlm@sourceware.org> <4D46D872.6080407@sw.ru> From: Paul Pluzhnikov Date: Wed, 02 Feb 2011 19:55:00 -0000 Message-ID: Subject: Re: gdb: Incorrect stack unwinding if compressed debug info is used To: Vladimir Simonov Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=KOI8-R X-System-Of-Record: true 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: 2011-02/txt/msg00028.txt.bz2 On Mon, Jan 31, 2011 at 7:42 AM, Vladimir Simonov wrote: > If I create -Od -g3 executable with -Wl,compressed-debug-sections=zlib What is '-Od' ? And you mean '-Wl,--compress-debug-sections=zlib', not '-Wl,compressed-debug-sections=zlib' > using gold linker or compress debug-info via objcopy I have problems with > local variables and bacttraces in gdb. Can you construct a small example showing the problem? I haven't been able to reproduce it. > Something like this: > gdb: bt > .... > #11 0xb2356a74 in Core::WorkerImpl::WorkerThread (this=Could not find > the frame base for "Core::WorkerImpl::WorkerThread()". > ) > .... > > I've spend some time and, looks like, found the problem. It is in > dwarf2_symbol_mark_computed function (dwarf2read.c). Check > "DW_UNSND (attr) < dwarf2_per_objfile->loc.size" > is incorrect if compressed section is used. In this case > loc.size contains compressed section size, not decompressed one. > It happens if the section has not been read via dwarf2_read_section yet. > But dwarf2_locate_sections has been done. I am curious how your GDB avoids dwarf2_read_section(). As far as I can tell, it should always be called (indirectly) by dwarf2_initialize_objfile(). > As result symbols not passed above verification are left with > size==0 and data==NULL after dwarf2_symbol_mark_computed function. > > The patch idea is to introduce uncompressed_size field in > struct dwarf2_section_info. And fill it in dwarf2_locate_sections. > Check in dwarf2_symbol_mark_computed function takes into > account uncompressed_size. The patch is quite large cause I > try to avoid code duplication with zlib_decompress section. Assuming the patch makes sense (which I am not yet convinced) ... +static void +fill_dwarf2_section_info (struct dwarf2_section_info* info, + bfd *abfd, asection *sectp) +{ + bfd_size_type size; + + info->asection = sectp; + info->size = bfd_get_section_size (sectp); + info->uncompressed_size = 0; + if (!is_compressed_section_name (sectp->name)) + return; + read_uncompressed_size (abfd, sectp, &info->uncompressed_size); +} Would it make sense to just set uncompressed_size to size if the section is not compressed? I think that would simplify the patch a bit. + fill_dwarf2_section_info(&dwarf2_per_objfile->info, abfd, sectp); Missing space before '('. Your patch is also missing ChangeLog entry. Cheers, -- Paul Pluzhnikov