From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Sergio Lopez <slp@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/4] Add "-a" argument to gcore.in
Date: Tue, 28 Nov 2017 15:57:00 -0000 [thread overview]
Message-ID: <87609uo0p6.fsf@redhat.com> (raw)
In-Reply-To: <20171128132148.31802-4-slp@redhat.com> (Sergio Lopez's message of "Tue, 28 Nov 2017 14:21:47 +0100")
On Tuesday, November 28 2017, Sergio Lopez wrote:
> The new "-a" argument instructs the gcore script to disable both
> use-coredump-filter and honor-dontdump-flag before generating the core
> file.
>
> This allows the user to unconditionally dump all memory regions,
> mimicking the behavior of previous gdb/gcore versions (before support
> for coredump_filter was implemented).
> 2017-11-28 Sergio Lopez <slp@redhat.com>
> * gcore.in: Add "-a" argument for disabling both
> use-coredump-filter and honor-dontdump-flag.
> ---
> gdb/ChangeLog | 4 ++++
> gdb/gcore.in | 25 +++++++++++++++++++++++--
> 2 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index ce68fee776..ba8826c84c 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,7 @@
> +2017-11-28 Sergio Lopez <slp@redhat.com>
> + * gcore.in: Add "-a" argument for disabling both
> + use-coredump-filter and honor-dontdump-flag.
> +
> 2017-11-28 Sergio Lopez <slp@redhat.com>
>
> * linux-tdep.c (honor_dontdump_flag): New variable.
> diff --git a/gdb/gcore.in b/gdb/gcore.in
> index 632f21bdfa..32e597dc4f 100644
> --- a/gdb/gcore.in
> +++ b/gdb/gcore.in
> @@ -22,10 +22,29 @@
>
> if [ "$#" -eq "0" ]
> then
> - echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid"
> + echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o filename] pid"
> exit 2
> fi
>
> +# Check for -a option, default to honor coredump_filter and VM_DONTDUMP.
> +use_coredump_filter=on
> +honor_dontdump_flag=on
> +
> +if [ "$1" = "-a" ]
> +then
> + if [ "$#" -lt "2" ]
> + then
> + # Not enough arguments.
> + echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o filename] pid"
> + exit 2
> + fi
> + use_coredump_filter=off
> + honor_dontdump_flag=off
> +
> + # Shift over to the next argument
> + shift;
> +fi
This is forcing the '-a' flag to come first, right? Can you implement a
better argument parsing here, so that the user can pass '-a' anywhere in
the command line? You can use getopt or even do your own loop.
> +
> # Need to check for -o option, but set default basename to "core".
> name=core
>
> @@ -34,7 +53,7 @@ then
> if [ "$#" -lt "3" ]
> then
> # Not enough arguments.
> - echo "usage: @GCORE_TRANSFORM_NAME@ [-o filename] pid"
> + echo "usage: @GCORE_TRANSFORM_NAME@ [-a] [-o filename] pid"
> exit 2
> fi
> name=$2
> @@ -87,6 +106,8 @@ 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" \
> + -ex "set use-coredump-filter $use_coredump_filter" \
> + -ex "set honor-dontdump-flag $honor_dontdump_flag" \
> -ex "attach $pid" -ex "gcore $name.$pid" -ex detach -ex quit
>
> if [ -r $name.$pid ] ; then
> --
> 2.14.3
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/
next prev parent reply other threads:[~2017-11-28 15:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-28 13:22 [PATCH 0/4] Enable the user to dump all memory regions Sergio Lopez
2017-11-28 13:22 ` [PATCH 4/4] Document the new "-a" argument for gcore Sergio Lopez
2017-11-28 15:54 ` Sergio Durigan Junior
2017-11-28 16:35 ` Eli Zaretskii
2017-11-28 18:37 ` John Baldwin
2017-11-28 13:22 ` [PATCH 1/4] Implement 'set honor-dontdump-flag' command Sergio Lopez
2017-11-28 15:06 ` Sergio Lopez
2017-11-28 15:42 ` Sergio Durigan Junior
2017-11-28 16:21 ` Pedro Alves
2017-11-28 16:36 ` Sergio Durigan Junior
2017-11-29 10:59 ` Sergio Lopez
2017-11-29 19:39 ` Sergio Durigan Junior
2017-11-29 20:02 ` Sergio Lopez
2017-11-29 20:22 ` Sergio Durigan Junior
2017-11-28 13:22 ` [PATCH 3/4] Add "-a" argument to gcore.in Sergio Lopez
2017-11-28 15:57 ` Sergio Durigan Junior [this message]
2017-11-28 13:22 ` [PATCH 2/4] Document new 'set honor-dontdump-flag' command Sergio Lopez
2017-11-28 15:51 ` Sergio Durigan Junior
2017-11-28 16:32 ` Pedro Alves
2017-11-28 16:39 ` Eli Zaretskii
2017-11-28 16:08 ` [PATCH 0/4] Enable the user to dump all memory regions Sergio Durigan Junior
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=87609uo0p6.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=slp@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