From patchwork Tue Nov 28 13:21:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Lopez X-Patchwork-Id: 24573 Received: (qmail 119913 invoked by alias); 28 Nov 2017 13:22:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 119817 invoked by uid 89); 28 Nov 2017 13:22:21 -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=accessible 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 13:22:19 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB8C0C053B02 for ; Tue, 28 Nov 2017 13:22:18 +0000 (UTC) Received: from dritchie.redhat.com (unknown [10.36.118.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2933D5C549; Tue, 28 Nov 2017 13:22:16 +0000 (UTC) From: Sergio Lopez To: gdb-patches@sourceware.org Cc: Sergio Lopez Subject: [PATCH 3/4] Add "-a" argument to gcore.in Date: Tue, 28 Nov 2017 14:21:47 +0100 Message-Id: <20171128132148.31802-4-slp@redhat.com> In-Reply-To: <20171128132148.31802-1-slp@redhat.com> References: <20171128132148.31802-1-slp@redhat.com> 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 + # 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@