public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/2] Documentation and testcase
Date: Tue, 24 Mar 2015 23:48:00 -0000	[thread overview]
Message-ID: <5511F7BF.9040700@redhat.com> (raw)
In-Reply-To: <87egoe2dij.fsf@redhat.com>

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

  reply	other threads:[~2015-03-24 23:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 23:22 [PATCH v4 0/2] Improve corefile generation by using /proc/PID/coredump_filter (PR corefile/16902) Sergio Durigan Junior
2015-03-19 23:22 ` [PATCH 2/2] Documentation and testcase Sergio Durigan Junior
2015-03-20 19:46   ` Pedro Alves
2015-03-20 21:03     ` Sergio Durigan Junior
2015-03-20 22:09       ` Pedro Alves
2015-03-22 20:46         ` Sergio Durigan Junior
2015-03-23 20:27           ` Pedro Alves
2015-03-23 21:08             ` Sergio Durigan Junior
2015-03-23 23:06               ` Pedro Alves
2015-03-24  6:37                 ` Sergio Durigan Junior
2015-03-24 10:12                   ` Pedro Alves
2015-03-24 23:15                     ` Sergio Durigan Junior
2015-03-24 23:48                       ` Pedro Alves [this message]
2015-03-19 23:22 ` [PATCH 1/2] Implement support for checking /proc/PID/coredump_filter Sergio Durigan Junior
2015-03-20 19:12   ` Pedro Alves
2015-03-20 20:02     ` Sergio Durigan Junior
2015-03-20 22:02       ` Pedro Alves
2015-03-23 18:40         ` Sergio Durigan Junior
2015-03-23 20:36           ` Pedro Alves
2015-03-24 23:57 [PATCH v4 0/2] Improve corefile generation by using /proc/PID/coredump_filter (PR corefile/16902) Sergio Durigan Junior
2015-03-24 23:57 ` [PATCH 2/2] Documentation and testcase Sergio Durigan Junior
2015-03-27  9:53   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5511F7BF.9040700@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).