[PATCH v4 0/2] Improve corefile generation by using /proc/PID/coredump_filter (PR corefile/16902)

Sergio Durigan Junior sergiodj@redhat.com
Tue Mar 24 23:57:00 GMT 2015


Hello,

This is the fifth version of this patch series.  It basically includes
fixes to make GDB mimic the Linux kernel's behavior when dealing with
"file-backed mappings with anonymous pages".  As explained on:

  <https://sourceware.org/ml/gdb-patches/2015-03/msg00814.html>

in this situation, the Linux kernel dumps this "special" mapping both
when the user has requested file-backed or anonymous mappings to be
included in the corefile.  Now, GDB does the same thing.

The patch also extends the testcase in order to make sure that,
depending on the type of the corefile we are dealing with, we can or
cannot disassemble a section of the code without loading a binary.  The
approach I took for this is:

  - For corefiles that include the file-backed mappings, GDB should be
    able to disassemble.

  - For corefiles that do not include file-backed nor anonymous
    mappings, GDB should not be able to disassemble.

It was necessary to "relax" the second test because, as explained in the
message linked above, when you load a binary inside GDB its .text
segment contains anonymous pages, so if you ask for a corefile without
file-backed mappings (which, in theory, should exclude the .text
segment), GDB will still include the .text segment because this kind of
mapping is *also* considered an anonymous mapping (the Linux kernel does
the same thing here).

Other than that, the code is the same.  The documentation has been
approved already, but I am including a NEWS entry this time (I wasn't
sure if it was worth it or not, so I decided to go ahead and do it).

OK to apply?

Sergio Durigan Junior (2):
  Implement support for checking /proc/PID/coredump_filter
  Documentation and testcase

 gdb/doc/gdb.texinfo                        |  33 +++
 gdb/linux-tdep.c                           | 455 +++++++++++++++++++++++++++--
 gdb/testsuite/gdb.base/coredump-filter.c   |  61 ++++
 gdb/testsuite/gdb.base/coredump-filter.exp | 198 +++++++++++++
 4 files changed, 719 insertions(+), 28 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/coredump-filter.c
 create mode 100644 gdb/testsuite/gdb.base/coredump-filter.exp

-- 
1.9.3



More information about the Gdb-patches mailing list