* [PATCH v3 1/5] Implement 'set dump-excluded-mappings' command
2017-12-04 8:18 [PATCH v3 0/5] Enable the user to dump all memory regions Sergio Lopez
@ 2017-12-04 8:18 ` Sergio Lopez
2017-12-04 8:18 ` [PATCH v3 2/5] Document new {set,show} dump-excluded-mappings commands Sergio Lopez
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Sergio Lopez @ 2017-12-04 8:18 UTC (permalink / raw)
To: gdb-patches; +Cc: Sergio Lopez
Commit df8411da087dc05481926f4c4a82deabc5bc3859 implemented support for
checking /proc/PID/coredump_filter, and also changed gcore behavior to
unconditionally honor the VM_DONTDUMP flag, preventing sections marked
as such for being dumped into the core file.
This patch implements the 'set dump-excluded-mappings' command for
instructing gdb to ignore the VM_DONTDUMP flag. Combined with 'set
use-coredump-filter', this allows the user to restore the old behavior,
dumping all sections (except the ones marked as IO) unconditionally.
gdb/Changelog:
2017-11-29 Sergio Lopez <slp@redhat.com>
* linux-tdep.c (dump_excluded_mappings): New variable.
(dump_mapping_p): Use dump_excluded_mappings variable.
(_initialize_linux_tdep): New command 'set dump_excluded_mappings'.
---
gdb/linux-tdep.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 24237b8d39..c8a8216c54 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -93,6 +93,11 @@ struct smaps_vmflags
static int use_coredump_filter = 1;
+/* Whether the value of smaps_vmflags->exclude_coredump should be
+ ignored, including mappings marked with the VM_DONTDUMP flag in
+ the dump. */
+static int dump_excluded_mappings = 0;
+
/* This enum represents the signals' numbers on a generic architecture
running the Linux kernel. The definition of "generic" comes from
the file <include/uapi/asm-generic/signal.h>, from the Linux kernel
@@ -655,7 +660,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
return 0;
/* Check if we should exclude this mapping. */
- if (v->exclude_coredump)
+ if (!dump_excluded_mappings && v->exclude_coredump)
return 0;
/* Update our notion of whether this mapping is shared or
@@ -2469,6 +2474,17 @@ show_use_coredump_filter (struct ui_file *file, int from_tty,
" corefiles is %s.\n"), value);
}
+/* Display whether the gcore command is dumping mappings marked with
+ the VM_DONTDUMP flag. */
+
+static void
+show_dump_excluded_mappings (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("Dumping of mappings marked with the VM_DONTDUMP"
+ " flag is %s.\n"), value);
+}
+
/* To be called from the various GDB_OSABI_LINUX handlers for the
various GNU/Linux architectures and machine types. */
@@ -2517,4 +2533,16 @@ of /proc/PID/coredump_filter when generating the corefile. For more information
about this file, refer to the manpage of core(5)."),
NULL, show_use_coredump_filter,
&setlist, &showlist);
+
+ add_setshow_boolean_cmd ("dump-excluded-mappings", class_files,
+ &dump_excluded_mappings, _("\
+Set whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
+ _("\
+Show whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
+ _("\
+Use this command to set whether gcore should dump mappings marked with the\n\
+VM_DONTDUMP flag (\"dd\" in /proc/PID/smaps) when generating the corefile. For\n\
+more information about this file, refer to the manpage of proc(5) and core(5)."),
+ NULL, show_dump_excluded_mappings,
+ &setlist, &showlist);
}
--
2.14.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 2/5] Document new {set,show} dump-excluded-mappings commands.
2017-12-04 8:18 [PATCH v3 0/5] Enable the user to dump all memory regions Sergio Lopez
2017-12-04 8:18 ` [PATCH v3 1/5] Implement 'set dump-excluded-mappings' command Sergio Lopez
@ 2017-12-04 8:18 ` Sergio Lopez
2017-12-04 15:19 ` Eli Zaretskii
2017-12-04 8:18 ` [PATCH v3 3/5] Implement "-a" command line option for gcore Sergio Lopez
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Sergio Lopez @ 2017-12-04 8:18 UTC (permalink / raw)
To: gdb-patches; +Cc: Sergio Lopez
gdb/ChangeLog:
2017-11-29 Sergio Lopez <slp@redhat.com>
* NEWS (Changes since GDB 8.0): Announce {set,show}
dump_excluded_mappings commands.
gdb/doc/ChangeLog:
2017-11-29 Sergio Lopez <slp@redhat.com>
* gdb.texinfo (gcore): Mention new {set,show}
dump-excluded-mappings commands.
(set dump-excluded-mappings): Document new command.
---
gdb/NEWS | 5 +++++
gdb/doc/gdb.texinfo | 14 +++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 754ce103bd..1372552a37 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -134,6 +134,11 @@ set debug separate-debug-file
show debug separate-debug-file
Control the display of debug output about separate debug file search.
+set dump-excluded-mappings
+show dump-excluded-mappings
+ Control whether mappings marked with the VM_DONTDUMP flag should be
+ dumped when generating a core file.
+
maint info selftests
List the registered selftests.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 675f6e7bc8..7b25912e49 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -11543,7 +11543,9 @@ this writing, @sc{gnu}/Linux, FreeBSD, Solaris, and S390).
On @sc{gnu}/Linux, this command can take into account the value of the
file @file{/proc/@var{pid}/coredump_filter} when generating the core
-dump (@pxref{set use-coredump-filter}).
+dump (@pxref{set use-coredump-filter}), and by default honors the
+@code{VM_DONTDUMP} flag for mappings where it is present in the file
+@file{/proc/@var{pid}/smaps} (@pxref{set dump-excluded-mappings}).
@kindex set use-coredump-filter
@anchor{set use-coredump-filter}
@@ -11573,6 +11575,16 @@ value is currently @code{0x33}, which means that bits @code{0}
(anonymous private mappings), @code{1} (anonymous shared mappings),
@code{4} (ELF headers) and @code{5} (private huge pages) are active.
This will cause these memory mappings to be dumped automatically.
+
+@kindex set dump-excluded-mappings
+@anchor{set dump-excluded-mappings}
+@item set dump-excluded-mappings on
+@itemx set dump-excluded-mappings off
+If @code{on} is specified, @value{GDBN} will dump memory mappings
+marked with the @code{VM_DONTDUMP} flag. This flag is represented in
+the file @file{/proc/@var{pid}/smaps} with the acronym @code{dd}.
+
+The default value is @code{off}.
@end table
@node Character Sets
--
2.14.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 2/5] Document new {set,show} dump-excluded-mappings commands.
2017-12-04 8:18 ` [PATCH v3 2/5] Document new {set,show} dump-excluded-mappings commands Sergio Lopez
@ 2017-12-04 15:19 ` Eli Zaretskii
0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2017-12-04 15:19 UTC (permalink / raw)
To: Sergio Lopez; +Cc: gdb-patches, slp
> From: Sergio Lopez <slp@redhat.com>
> Cc: Sergio Lopez <slp@redhat.com>
> Date: Mon, 4 Dec 2017 09:17:13 +0100
>
> gdb/ChangeLog:
> 2017-11-29 Sergio Lopez <slp@redhat.com>
>
> * NEWS (Changes since GDB 8.0): Announce {set,show}
> dump_excluded_mappings commands.
>
> gdb/doc/ChangeLog:
> 2017-11-29 Sergio Lopez <slp@redhat.com>
>
> * gdb.texinfo (gcore): Mention new {set,show}
> dump-excluded-mappings commands.
> (set dump-excluded-mappings): Document new command.
OK.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 3/5] Implement "-a" command line option for gcore
2017-12-04 8:18 [PATCH v3 0/5] Enable the user to dump all memory regions Sergio Lopez
2017-12-04 8:18 ` [PATCH v3 1/5] Implement 'set dump-excluded-mappings' command Sergio Lopez
2017-12-04 8:18 ` [PATCH v3 2/5] Document new {set,show} dump-excluded-mappings commands Sergio Lopez
@ 2017-12-04 8:18 ` Sergio Lopez
2017-12-04 8:26 ` [PATCH v3 4/5] Document the new " Sergio Lopez
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Sergio Lopez @ 2017-12-04 8:18 UTC (permalink / raw)
To: gdb-patches; +Cc: Sergio Lopez
With the new "-a" command line option, the user may request gcore to
actually dump all present memory mappings. The actual effect of this
argument is OS dependent.
On GNU/Linux, it will disable use-coredump-filter and enable
dump-excluded-mappings.
gdb/ChangeLog:
2017-11-29 Sergio Lopez <slp@redhat.com>
* gcore.in: Add "-a" command line option for instructing gdb to
dump all memory mappings (OS dependent).
---
gdb/gcore.in | 47 ++++++++++++++++++++++++++++++-----------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/gdb/gcore.in b/gdb/gcore.in
index 632f21bdfa..44b2e98b27 100644
--- a/gdb/gcore.in
+++ b/gdb/gcore.in
@@ -20,27 +20,39 @@
# It starts up gdb, attaches to the given PID and invokes the gcore command.
#
-if [ "$#" -eq "0" ]
-then
- echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid"
- exit 2
-fi
-
# Need to check for -o option, but set default basename to "core".
name=core
-if [ "$1" = "-o" ]
+# When the -a option is present, this may hold additional commands
+# to ensure gdb dumps all mappings (OS dependent).
+dump_all_cmds=()
+
+while getopts :ao: opt; do
+ case $opt in
+ a)
+ case $OSTYPE in
+ linux*)
+ dump_all_cmds=("-ex" "set use-coredump-filter off")
+ dump_all_cmds+=("-ex" "set dump-excluded-mappings on")
+ ;;
+ esac
+ ;;
+ o)
+ name=$OPTARG
+ ;;
+ *)
+ echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o filename] pid"
+ exit 2
+ ;;
+ esac
+done
+
+shift $((OPTIND-1))
+
+if [ "$#" -eq "0" ]
then
- if [ "$#" -lt "3" ]
- then
- # Not enough arguments.
- echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid"
- exit 2
- fi
- name=$2
-
- # Shift over to start of pid list
- shift; shift
+ echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o filename] pid"
+ exit 2
fi
# Attempt to fetch the absolute path to the gcore script that was
@@ -87,6 +99,7 @@ do
# available but not accessible as GDB would get stopped on SIGTTIN.
$binary_path/@GDB_TRANSFORM_NAME@ </dev/null --nx --batch \
-ex "set pagination off" -ex "set height 0" -ex "set width 0" \
+ "${dump_all_cmds[@]}" \
-ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
if [ -r $name.$pid ] ; then
--
2.14.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 4/5] Document the new "-a" command line option for gcore
2017-12-04 8:18 [PATCH v3 0/5] Enable the user to dump all memory regions Sergio Lopez
` (2 preceding siblings ...)
2017-12-04 8:18 ` [PATCH v3 3/5] Implement "-a" command line option for gcore Sergio Lopez
@ 2017-12-04 8:26 ` Sergio Lopez
2017-12-04 15:25 ` Eli Zaretskii
2017-12-04 8:27 ` [PATCH v3 5/5] Extend gdb.core/coredump-filter.exp to test dump-excluded-mappings Sergio Lopez
2017-12-04 14:37 ` [PATCH v3 0/5] Enable the user to dump all memory regions Pedro Alves
5 siblings, 1 reply; 11+ messages in thread
From: Sergio Lopez @ 2017-12-04 8:26 UTC (permalink / raw)
To: gdb-patches; +Cc: Sergio Lopez
gdb/ChangeLog:
2017-11-29 Sergio Lopez <slp@redhat.com>
* NEWS (Changes since GDB 8.0): Announce new "-a"
command line option for gcore.
gdb/doc/ChangeLog:
2017-11-29 Sergio Lopez <slp@redhat.com>
* gdb.texinfo (gcore man): Document new "-a" command line option.
---
gdb/NEWS | 5 +++++
gdb/doc/gdb.texinfo | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 1372552a37..ce84fe7924 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -52,6 +52,11 @@
** The "complete" command now mimics TAB completion accurately.
+* New command line options (gcore)
+
+-a
+ Dump all memory mappings.
+
* Python Scripting
** New events gdb.new_inferior, gdb.inferior_deleted, and
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 7b25912e49..88d6820998 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -42948,7 +42948,7 @@ Richard M. Stallman and Roland H. Pesch, July 1991.
@format
@c man begin SYNOPSIS gcore
-gcore [-o @var{filename}] @var{pid}
+gcore [-a] [-o @var{filename}] @var{pid}
@c man end
@end format
@@ -42962,6 +42962,11 @@ running without any change.
@c man begin OPTIONS gcore
@table @env
+@item -a
+Dump all memory mappings. The actual effect of this option depends on the
+Operating System. On @sc{gnu}/Linux, it will disable
+@code{use-coredump-filter} and enable @code{dump-excluded-mappings}.
+
@item -o @var{filename}
The optional argument
@var{filename} specifies the file name where to put the core dump.
--
2.14.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] Document the new "-a" command line option for gcore
2017-12-04 8:26 ` [PATCH v3 4/5] Document the new " Sergio Lopez
@ 2017-12-04 15:25 ` Eli Zaretskii
2017-12-04 17:10 ` Sergio Durigan Junior
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2017-12-04 15:25 UTC (permalink / raw)
To: Sergio Lopez; +Cc: gdb-patches
> From: Sergio Lopez <slp@redhat.com>
> Cc: Sergio Lopez <slp@redhat.com>
> Date: Mon, 4 Dec 2017 09:17:15 +0100
>
> gdb/ChangeLog:
> 2017-11-29 Sergio Lopez <slp@redhat.com>
>
> * NEWS (Changes since GDB 8.0): Announce new "-a"
> command line option for gcore.
>
> gdb/doc/ChangeLog:
> 2017-11-29 Sergio Lopez <slp@redhat.com>
>
> * gdb.texinfo (gcore man): Document new "-a" command line option.
OK, but...
> @c man begin OPTIONS gcore
> @table @env
> +@item -a
> +Dump all memory mappings. The actual effect of this option depends on the
> +Operating System. On @sc{gnu}/Linux, it will disable
> +@code{use-coredump-filter} and enable @code{dump-excluded-mappings}.
...should we have a cross-reference here to where the above commands
are described?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 4/5] Document the new "-a" command line option for gcore
2017-12-04 15:25 ` Eli Zaretskii
@ 2017-12-04 17:10 ` Sergio Durigan Junior
0 siblings, 0 replies; 11+ messages in thread
From: Sergio Durigan Junior @ 2017-12-04 17:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Sergio Lopez, gdb-patches
On Monday, December 04 2017, Eli Zaretskii wrote:
>> From: Sergio Lopez <slp@redhat.com>
>> Cc: Sergio Lopez <slp@redhat.com>
>> Date: Mon, 4 Dec 2017 09:17:15 +0100
>>
>> gdb/ChangeLog:
>> 2017-11-29 Sergio Lopez <slp@redhat.com>
>>
>> * NEWS (Changes since GDB 8.0): Announce new "-a"
>> command line option for gcore.
>>
>> gdb/doc/ChangeLog:
>> 2017-11-29 Sergio Lopez <slp@redhat.com>
>>
>> * gdb.texinfo (gcore man): Document new "-a" command line option.
>
> OK, but...
>
>> @c man begin OPTIONS gcore
>> @table @env
>> +@item -a
>> +Dump all memory mappings. The actual effect of this option depends on the
>> +Operating System. On @sc{gnu}/Linux, it will disable
>> +@code{use-coredump-filter} and enable @code{dump-excluded-mappings}.
>
> ...should we have a cross-reference here to where the above commands
> are described?
Pedro approved the patches and I pushed them for Sergio. I also took
the liberty to address Eli's comment before applying the patches.
here's the diff against Sergio's original patch.
Thanks,
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 1c383b4d47..3b251c60c1 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -43063,9 +43063,11 @@ running without any change.
@c man begin OPTIONS gcore
@table @env
@item -a
-Dump all memory mappings. The actual effect of this option depends on the
-Operating System. On @sc{gnu}/Linux, it will disable
-@code{use-coredump-filter} and enable @code{dump-excluded-mappings}.
+Dump all memory mappings. The actual effect of this option depends on
+the Operating System. On @sc{gnu}/Linux, it will disable
+@code{use-coredump-filter} (@pxref{set use-coredump-filter}) and
+enable @code{dump-excluded-mappings} (@pxref{set
+dump-excluded-mappings}).
@item -o @var{filename}
The optional argument
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3 5/5] Extend gdb.core/coredump-filter.exp to test dump-excluded-mappings.
2017-12-04 8:18 [PATCH v3 0/5] Enable the user to dump all memory regions Sergio Lopez
` (3 preceding siblings ...)
2017-12-04 8:26 ` [PATCH v3 4/5] Document the new " Sergio Lopez
@ 2017-12-04 8:27 ` Sergio Lopez
2017-12-04 14:37 ` [PATCH v3 0/5] Enable the user to dump all memory regions Pedro Alves
5 siblings, 0 replies; 11+ messages in thread
From: Sergio Lopez @ 2017-12-04 8:27 UTC (permalink / raw)
To: gdb-patches; +Cc: Sergio Lopez
gdb/testsuite/ChangeLog:
2017-11-30 Sergio Lopez <slp@redhat.com>
* gdb.core/coredump-filter.exp: Extend test to verify
the functionality of the dump-excluded-mappings command.
---
gdb/testsuite/gdb.base/coredump-filter.exp | 46 ++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 12 deletions(-)
diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp
index f54164f75f..de2f22983f 100644
--- a/gdb/testsuite/gdb.base/coredump-filter.exp
+++ b/gdb/testsuite/gdb.base/coredump-filter.exp
@@ -33,16 +33,26 @@ if { ![runto_main] } {
gdb_breakpoint [gdb_get_line_number "break-here"]
gdb_continue_to_breakpoint "break-here" ".* break-here .*"
-proc do_save_core { filter_flag core } {
+proc do_save_core { filter_flag core dump_excluded } {
verbose -log "writing $filter_flag to /proc/<inferior pid>/coredump_filter"
gdb_test "p set_coredump_filter ($filter_flag)" " = 0"
+ # Enable dumping of excluded mappings (i.e. VM_DONTDUMP).
+ if { $dump_excluded == 1 } {
+ gdb_test_no_output "set dump-excluded-mappings on"
+ }
+
# Generate a corefile.
gdb_gcore_cmd "$core" "save corefile"
+
+ # Restore original status.
+ if { $dump_excluded == 1 } {
+ gdb_test_no_output "set dump-excluded-mappings off"
+ }
}
-proc do_load_and_test_core { core var working_var working_value } {
+proc do_load_and_test_core { core var working_var working_value dump_excluded } {
global hex decimal coredump_var_addr
set core_loaded [gdb_core_cmd "$core" "load core"]
@@ -52,10 +62,16 @@ proc do_load_and_test_core { core var working_var working_value } {
}
# Access the memory the addresses point to.
- gdb_test "print/x *(char *) $coredump_var_addr($var)" "\(\\\$$decimal = <error: \)?Cannot access memory at address $hex\(>\)?" \
- "printing $var when core is loaded (should not work)"
- gdb_test "print/x *(char *) $coredump_var_addr($working_var)" " = $working_value.*" \
- "print/x *$working_var ( = $working_value)"
+ if { $dump_excluded == 0 } {
+ gdb_test "print/x *(char *) $coredump_var_addr($var)" "\(\\\$$decimal = <error: \)?Cannot access memory at address $hex\(>\)?" \
+ "printing $var when core is loaded (should not work)"
+ gdb_test "print/x *(char *) $coredump_var_addr($working_var)" " = $working_value.*" \
+ "print/x *$working_var ( = $working_value)"
+ } else {
+ # Check if VM_DONTDUMP mappings are present in the core file.
+ gdb_test "print/x *(char *) $coredump_var_addr($var)" " = $working_value.*" \
+ "print/x *$var ( = $working_value)"
+ }
}
# We do not do file-backed mappings in the test program, but it is
@@ -107,6 +123,7 @@ set non_shared_anon_core [standard_output_file non-shared-anon.gcore]
# A corefile without {private,shared} {anonymous,file-backed} pages
set non_private_shared_anon_file_core [standard_output_file non-private-shared-anon-file.gcore]
set dont_dump_core [standard_output_file dont-dump.gcore]
+set dump_excluded_core [standard_output_file dump-excluded.gcore]
# We will generate a few corefiles.
#
@@ -122,6 +139,8 @@ set dont_dump_core [standard_output_file dont-dump.gcore]
# - name of a variable in the C source code that points to a memory
# mapping that WILL be present in the corefile
# - corresponding value expected for the above variable
+# - whether to include mappings marked as VM_DONTDUMP in the
+# corefile (1) or not (0).
#
# This list refers to the corefiles generated by MAP_ANONYMOUS in the
# test program.
@@ -129,13 +148,16 @@ set dont_dump_core [standard_output_file dont-dump.gcore]
set all_anon_corefiles { { "non-Private-Anonymous" "0x7e" \
$non_private_anon_core \
"private_anon" \
- "shared_anon" "0x22" }
+ "shared_anon" "0x22" "0" }
{ "non-Shared-Anonymous" "0x7d" \
$non_shared_anon_core "shared_anon" \
- "private_anon" "0x11" }
+ "private_anon" "0x11" "0" }
{ "DoNotDump" "0x33" \
$dont_dump_core "dont_dump" \
- "shared_anon" "0x22" } }
+ "shared_anon" "0x22" "0" }
+ { "DoNotDump-DumpExcluded" "0x33" \
+ $dump_excluded_core "dont_dump" \
+ "shared_anon" "0x55" "1" } }
# If corefile loading is not supported, we do not even try to run the
# tests.
@@ -181,12 +203,12 @@ foreach item $all_anon_corefiles {
# Generate corefiles for the "anon" case.
foreach item $all_anon_corefiles {
with_test_prefix "saving corefile for [lindex $item 0]" {
- do_save_core [lindex $item 1] [subst [lindex $item 2]]
+ do_save_core [lindex $item 1] [subst [lindex $item 2]] [lindex $item 6]
}
}
with_test_prefix "saving corefile for non-Private-Shared-Anon-File" {
- do_save_core "0x60" $non_private_shared_anon_file_core
+ do_save_core "0x60" $non_private_shared_anon_file_core "0"
}
clean_restart $testfile
@@ -194,7 +216,7 @@ clean_restart $testfile
foreach item $all_anon_corefiles {
with_test_prefix "loading and testing corefile for [lindex $item 0]" {
do_load_and_test_core [subst [lindex $item 2]] [lindex $item 3] \
- [lindex $item 4] [lindex $item 5]
+ [lindex $item 4] [lindex $item 5] [lindex $item 6]
}
with_test_prefix "disassembling function main for [lindex $item 0]" {
--
2.14.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 0/5] Enable the user to dump all memory regions
2017-12-04 8:18 [PATCH v3 0/5] Enable the user to dump all memory regions Sergio Lopez
` (4 preceding siblings ...)
2017-12-04 8:27 ` [PATCH v3 5/5] Extend gdb.core/coredump-filter.exp to test dump-excluded-mappings Sergio Lopez
@ 2017-12-04 14:37 ` Pedro Alves
2017-12-04 17:09 ` Sergio Durigan Junior
5 siblings, 1 reply; 11+ messages in thread
From: Pedro Alves @ 2017-12-04 14:37 UTC (permalink / raw)
To: Sergio Lopez, gdb-patches
On 12/04/2017 08:17 AM, Sergio Lopez wrote:
> GDB versions prior to df8411da087dc05481926f4c4a82deabc5bc3859
> unconditionally included all memory regions in the core dump.
>
> After that change, while is still possible to ask GDB to ignore
> /proc/PID/coredump_filter using the 'set use-coredump-filter' command,
> there's no way to request it to dump regions marked with the VM_DONTDUMP
> flag ("dd" in /proc/PID/smaps").
>
> This patch series implement the new 'set dump-excluded-mappings' command
> for GDB, and the "-a" argument for gcore, allowing the user to mimic the
> behavior of previous GDB versions.
>
> ---
>
> Changes since v2:
> - 1/5: Removed an empty line between command and definition of variable.
> - 5/5: Added a test case for 'set dump-excluded-mappings'.
Thanks!
This is OK.
Pedro Alves
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v3 0/5] Enable the user to dump all memory regions
2017-12-04 14:37 ` [PATCH v3 0/5] Enable the user to dump all memory regions Pedro Alves
@ 2017-12-04 17:09 ` Sergio Durigan Junior
0 siblings, 0 replies; 11+ messages in thread
From: Sergio Durigan Junior @ 2017-12-04 17:09 UTC (permalink / raw)
To: Pedro Alves; +Cc: Sergio Lopez, gdb-patches
On Monday, December 04 2017, Pedro Alves wrote:
> On 12/04/2017 08:17 AM, Sergio Lopez wrote:
>> GDB versions prior to df8411da087dc05481926f4c4a82deabc5bc3859
>> unconditionally included all memory regions in the core dump.
>>
>> After that change, while is still possible to ask GDB to ignore
>> /proc/PID/coredump_filter using the 'set use-coredump-filter' command,
>> there's no way to request it to dump regions marked with the VM_DONTDUMP
>> flag ("dd" in /proc/PID/smaps").
>>
>> This patch series implement the new 'set dump-excluded-mappings' command
>> for GDB, and the "-a" argument for gcore, allowing the user to mimic the
>> behavior of previous GDB versions.
>>
>> ---
>>
>> Changes since v2:
>> - 1/5: Removed an empty line between command and definition of variable.
>> - 5/5: Added a test case for 'set dump-excluded-mappings'.
>
> Thanks!
>
> This is OK.
I pushed the patches for him (courtesy from Sergio to Sergio).
3e1a70a018 Extend gdb.core/coredump-filter.exp to test dump-excluded-mappings.
c179febe79 Document the new "-a" command line option for gcore
cd93789b89 Implement "-a" command line option for gcore
1e52e8495a Document new {set,show} dump-excluded-mappings commands.
afa840dcc0 Implement 'set dump-excluded-mappings' command
Thanks,
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
^ permalink raw reply [flat|nested] 11+ messages in thread