|
|
5144ac |
commit afa840dcc021eaeb975dcde3bedbf46ea0511717
|
|
|
5144ac |
Author: Sergio Lopez <slp@redhat.com>
|
|
|
5144ac |
Date: Mon Dec 4 09:17:12 2017 +0100
|
|
|
5144ac |
|
|
|
5144ac |
Implement 'set dump-excluded-mappings' command
|
|
|
5144ac |
|
|
|
5144ac |
Commit df8411da087dc05481926f4c4a82deabc5bc3859 implemented support for
|
|
|
5144ac |
checking /proc/PID/coredump_filter, and also changed gcore behavior to
|
|
|
5144ac |
unconditionally honor the VM_DONTDUMP flag, preventing sections marked
|
|
|
5144ac |
as such for being dumped into the core file.
|
|
|
5144ac |
|
|
|
5144ac |
This patch implements the 'set dump-excluded-mappings' command for
|
|
|
5144ac |
instructing gdb to ignore the VM_DONTDUMP flag. Combined with 'set
|
|
|
5144ac |
use-coredump-filter', this allows the user to restore the old behavior,
|
|
|
5144ac |
dumping all sections (except the ones marked as IO) unconditionally.
|
|
|
5144ac |
|
|
|
5144ac |
gdb/Changelog:
|
|
|
5144ac |
2017-11-29 Sergio Lopez <slp@redhat.com>
|
|
|
5144ac |
|
|
|
5144ac |
* linux-tdep.c (dump_excluded_mappings): New variable.
|
|
|
5144ac |
(dump_mapping_p): Use dump_excluded_mappings variable.
|
|
|
5144ac |
(_initialize_linux_tdep): New command 'set dump_excluded_mappings'.
|
|
|
5144ac |
|
|
|
5144ac |
Index: gdb-7.6.1/gdb/linux-tdep.c
|
|
|
5144ac |
===================================================================
|
|
|
5144ac |
--- gdb-7.6.1.orig/gdb/linux-tdep.c 2017-12-06 20:38:51.182203906 +0100
|
|
|
5144ac |
+++ gdb-7.6.1/gdb/linux-tdep.c 2017-12-06 20:39:12.708343183 +0100
|
|
|
5144ac |
@@ -88,6 +88,11 @@
|
|
|
5144ac |
|
|
|
5144ac |
static int use_coredump_filter = 1;
|
|
|
5144ac |
|
|
|
5144ac |
+/* Whether the value of smaps_vmflags->exclude_coredump should be
|
|
|
5144ac |
+ ignored, including mappings marked with the VM_DONTDUMP flag in
|
|
|
5144ac |
+ the dump. */
|
|
|
5144ac |
+static int dump_excluded_mappings = 0;
|
|
|
5144ac |
+
|
|
|
5144ac |
static struct gdbarch_data *linux_gdbarch_data_handle;
|
|
|
5144ac |
|
|
|
5144ac |
struct linux_gdbarch_data
|
|
|
5144ac |
@@ -512,7 +517,7 @@
|
|
|
5144ac |
return 0;
|
|
|
5144ac |
|
|
|
5144ac |
/* Check if we should exclude this mapping. */
|
|
|
5144ac |
- if (v->exclude_coredump)
|
|
|
5144ac |
+ if (!dump_excluded_mappings && v->exclude_coredump)
|
|
|
5144ac |
return 0;
|
|
|
5144ac |
|
|
|
5144ac |
/* Update our notion of whether this mapping is shared or
|
|
|
5144ac |
@@ -1886,6 +1891,17 @@
|
|
|
5144ac |
" corefiles is %s.\n"), value);
|
|
|
5144ac |
}
|
|
|
5144ac |
|
|
|
5144ac |
+/* Display whether the gcore command is dumping mappings marked with
|
|
|
5144ac |
+ the VM_DONTDUMP flag. */
|
|
|
5144ac |
+
|
|
|
5144ac |
+static void
|
|
|
5144ac |
+show_dump_excluded_mappings (struct ui_file *file, int from_tty,
|
|
|
5144ac |
+ struct cmd_list_element *c, const char *value)
|
|
|
5144ac |
+{
|
|
|
5144ac |
+ fprintf_filtered (file, _("Dumping of mappings marked with the VM_DONTDUMP"
|
|
|
5144ac |
+ " flag is %s.\n"), value);
|
|
|
5144ac |
+}
|
|
|
5144ac |
+
|
|
|
5144ac |
/* To be called from the various GDB_OSABI_LINUX handlers for the
|
|
|
5144ac |
various GNU/Linux architectures and machine types. */
|
|
|
5144ac |
|
|
|
5144ac |
@@ -1921,4 +1937,16 @@
|
|
|
5144ac |
about this file, refer to the manpage of core(5)."),
|
|
|
5144ac |
NULL, show_use_coredump_filter,
|
|
|
5144ac |
&setlist, &showlist);
|
|
|
5144ac |
+
|
|
|
5144ac |
+ add_setshow_boolean_cmd ("dump-excluded-mappings", class_files,
|
|
|
5144ac |
+ &dump_excluded_mappings, _("\
|
|
|
5144ac |
+Set whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
|
|
|
5144ac |
+ _("\
|
|
|
5144ac |
+Show whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
|
|
|
5144ac |
+ _("\
|
|
|
5144ac |
+Use this command to set whether gcore should dump mappings marked with the\n\
|
|
|
5144ac |
+VM_DONTDUMP flag (\"dd\" in /proc/PID/smaps) when generating the corefile. For\n\
|
|
|
5144ac |
+more information about this file, refer to the manpage of proc(5) and core(5)."),
|
|
|
5144ac |
+ NULL, show_dump_excluded_mappings,
|
|
|
5144ac |
+ &setlist, &showlist);
|
|
|
5144ac |
}
|