From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MwSgJram+19XBgAAWB0awg (envelope-from ) for ; Sun, 10 Jan 2021 20:15:34 -0500 Received: by simark.ca (Postfix, from userid 112) id 8E57C1EE85; Sun, 10 Jan 2021 20:15:34 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D0F531E940 for ; Sun, 10 Jan 2021 20:15:33 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 401CD385480A; Mon, 11 Jan 2021 01:15:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 401CD385480A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1610327733; bh=YqolBNzLdC0fHT8xn2ulplbL+8U/Njk4ZWW6Sra4H2o=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jZVBYu4tocyyh0eY9MbcaclM2uAHLOLecYbTdqjIOApIMummSLa+7WDPM5p0eGkyJ U44zJeXzR/bNcf1GVoUlJhboMecr35/w7W3sDOYHtEA0+HcPKxYC1KFh+62ZrBFjCN U3uGUcqUkQ+hcqIawhE75f3jwP+1YR5raRX88wE4= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 9E39E385480A for ; Mon, 11 Jan 2021 01:15:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9E39E385480A Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 10B1EMwY004369 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 10 Jan 2021 20:14:27 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 10B1EMwY004369 Received: from [10.0.0.213] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 90D661E940; Sun, 10 Jan 2021 20:14:22 -0500 (EST) Subject: Re: [PATCH v4] inferior without argument prints detail of current inferior To: Lancelot SIX , gdb-patches@sourceware.org References: <20201218220440.12127-1-lsix@lancelotsix.com> <20210110175824.16110-1-lsix@lancelotsix.com> Message-ID: <83d1ebfc-63fe-c20a-e892-2f40b041ed2e@polymtl.ca> Date: Sun, 10 Jan 2021 20:14:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210110175824.16110-1-lsix@lancelotsix.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 11 Jan 2021 01:14:22 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-01-10 12:58 p.m., Lancelot SIX via Gdb-patches wrote: > This patch makes the inferior command display information about the > current inferior when called with no argument. This behavior is similar > to the one of the thread command. > > This contribution is inspired by an item in > https://sourceware.org/gdb/wiki/ProjectIdeas > > Before patch: > > (gdb) info inferior > Num Description Connection Executable > * 1 process 19221 1 (native) /home/lsix/tmp/a.out > 2 process 19239 1 (native) /home/lsix/tmp/a.out > (gdb) inferior 2 > [Switching to inferior 2 [process 19239] (/home/lsix/tmp/a.out)] > [Switching to thread 2.1 (process 19239)] > #0 0x0000000000401146 in main () > (gdb) inferior > Argument required (expression to compute). > > After patch: > > (gdb) info inferior > Num Description Connection Executable > * 1 process 18699 1 (native) /home/lsix/tmp/a.out > 2 process 18705 1 (native) /home/lsix/tmp/a.out > (gdb) inferior 2 > [Switching to inferior 2 [process 18705] (/home/lsix/tmp/a.out)] > [Switching to thread 2.1 (process 18705)] > #0 0x0000000000401146 in main () > (gdb) inferior > [Current inferior is 2 [process 18705] (/home/lsix/tmp/a.out)] > > Changes from V1: > * Add test. > > Change from V2: > * Fix gdb/doc/ChangeLog entry. > > Change from V3: > * Add entry in the NEWS file. > * Improve inferior-noarg.expr and remove assumptions particular > format in pid_to_str. > * Fix copyright year in new files. > > gdb/doc/ChangeLog: > > * gdb.texinfo (Inferiors Connections and Programs): Document the > inferior command when used without argument. > > gdb/ChangeLog: > > * NEWS: Add entry for the behavior change of the inferior command. > * inferior.c (inferior_command): When no argument is given to the > inferior command, display info about the currently selected > inferior. > > gdb/testsuite/ChangeLog: > > * gdb.base/inferior-noarg.c: New test. > * gdb.base/inferior-noarg.exp: New test. > > --- > --- > gdb/NEWS | 6 +++ > gdb/doc/gdb.texinfo | 16 +++++++ > gdb/inferior.c | 58 +++++++++++++++-------- > gdb/testsuite/gdb.base/inferior-noarg.c | 22 +++++++++ > gdb/testsuite/gdb.base/inferior-noarg.exp | 36 ++++++++++++++ > 5 files changed, 117 insertions(+), 21 deletions(-) > create mode 100644 gdb/testsuite/gdb.base/inferior-noarg.c > create mode 100644 gdb/testsuite/gdb.base/inferior-noarg.exp > > diff --git a/gdb/NEWS b/gdb/NEWS > index 66702862ef..d9788f6733 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -75,6 +75,12 @@ maintenance flush-symbol-cache > 'maintenance flush register-cache' and 'maintenance flush > symbol-cache' respectively. > > +inferior [ID] > + When the ID parameter is omitted, then this command prints information > + about the current inferior. When the ID parameter is present, the > + behavior of the command is unchanged and have the inferior ID become > + the current inferior. I'll let Eli review the NEWS entry, otherwise the patch LGTM. Let us know when you have your sourceware account. Simon