From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124542 invoked by alias); 24 Mar 2015 23:48:23 -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 124522 invoked by uid 89); 24 Mar 2015 23:48:20 -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; Tue, 24 Mar 2015 23:48:19 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2ONmION000428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 24 Mar 2015 19:48:18 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2ONmGHP022206; Tue, 24 Mar 2015 19:48:17 -0400 Message-ID: <5511F7BF.9040700@redhat.com> Date: Tue, 24 Mar 2015 23:48: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 2/2] Documentation and testcase References: <1426807358-18295-1-git-send-email-sergiodj@redhat.com> <1426807358-18295-3-git-send-email-sergiodj@redhat.com> <550C7905.9090501@redhat.com> <87mw37wfd6.fsf@redhat.com> <550C9A7C.90705@redhat.com> <87wq283gmx.fsf@redhat.com> <5510773D.4010107@redhat.com> <87wq274e1w.fsf@redhat.com> <55109C7E.2040504@redhat.com> <87619q2961.fsf@redhat.com> <55113880.4060707@redhat.com> <87egoe2dij.fsf@redhat.com> In-Reply-To: <87egoe2dij.fsf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-03/txt/msg00815.txt.bz2 On 03/24/2015 11:15 PM, Sergio Durigan Junior wrote: > And I am back, with new investigations and results. This whole thing is > starting to driving me crazy. > > What I found is interesting. When a memory mapping is file-backed, but > contains Anonymous: pages, the Linux kernel dumps this region when: > > - The user asks for anonymous pages, *OR* > > - The user asks for file-backed pages > > Yes, it dumps the mapping in *both* scenarios. It is like a > "file-backed anonymous" mapping... It makes sense to me. > > I adjusted my patch to mimic this behavior. However, there is one more > thing... > > For some reason, when I run the binary inside GDB, the .text segment > *contains* Anonymous: pages. However, when I run the binary outside > GDB, the Anonymous: counter is always zero. This means that, inside > GDB, when we ask for a corefile that excludes file-backed private > mappings (i.e., the .text segment), according to the Linux kernel's > rules, the .text segment *still* should be dumped because it contains > Anonymous: pages. I'd guess those were pages gdb poked/wrote to? Breakpoints, most likely. That should trigger a COW of the poked page. > Unfortunately, I was not able to generate a binary whose .text segment > contained Anonymous: pages outside GDB. However, I made a binary > that has Anonymous: pages on a file-backed mapping, and I made the Linux > kernel generate a corefile for it while asking it to exclude file-backed > mappings, and I could confirm that the Linux kernel indeed includes this > mapping in the corefile. > > My final proposal, which will be reflected in a patch that will be > submitted soon, is to relax the test of the the disassembly of main. > This way, we can still mimic what the Linux kernel does and make GDB > compatible with it. Not sure what relax means, but I'll just wait for the patch. :-) Thanks, Pedro Alves