From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20919 invoked by alias); 20 Mar 2015 19:11:37 -0000 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 Received: (qmail 20904 invoked by uid 89); 20 Mar 2015 19:11:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 20 Mar 2015 19:11:35 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id ACAE3B6A26 for ; Fri, 20 Mar 2015 19:11:34 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2KJBXsU032249; Fri, 20 Mar 2015 15:11:33 -0400 Message-ID: <550C70E4.4090408@redhat.com> Date: Fri, 20 Mar 2015 19:11:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Sergio Durigan Junior CC: GDB Patches Subject: Re: [PATCH 1/4] Improve identification of memory mappings References: <1426707523-6499-1-git-send-email-sergiodj@redhat.com> <1426707523-6499-2-git-send-email-sergiodj@redhat.com> <550AA753.7060609@redhat.com> <87lhistwmm.fsf@redhat.com> In-Reply-To: <87lhistwmm.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-03/txt/msg00668.txt.bz2 On 03/19/2015 11:06 PM, Sergio Durigan Junior wrote: > However, IMHO gcore_create_callback still has some problems. For > example, this heuristic used to determine whether a mapping should be > dumped or not: > > if (write == 0 && modified == 0 && !solib_keep_data_in_core (vaddr, size)) > { > /* See if this region of memory lies inside a known file on disk. > If so, we can avoid copying its contents by clearing SEC_LOAD. */ > struct objfile *objfile; > struct obj_section *objsec; > > ALL_OBJSECTIONS (objfile, objsec) > { > bfd *abfd = objfile->obfd; > asection *asec = objsec->the_bfd_section; > bfd_vma align = (bfd_vma) 1 << bfd_get_section_alignment (abfd, > asec); > bfd_vma start = obj_section_addr (objsec) & -align; > bfd_vma end = (obj_section_endaddr (objsec) + align - 1) & -align; > > /* Match if either the entire memory region lies inside the > section (i.e. a mapping covering some pages of a large > segment) or the entire section lies inside the memory region > (i.e. a mapping covering multiple small sections). > > This BFD was synthesized from reading target memory, > we don't want to omit that. */ > if (objfile->separate_debug_objfile_backlink == NULL > && ((vaddr >= start && vaddr + size <= end) > || (start >= vaddr && end <= vaddr + size)) > && !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY)) > { > flags &= ~(SEC_LOAD | SEC_HAS_CONTENTS); > goto keep; /* Break out of two nested for loops. */ > } > } > > keep:; > } > > will not be used by any code, because everyone will be passing > 'modified' as 1 with my following patch (the only code that could pass > 'modified' as zero was linux_find_memory_regions_full, which I will > patch to only pass 1 as well). Alright. Good that that now became clear. I found the initial submission for that, btw: https://sourceware.org/ml/gdb-patches/2003-10/msg00164.html I wonder whether it'd be worth to keep that somehow, for the fallback cases when /proc//smaps or some other /proc file you're relying on for file-backed read-only region identification is missing (because old kernel, or even /proc not mounted). Maybe not. Thanks, Pedro Alves