From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102723 invoked by alias); 28 Nov 2017 15:57:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 102698 invoked by uid 89); 28 Nov 2017 15:57:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Nov 2017 15:57:45 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A165E746 for ; Tue, 28 Nov 2017 15:57:44 +0000 (UTC) Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A637600D1; Tue, 28 Nov 2017 15:57:42 +0000 (UTC) From: Sergio Durigan Junior To: Sergio Lopez Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/4] Add "-a" argument to gcore.in References: <20171128132148.31802-1-slp@redhat.com> <20171128132148.31802-4-slp@redhat.com> Date: Tue, 28 Nov 2017 15:57:00 -0000 In-Reply-To: <20171128132148.31802-4-slp@redhat.com> (Sergio Lopez's message of "Tue, 28 Nov 2017 14:21:47 +0100") Message-ID: <87609uo0p6.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00733.txt.bz2 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 > * 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 > + * gcore.in: Add "-a" argument for disabling both > + use-coredump-filter and honor-dontdump-flag. > + > 2017-11-28 Sergio Lopez > > * 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@ -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/