From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01olkn2052.outbound.protection.outlook.com [40.92.99.52]) by sourceware.org (Postfix) with ESMTPS id EBFEF3857818 for ; Tue, 22 Feb 2022 16:56:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EBFEF3857818 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J1hSz6mgcjk/kIcIR6QO/UYlZRzk75RGx6ZnJ17M68ORbFA6WmCQfrB4MlSSHGrMw9Nwwn/m7KrmLSmDgrNCdW/MFFotSpKOqz6YpRx32BUDsa/Mev1jO18T1AaT9sTEdjwOvD/I4ukhgNG9Jxf3m3iYzGSxQC+awX2N9cLp57GqruD8+wMVG660CNi3engmmFjFLJkun1JBHazbWKwWvHmHSfjxrX9cnZVUHtGGxXMMH4wWpaasitdrbPCFolv2VdTO8aOrvUOb2trQ7V5oXsxLQAruE96m5EVNgL2KEYs5swfzY0hirEX/6MQU01NMfurux1Ri6aoDticyr4gMyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w4HPZwsRxsDLj80u3V0a2Egid7++JdbfAxH/LhTpiTY=; b=kXls6L6w5DigoYT60Eb9QpWYfyLtfFTQfKUBVl/bkCjUNvs64+MsR9EGGGXgE7r8IVnT06V/s2c6ujOucqKLuH4KLXOHisSgxG97l+93pdhCITBEuaWNvnmxBE33BhChd7CKGg+9a5eS4J4KCvtoE124ixRaS3aqxErdYPUp9xVCSgD7JX2Zw/pLHWshSkjvl1ItAwNoB23c1p+gUVWNKZnPieuQG0+aJ0G22DU91Ku/Ffu7pD0xW5G82QPo71NXG/FdAviwFAYvWbZPfGOSjqJ9f17tsrvb7PbN1w4MUa1JODVMOMLgiAZZu4/L1wMp2cIVc5PGY6xo0S50q2eWyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from OS3PR01MB6291.jpnprd01.prod.outlook.com (2603:1096:604:e2::9) by TY2PR01MB2859.jpnprd01.prod.outlook.com (2603:1096:404:73::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16; Tue, 22 Feb 2022 16:56:35 +0000 Received: from OS3PR01MB6291.jpnprd01.prod.outlook.com ([fe80::adf3:eada:74f8:f8a1]) by OS3PR01MB6291.jpnprd01.prod.outlook.com ([fe80::adf3:eada:74f8:f8a1%8]) with mapi id 15.20.5017.022; Tue, 22 Feb 2022 16:56:35 +0000 Message-ID: Date: Tue, 22 Feb 2022 21:56:20 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: Making mi -add-inferior command consistent with ci Content-Language: en-US To: Andrew Burgess , "gdb-patches@sourceware.org" References: <87pmnfat9o.fsf@redhat.com> From: Muhammad Umair Sair In-Reply-To: <87pmnfat9o.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TMN: [ZfZcsFKUmPUmQlE7sNXJ7XdX9LyOeBAJ] X-ClientProxiedBy: DB6PR0801CA0046.eurprd08.prod.outlook.com (2603:10a6:4:2b::14) To OS3PR01MB6291.jpnprd01.prod.outlook.com (2603:1096:604:e2::9) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c4fc751-d976-424c-d4a0-08d9f6244870 X-MS-TrafficTypeDiagnostic: TY2PR01MB2859:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-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q1NlcVl2Zy8yaHYz?= =?utf-8?B?cDM0b0ZpVHRGVXdTTUFMaHNCMUVZam93RHVrd0tQN3VhZmN5dVJPREppS2dn?= =?utf-8?B?T2dhWW5YUW9DSldTTG4vNWV2VmUxcXR5QTJKZmJndGZwRFpwUT09?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-9cf38.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 2c4fc751-d976-424c-d4a0-08d9f6244870 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB6291.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2022 16:56:35.7692 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR01MB2859 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_MUA_MOZILLA, FREEMAIL_FROM, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 22 Feb 2022 16:56:42 -0000 On 2/22/22 7:08 PM, Andrew Burgess wrote: > Muhammad Umair Sair via Gdb-patches writes: > >> From 3729f798d1f75a74eefe0c240d8c4c9849dac308 Mon Sep 17 00:00:00 2001 >> From: Umair Sair >> Date: Tue, 22 Feb 2022 01:40:06 +0500 >> Subject: [PATCH] Making mi -add-inferior command consistent with ci >> >> With multi-target debugging support in gdb, add-inferior command without >> arguments in console interpreter adds a new inferior and sets the connection >> of previously selected inferior as the connection of new inferior as well. >> But the same command for machine interpreter is not setting the connection >> for new inferior. This commit fixes this issue and makes the console and >> machine interpreter behavior consistent for add-inferior command. > > We're usually pretty conservative about changing MI behaviour in non > backward compatible ways. I'm not entirely sure that this change wont > cause problems for an existing f/e that is using -add-inferior? > > Maybe I'm worrying about nothing? I'm open to being convinced. The older change broke it in non backward compatibility way and this commit is fixing it. I faced issues compared to older versions of gdb and on investigation I found this issue. Following is the commit where we supported multi-target. https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5b6d1e4fa4fc6827c7b3f0e99ff120dfa14d65d2 > > Another option would be to add a new option, e.g.: > > -add-inferior [--connection NUM] > > or > > -add-inferior [--inherit-connection] > IMO we should support the same options as in console. Currently we don't allow any arguments for -add-inferior MI command though console add-inferior command allows several arguments. I was thinking to support at least "--no-connection" argument which is also supported in console. IMO we can add it separate commit and keep this commit for fixing the regression. WDYS? > >> --- >> gdb/ChangeLog | 9 +++++++++ >> gdb/inferior.c | 4 ++-- >> gdb/inferior.h | 5 ++++- >> gdb/mi/mi-main.c | 4 +++- >> 4 files changed, 18 insertions(+), 4 deletions(-) >> >> diff --git a/gdb/ChangeLog b/gdb/ChangeLog >> index dfee3dad157..1f342cc628f 100644 >> --- a/gdb/ChangeLog >> +++ b/gdb/ChangeLog >> @@ -1,3 +1,12 @@ >> +2022-02-22 Umair Sair >> + >> + * gdb/inferior.c (switch_to_inferior_and_push_target): allowing >> + access to this function outside of file. >> + * gdb/inferior.h (switch_to_inferior_and_push_target): added extern >> + entry for function in header. >> + * gdb/mi/mi-main.c (mi_cmd_add_inferior): new inferior should use >> + the connection from previously selected inferior. >> + > > We no longer maintain ChangeLog in gdb, so this part is not needed. > You're welcome to keep the ChangeLog text in the commit message in > _addition_ to the long form description, but this is not a requirement. > Yes. I actually created this patch for gdb-10-branch. Is there any policy to submit patches for older releases? Or should I submit patch for master? >> 2021-04-23 Tom Tromey >> >> PR gdb/27743: >> diff --git a/gdb/inferior.c b/gdb/inferior.c >> index 4fdddbcb55b..16e4279bc1a 100644 >> --- a/gdb/inferior.c >> +++ b/gdb/inferior.c >> @@ -1,6 +1,6 @@ >> /* Multi-process control for GDB, the GNU debugger. >> >> - Copyright (C) 2008-2021 Free Software Foundation, Inc. >> + Copyright (C) 2008-2022 Free Software Foundation, Inc. >> > > Not sure what's going on here. The patch shows all the dates changing, > but all the files you've changed already have 2022 in the upstream > master branch. The patch was for gdb-10-branch. I'll update patch according to the responses of queries above. Thanks, Umair Sair > > Thanks, > Andrew > >> This file is part of GDB. >> >> @@ -740,7 +740,7 @@ add_inferior_with_spaces (void) >> NO_CONNECTION is true, push the process_stratum_target of ORG_INF >> to NEW_INF. */ >> >> -static void >> +void >> switch_to_inferior_and_push_target (inferior *new_inf, >> bool no_connection, inferior *org_inf) >> { >> diff --git a/gdb/inferior.h b/gdb/inferior.h >> index fb7d0c2bc1a..d4abd00489a 100644 >> --- a/gdb/inferior.h >> +++ b/gdb/inferior.h >> @@ -1,7 +1,7 @@ >> /* Variables that describe the inferior process running under GDB: >> Where it is, why it stopped, and how to step it. >> >> - Copyright (C) 1986-2021 Free Software Foundation, Inc. >> + Copyright (C) 1986-2022 Free Software Foundation, Inc. >> >> This file is part of GDB. >> >> @@ -686,4 +686,7 @@ extern struct inferior *add_inferior_with_spaces (void); >> /* Print the current selected inferior. */ >> extern void print_selected_inferior (struct ui_out *uiout); >> >> +extern void switch_to_inferior_and_push_target (inferior *new_inf, >> + bool no_connection, inferior *org_inf); >> + >> #endif /* !defined (INFERIOR_H) */ >> diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c >> index e38520a98e6..65c0aa5be0b 100644 >> --- a/gdb/mi/mi-main.c >> +++ b/gdb/mi/mi-main.c >> @@ -1,6 +1,6 @@ >> /* MI Command Set. >> >> - Copyright (C) 2000-2021 Free Software Foundation, Inc. >> + Copyright (C) 2000-2022 Free Software Foundation, Inc. >> >> Contributed by Cygnus Solutions (a Red Hat company). >> >> @@ -1702,6 +1702,8 @@ mi_cmd_add_inferior (const char *command, char **argv, int argc) >> >> inf = add_inferior_with_spaces (); >> >> + switch_to_inferior_and_push_target (inf, false, current_inferior ()); >> + >> current_uiout->field_fmt ("inferior", "i%d", inf->num); >> } >> >> -- >> 2.31.1 >